Benjamin Otte
2007-Mar-22 08:48 UTC
[Swfdec] 11 commits - libswfdec/swfdec_color.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_movie.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_net_stream.h libswfdec/swfdec_pattern.c libswfdec/swfdec_script.c NEWS test/trace
NEWS | 13 + libswfdec/swfdec_color.c | 2 libswfdec/swfdec_flv_decoder.c | 8 - libswfdec/swfdec_js_net_stream.c | 16 ++ libswfdec/swfdec_movie.c | 2 libswfdec/swfdec_net_stream.c | 47 ++++++ libswfdec/swfdec_net_stream.h | 2 libswfdec/swfdec_pattern.c | 2 libswfdec/swfdec_script.c | 29 ++- test/trace/Makefile.am | 8 + test/trace/divide-7.swf |binary test/trace/divide-7.swf.trace | 169 +++++++++++++++++++++++ test/trace/divide.as | 9 + test/trace/doaction-after-placeobject.swf |binary test/trace/doaction-after-placeobject.swf.trace | 3 test/trace/doaction-before-placeobject.c | 38 +++++ test/trace/doaction-before-placeobject.swf |binary test/trace/doaction-before-placeobject.swf.trace | 3 test/trace/object-math-7.swf.trace | 4 test/trace/undefined2-7.swf.trace | 2 20 files changed, 337 insertions(+), 20 deletions(-) New commits: diff-tree 78f8f60164ab0703da6ad2ade859b41ef1602d98 (from 61b98c071a73378f4095ca33648ab0959e80ef6d) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 16:46:31 2007 +0100 update NEWS diff --git a/NEWS b/NEWS index e3cecde..d31b5d2 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,17 @@ + 0.4.3 ("Your tube") + +This release can play Youtube video. While this alone is enough for a +release, this was needed to make it possible: +- add lots of new features to the script interpreter, in particular + support for inheritance and the Object.registerClass function. +- rework the streaming and implement the NetStream, NetConnection and + XML script objects partially +- support passing variables to movies +- improvements to the JPEG decoder +- improvements to the debugging framework and the debugger +- support some more Flash 8 tags (in particular DefineFont3) + 0.4.2 ("Two completely different numbers") The main change for this release is changing script execution from diff-tree 61b98c071a73378f4095ca33648ab0959e80ef6d (from 2e1567e05b0be7c6fbdb8a11ddd39d0532e955f0) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 16:12:49 2007 +0100 remove the audio stream on EOS diff --git a/libswfdec/swfdec_net_stream.c b/libswfdec/swfdec_net_stream.c index 2b249f4..99363f9 100644 --- a/libswfdec/swfdec_net_stream.c +++ b/libswfdec/swfdec_net_stream.c @@ -157,6 +157,14 @@ swfdec_net_stream_timeout (SwfdecTimeout stream->timeout.timestamp += SWFDEC_MSECS_TO_TICKS (stream->next_time - stream->current_time); stream->timeout.callback = swfdec_net_stream_timeout; swfdec_player_add_timeout (stream->player, &stream->timeout); + } else { + if (stream->audio) { + /* FIXME: just unref and let it take care of removing itself? */ + SWFDEC_LOG ("stopping audio due to EOS"); + swfdec_audio_remove (stream->audio); + g_object_unref (stream->audio); + stream->audio = NULL; + } } } diff-tree 2e1567e05b0be7c6fbdb8a11ddd39d0532e955f0 (from 1c8355cf179bd07ae8b9929d2ff8cd9018e7e8cf) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 16:11:08 2007 +0100 implement NetStream.seek diff --git a/libswfdec/swfdec_js_net_stream.c b/libswfdec/swfdec_js_net_stream.c index a977ea8..873f673 100644 --- a/libswfdec/swfdec_js_net_stream.c +++ b/libswfdec/swfdec_js_net_stream.c @@ -80,9 +80,25 @@ swfdec_js_net_stream_set_buffer_time (JS return JS_TRUE; } +static JSBool +swfdec_js_net_stream_seek (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) +{ + SwfdecNetStream *stream; + double d; + + stream = swfdec_scriptable_from_object (cx, obj, SWFDEC_TYPE_NET_STREAM); + if (stream == NULL) + return JS_TRUE; + if (!JS_ValueToNumber (cx, argv[0], &d)) + return JS_FALSE; + swfdec_net_stream_seek (stream, d); + return JS_TRUE; +} + static JSFunctionSpec net_stream_methods[] = { { "pause", swfdec_js_net_stream_pause, 0, 0, 0 }, { "play", swfdec_js_net_stream_play, 1, 0, 0 }, + { "seek", swfdec_js_net_stream_seek, 1, 0, 0 }, { "setBufferTime", swfdec_js_net_stream_set_buffer_time, 1, 0, 0 }, { NULL } }; diff --git a/libswfdec/swfdec_net_stream.c b/libswfdec/swfdec_net_stream.c index 2bc6b23..2b249f4 100644 --- a/libswfdec/swfdec_net_stream.c +++ b/libswfdec/swfdec_net_stream.c @@ -21,6 +21,7 @@ #include "config.h" #endif +#include <math.h> #include "swfdec_net_stream.h" #include "swfdec_amf.h" #include "swfdec_audio_flv.h" @@ -174,6 +175,7 @@ swfdec_net_stream_update_playing (Swfdec stream->timeout.timestamp = stream->player->time + SWFDEC_MSECS_TO_TICKS (stream->next_time - stream->current_time); swfdec_player_add_timeout (stream->player, &stream->timeout); if (stream->flvdecoder->audio) { + g_assert (stream->audio == NULL); SWFDEC_LOG ("starting audio"); stream->audio = swfdec_audio_flv_new (stream->player, stream->flvdecoder, stream->current_time); @@ -447,3 +449,40 @@ swfdec_net_stream_get_buffer_time (Swfde return (double) stream->buffer_time / 1000.0; } +void +swfdec_net_stream_seek (SwfdecNetStream *stream, double secs) +{ + guint first, last, msecs; + + g_return_if_fail (SWFDEC_IS_NET_STREAM (stream)); + + if (stream->flvdecoder == NULL) + return; + if (!finite (secs) || secs < 0) { + SWFDEC_ERROR ("seeking to %g doesn't work", secs); + return; + } + if (!swfdec_flv_decoder_get_video_info (stream->flvdecoder, &first, &last)) { + SWFDEC_ERROR ("FIXME: implement seeking in audio only NetStream"); + return; + } + msecs = secs * 1000; + msecs += first; + if (msecs > last) + msecs = last; + swfdec_flv_decoder_get_video (stream->flvdecoder, msecs, TRUE, NULL, &msecs, NULL); + swfdec_net_stream_video_goto (stream, msecs); + /* FIXME: this needs to be implemented correctly, but requires changes to audio handling: + * - creating a new audio stream will cause attachAudio scripts to lose information + * - implementing seek on audio stream requires a SwfdecAudio::changed signal so audio + * backends can react correctly. + */ + if (stream->audio) { + SWFDEC_WARNING ("FIXME: restarting audio after seek"); + swfdec_audio_remove (stream->audio); + g_object_unref (stream->audio); + stream->audio = swfdec_audio_flv_new (stream->player, + stream->flvdecoder, stream->current_time); + } +} + diff --git a/libswfdec/swfdec_net_stream.h b/libswfdec/swfdec_net_stream.h index c36c45a..7973b5f 100644 --- a/libswfdec/swfdec_net_stream.h +++ b/libswfdec/swfdec_net_stream.h @@ -89,6 +89,8 @@ gboolean swfdec_net_stream_get_playing void swfdec_net_stream_set_buffer_time (SwfdecNetStream * stream, double secs); double swfdec_net_stream_get_buffer_time (SwfdecNetStream * stream); +void swfdec_net_stream_seek (SwfdecNetStream * stream, + double secs); G_END_DECLS diff-tree 1c8355cf179bd07ae8b9929d2ff8cd9018e7e8cf (from 5170c8201388e47cb1f7712f77aba4bac4f4f1ec) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 16:09:55 2007 +0100 implement seeking to keyframes diff --git a/libswfdec/swfdec_flv_decoder.c b/libswfdec/swfdec_flv_decoder.c index 7615225..807447e 100644 --- a/libswfdec/swfdec_flv_decoder.c +++ b/libswfdec/swfdec_flv_decoder.c @@ -479,13 +479,19 @@ swfdec_flv_decoder_get_video (SwfdecFlvD offset = g_array_index (flv->video, SwfdecFlvVideoTag, 0).timestamp; timestamp += offset; id = swfdec_flv_decoder_find_video (flv, timestamp); + tag = &g_array_index (flv->video, SwfdecFlvVideoTag, id); + if (keyframe) { + while (id > 0 && tag->frame_type != 1) { + id--; + tag--; + } + } if (next_timestamp) { if (id + 1 >= flv->video->len) *next_timestamp = 0; else *next_timestamp = g_array_index (flv->video, SwfdecFlvVideoTag, id + 1).timestamp - offset; } - tag = &g_array_index (flv->video, SwfdecFlvVideoTag, id); if (real_timestamp) *real_timestamp = tag->timestamp - offset; if (format) diff-tree 5170c8201388e47cb1f7712f77aba4bac4f4f1ec (from 6283f02130ba03c957c7680a24d61aba28f592d3) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 16:08:29 2007 +0100 non-invertible matrix is only INFO It's normal when someone set width or height to 0 diff --git a/libswfdec/swfdec_color.c b/libswfdec/swfdec_color.c index c4fa52e..a3e3077 100644 --- a/libswfdec/swfdec_color.c +++ b/libswfdec/swfdec_color.c @@ -198,7 +198,7 @@ swfdec_matrix_ensure_invertible (cairo_m *inverse = *matrix; while (cairo_matrix_invert (inverse)) { - SWFDEC_WARNING ("matrix not invertible, adding epsilon to smallest member"); + SWFDEC_INFO ("matrix not invertible, adding epsilon to smallest member"); /* add epsilon at point closest to zero */ #define EPSILON (1.0 / SWFDEC_FIXED_SCALE_FACTOR) if (ABS (matrix->xx) <= ABS (matrix->xy) && diff-tree 6283f02130ba03c957c7680a24d61aba28f592d3 (from 5f43dccbfd326b8df79249e5c6677a53d961d97e) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 13:45:20 2007 +0100 if an image failed to decode, don't render it diff --git a/libswfdec/swfdec_pattern.c b/libswfdec/swfdec_pattern.c index 863271e..f2d665a 100644 --- a/libswfdec/swfdec_pattern.c +++ b/libswfdec/swfdec_pattern.c @@ -267,6 +267,8 @@ swfdec_image_pattern_paint (SwfdecPatter cairo_surface_t *surface; surface = swfdec_image_create_surface_transformed (image->image, trans); + if (surface == NULL) + return; cairo_append_path (cr, (cairo_path_t *) path); pattern = cairo_pattern_create_for_surface (surface); cairo_surface_destroy (surface); diff-tree 5f43dccbfd326b8df79249e5c6677a53d961d97e (from 21dc65d52d4f3fcb5801e0a4e6d6702aab67ecd8) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 13:45:00 2007 +0100 clarify the g_warning: It's a cairo error diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c index 17e2217..3317fb2 100644 --- a/libswfdec/swfdec_movie.c +++ b/libswfdec/swfdec_movie.c @@ -644,7 +644,7 @@ swfdec_movie_render (SwfdecMovie *movie, } #endif if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { - g_warning ("%s", cairo_status_to_string (cairo_status (cr))); + g_warning ("error rendering with cairo: %s", cairo_status_to_string (cairo_status (cr))); } cairo_restore (cr); } diff-tree 21dc65d52d4f3fcb5801e0a4e6d6702aab67ecd8 (from 531ca50cda5bbe981109c0900b6a807080438df9) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 13:27:17 2007 +0100 Fix division code diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c index d96ec0f..a9f16e0 100644 --- a/libswfdec/swfdec_script.c +++ b/libswfdec/swfdec_script.c @@ -283,6 +283,10 @@ swfdec_value_to_number_7 (JSContext *cx, if (JSVAL_IS_OBJECT (val)) { *d = *cx->runtime->jsNaN; return JS_TRUE; + } else if (JSVAL_IS_STRING (val) && + JS_GetStringLength (JSVAL_TO_STRING (val)) == 0) { + *d = *cx->runtime->jsNaN; + return JS_TRUE; } else { return JS_ValueToNumber (cx, val, d); } @@ -973,20 +977,17 @@ swfdec_action_binary (JSContext *cx, gui l = l * r; break; case 0x0d: - if (isnan (r)) - r = 0; - if (r == 0 && ((SwfdecScript *) cx->fp->swf)->version < 5) { - JSString *str = JS_InternString (cx, "#ERROR#"); - if (str == NULL) - return JS_FALSE; - cx->fp->sp[-1] = STRING_TO_JSVAL (str); - return JS_TRUE; - } else if (((SwfdecScript *) cx->fp->swf)->version >= 7 && - r == 0) { - cx->fp->sp[-1] = DOUBLE_TO_JSVAL (r < 0 ? - cx->runtime->jsNegativeInfinity : - cx->runtime->jsPositiveInfinity); - return JS_TRUE; + if (((SwfdecScript *) cx->fp->swf)->version < 5) { + if (r == 0) { + JSString *str = JS_InternString (cx, "#ERROR#"); + if (str == NULL) + return JS_FALSE; + cx->fp->sp[-1] = STRING_TO_JSVAL (str); + return JS_TRUE; + } + } else if (((SwfdecScript *) cx->fp->swf)->version < 7) { + if (isnan (r)) + r = 0; } l = l / r; break; diff-tree 531ca50cda5bbe981109c0900b6a807080438df9 (from 88a6be304daace619eccd9fe6dc5a002f94afd90) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 13:26:50 2007 +0100 add a new test for division I have versions for flash 5 and 6 locally, but those don't pass yet. diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am index b5d0d58..9f66866 100644 --- a/test/trace/Makefile.am +++ b/test/trace/Makefile.am @@ -58,6 +58,9 @@ EXTRA_DIST = \ countdown.swf.trace \ currentframe.swf \ currentframe.swf.trace \ + divide.as \ + divide-7.swf \ + divide-7.swf.trace \ doaction-after-placeobject.swf.trace \ doaction-after-placeobject.swf \ doaction-before-placeobject.c \ diff --git a/test/trace/divide-7.swf b/test/trace/divide-7.swf new file mode 100644 index 0000000..1750c74 Binary files /dev/null and b/test/trace/divide-7.swf differ diff --git a/test/trace/divide-7.swf.trace b/test/trace/divide-7.swf.trace new file mode 100644 index 0000000..90fc8c4 --- /dev/null +++ b/test/trace/divide-7.swf.trace @@ -0,0 +1,169 @@ +0 (number) / 0 (number) = NaN +0 (number) / undefined (undefined) = NaN +0 (number) / null (null) = NaN +0 (number) / 1 (number) = 0 +0 (number) / -1 (number) = 0 +0 (number) / 0 (number) = NaN +0 (number) / [object Object] (object) = NaN +0 (number) / _level0 (movieclip) = NaN +0 (number) / [type Function] (function) = NaN +0 (number) / 1 (string) = 0 +0 (number) / 0 (string) = NaN +0 (number) / (string) = NaN +0 (number) / foo (string) = NaN +undefined (undefined) / 0 (number) = NaN +undefined (undefined) / undefined (undefined) = NaN +undefined (undefined) / null (null) = NaN +undefined (undefined) / 1 (number) = NaN +undefined (undefined) / -1 (number) = NaN +undefined (undefined) / 0 (number) = NaN +undefined (undefined) / [object Object] (object) = NaN +undefined (undefined) / _level0 (movieclip) = NaN +undefined (undefined) / [type Function] (function) = NaN +undefined (undefined) / 1 (string) = NaN +undefined (undefined) / 0 (string) = NaN +undefined (undefined) / (string) = NaN +undefined (undefined) / foo (string) = NaN +null (null) / 0 (number) = NaN +null (null) / undefined (undefined) = NaN +null (null) / null (null) = NaN +null (null) / 1 (number) = NaN +null (null) / -1 (number) = NaN +null (null) / 0 (number) = NaN +null (null) / [object Object] (object) = NaN +null (null) / _level0 (movieclip) = NaN +null (null) / [type Function] (function) = NaN +null (null) / 1 (string) = NaN +null (null) / 0 (string) = NaN +null (null) / (string) = NaN +null (null) / foo (string) = NaN +1 (number) / 0 (number) = Infinity +1 (number) / undefined (undefined) = NaN +1 (number) / null (null) = NaN +1 (number) / 1 (number) = 1 +1 (number) / -1 (number) = -1 +1 (number) / 0 (number) = Infinity +1 (number) / [object Object] (object) = NaN +1 (number) / _level0 (movieclip) = NaN +1 (number) / [type Function] (function) = NaN +1 (number) / 1 (string) = 1 +1 (number) / 0 (string) = Infinity +1 (number) / (string) = NaN +1 (number) / foo (string) = NaN +-1 (number) / 0 (number) = -Infinity +-1 (number) / undefined (undefined) = NaN +-1 (number) / null (null) = NaN +-1 (number) / 1 (number) = -1 +-1 (number) / -1 (number) = 1 +-1 (number) / 0 (number) = -Infinity +-1 (number) / [object Object] (object) = NaN +-1 (number) / _level0 (movieclip) = NaN +-1 (number) / [type Function] (function) = NaN +-1 (number) / 1 (string) = -1 +-1 (number) / 0 (string) = -Infinity +-1 (number) / (string) = NaN +-1 (number) / foo (string) = NaN +0 (number) / 0 (number) = NaN +0 (number) / undefined (undefined) = NaN +0 (number) / null (null) = NaN +0 (number) / 1 (number) = 0 +0 (number) / -1 (number) = 0 +0 (number) / 0 (number) = NaN +0 (number) / [object Object] (object) = NaN +0 (number) / _level0 (movieclip) = NaN +0 (number) / [type Function] (function) = NaN +0 (number) / 1 (string) = 0 +0 (number) / 0 (string) = NaN +0 (number) / (string) = NaN +0 (number) / foo (string) = NaN +[object Object] (object) / 0 (number) = NaN +[object Object] (object) / undefined (undefined) = NaN +[object Object] (object) / null (null) = NaN +[object Object] (object) / 1 (number) = NaN +[object Object] (object) / -1 (number) = NaN +[object Object] (object) / 0 (number) = NaN +[object Object] (object) / [object Object] (object) = NaN +[object Object] (object) / _level0 (movieclip) = NaN +[object Object] (object) / [type Function] (function) = NaN +[object Object] (object) / 1 (string) = NaN +[object Object] (object) / 0 (string) = NaN +[object Object] (object) / (string) = NaN +[object Object] (object) / foo (string) = NaN +_level0 (movieclip) / 0 (number) = NaN +_level0 (movieclip) / undefined (undefined) = NaN +_level0 (movieclip) / null (null) = NaN +_level0 (movieclip) / 1 (number) = NaN +_level0 (movieclip) / -1 (number) = NaN +_level0 (movieclip) / 0 (number) = NaN +_level0 (movieclip) / [object Object] (object) = NaN +_level0 (movieclip) / _level0 (movieclip) = NaN +_level0 (movieclip) / [type Function] (function) = NaN +_level0 (movieclip) / 1 (string) = NaN +_level0 (movieclip) / 0 (string) = NaN +_level0 (movieclip) / (string) = NaN +_level0 (movieclip) / foo (string) = NaN +[type Function] (function) / 0 (number) = NaN +[type Function] (function) / undefined (undefined) = NaN +[type Function] (function) / null (null) = NaN +[type Function] (function) / 1 (number) = NaN +[type Function] (function) / -1 (number) = NaN +[type Function] (function) / 0 (number) = NaN +[type Function] (function) / [object Object] (object) = NaN +[type Function] (function) / _level0 (movieclip) = NaN +[type Function] (function) / [type Function] (function) = NaN +[type Function] (function) / 1 (string) = NaN +[type Function] (function) / 0 (string) = NaN +[type Function] (function) / (string) = NaN +[type Function] (function) / foo (string) = NaN +1 (string) / 0 (number) = Infinity +1 (string) / undefined (undefined) = NaN +1 (string) / null (null) = NaN +1 (string) / 1 (number) = 1 +1 (string) / -1 (number) = -1 +1 (string) / 0 (number) = Infinity +1 (string) / [object Object] (object) = NaN +1 (string) / _level0 (movieclip) = NaN +1 (string) / [type Function] (function) = NaN +1 (string) / 1 (string) = 1 +1 (string) / 0 (string) = Infinity +1 (string) / (string) = NaN +1 (string) / foo (string) = NaN +0 (string) / 0 (number) = NaN +0 (string) / undefined (undefined) = NaN +0 (string) / null (null) = NaN +0 (string) / 1 (number) = 0 +0 (string) / -1 (number) = 0 +0 (string) / 0 (number) = NaN +0 (string) / [object Object] (object) = NaN +0 (string) / _level0 (movieclip) = NaN +0 (string) / [type Function] (function) = NaN +0 (string) / 1 (string) = 0 +0 (string) / 0 (string) = NaN +0 (string) / (string) = NaN +0 (string) / foo (string) = NaN + (string) / 0 (number) = NaN + (string) / undefined (undefined) = NaN + (string) / null (null) = NaN + (string) / 1 (number) = NaN + (string) / -1 (number) = NaN + (string) / 0 (number) = NaN + (string) / [object Object] (object) = NaN + (string) / _level0 (movieclip) = NaN + (string) / [type Function] (function) = NaN + (string) / 1 (string) = NaN + (string) / 0 (string) = NaN + (string) / (string) = NaN + (string) / foo (string) = NaN +foo (string) / 0 (number) = NaN +foo (string) / undefined (undefined) = NaN +foo (string) / null (null) = NaN +foo (string) / 1 (number) = NaN +foo (string) / -1 (number) = NaN +foo (string) / 0 (number) = NaN +foo (string) / [object Object] (object) = NaN +foo (string) / _level0 (movieclip) = NaN +foo (string) / [type Function] (function) = NaN +foo (string) / 1 (string) = NaN +foo (string) / 0 (string) = NaN +foo (string) / (string) = NaN +foo (string) / foo (string) = NaN diff --git a/test/trace/divide.as b/test/trace/divide.as new file mode 100644 index 0000000..b42cbc6 --- /dev/null +++ b/test/trace/divide.as @@ -0,0 +1,9 @@ +// makeswf -v 7 -s 200x150 -r 1 -o movie2.swf movie2.as + +array = [ 0, undefined, null, 1, -1, -0, new Object (), this, getDepth, "1", "0", "", "foo" ]; + +for (i = 0; i < array.length; i++) { + for (j = 0; j < array.length; j++) { + trace (array[i] + " (" + typeof (array[i]) + ") / " + array[j] + " (" + typeof (array[j]) + ") = " + (array[i] / array[j])); + }; +}; diff-tree 88a6be304daace619eccd9fe6dc5a002f94afd90 (from 225136e318d59ab6721e7ec006c8fa23d3f296b8) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 13:20:39 2007 +0100 update expected results for 2 tests See http://swfdec.freedesktop.org/wiki/FlashConsistency for details. diff --git a/test/trace/object-math-7.swf.trace b/test/trace/object-math-7.swf.trace index 751247d..9f5483e 100755 --- a/test/trace/object-math-7.swf.trace +++ b/test/trace/object-math-7.swf.trace @@ -11,7 +11,7 @@ NaN NaN NaN NaN -Infinity NaN NaN -Infinity +NaN +NaN diff --git a/test/trace/undefined2-7.swf.trace b/test/trace/undefined2-7.swf.trace index 5ee1318..8cea3bf 100755 --- a/test/trace/undefined2-7.swf.trace +++ b/test/trace/undefined2-7.swf.trace @@ -10,4 +10,4 @@ NaN NaN NaN NaN -Infinity +NaN diff-tree 225136e318d59ab6721e7ec006c8fa23d3f296b8 (from 13171a49b02675d44bc54c91ec872e173cfcefd6) Author: Benjamin Otte <otte@gnome.org> Date: Thu Mar 22 12:29:07 2007 +0100 add tests to make sure DoAction and PlaceObject triggered actions happen in the order those tags appear. diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am index 3a7fd4c..b5d0d58 100644 --- a/test/trace/Makefile.am +++ b/test/trace/Makefile.am @@ -58,6 +58,11 @@ EXTRA_DIST = \ countdown.swf.trace \ currentframe.swf \ currentframe.swf.trace \ + doaction-after-placeobject.swf.trace \ + doaction-after-placeobject.swf \ + doaction-before-placeobject.c \ + doaction-before-placeobject.swf \ + doaction-before-placeobject.swf.trace \ double.swf \ event-order.swf \ empty-stack.as \ diff --git a/test/trace/doaction-after-placeobject.swf b/test/trace/doaction-after-placeobject.swf new file mode 100644 index 0000000..c7a486c Binary files /dev/null and b/test/trace/doaction-after-placeobject.swf differ diff --git a/test/trace/doaction-after-placeobject.swf.trace b/test/trace/doaction-after-placeobject.swf.trace new file mode 100644 index 0000000..9bb7d8b --- /dev/null +++ b/test/trace/doaction-after-placeobject.swf.trace @@ -0,0 +1,3 @@ +clipEvent (load) +_level0.m +Frame 0 diff --git a/test/trace/doaction-before-placeobject.c b/test/trace/doaction-before-placeobject.c new file mode 100644 index 0000000..be09e2e --- /dev/null +++ b/test/trace/doaction-before-placeobject.c @@ -0,0 +1,38 @@ +/* gcc `pkg-config --libs --cflags libming` doaction-before-placeobject.c -o doaction-before-placeobject && ./doaction-before-placeobject + */ + +#include <ming.h> + +/* The file doaction-after-placeobject.swf was created from + * doaction-before-placeobject.swf by manually swapping the DoAction and + * PlaceObject2 tags in the file with a hex editor + */ +int +main (int argc, char **argv) +{ + SWFMovie movie; + SWFMovieClip clip; + SWFDisplayItem item; + + if (Ming_init ()) + return 1; + Ming_useSWFVersion (7); + + movie = newSWFMovie(); + SWFMovie_setRate (movie, 1); + SWFMovie_setDimension (movie, 200, 150); + + clip = newSWFMovieClip (); + item = SWFMovie_add (movie, (SWFBlock) clip); + SWFDisplayItem_setName (item, "m"); + SWFDisplayItem_addAction (item, compileSWFActionCode ("" + " trace (\"clipEvent (load)\");" + " trace (this);" + ""), SWFACTION_ONLOAD); + SWFMovie_add (movie, (SWFBlock) compileSWFActionCode ("" + "trace (\"Frame 0\");" + "")); + + SWFMovie_save (movie, "doaction-before-placeobject.swf"); + return 0; +} diff --git a/test/trace/doaction-before-placeobject.swf b/test/trace/doaction-before-placeobject.swf new file mode 100644 index 0000000..fbdcbf5 Binary files /dev/null and b/test/trace/doaction-before-placeobject.swf differ diff --git a/test/trace/doaction-before-placeobject.swf.trace b/test/trace/doaction-before-placeobject.swf.trace new file mode 100644 index 0000000..39396d0 --- /dev/null +++ b/test/trace/doaction-before-placeobject.swf.trace @@ -0,0 +1,3 @@ +Frame 0 +clipEvent (load) +_level0.m
Seemingly Similar Threads
- Changes to 'refs/tags/0.4.3'
- Changes to 'refs/tags/0.4.4'
- Branch 'as' - 5 commits - libswfdec/Makefile.am libswfdec/swfdec_as_strings.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_movie.c libswfdec/swfdec_net_connection.c libswfdec/swfdec_net_stream_as.c libswfdec/swfdec_net_stream.c
- 11 commits - libswfdec/Makefile.am libswfdec/swfdec_connection.c libswfdec/swfdec_connection.h libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js.c libswfdec/swfdec_js_connection.c libswfdec/swfdec_js.h libswfdec/swfdec_js_net_stream.c
- 10 commits - libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_flv_decoder.h libswfdec/swfdec_js_global.c libswfdec/swfdec_js_movie.c libswfdec/swfdec_js_net_stream.c libswfdec/swfdec_loader.c libswfdec/swfdec_loader.h libswfdec/swfdec_loadertarget.c