Benjamin Otte
2007-Aug-02 17:19 UTC
[Swfdec] 10 commits - libswfdec/compiler.c libswfdec-gtk/swfdec_source.c libswfdec/Makefile.am libswfdec/swfdec_player.c NEWS test/trace
NEWS | 11 +++++ libswfdec-gtk/swfdec_source.c | 2 - libswfdec/Makefile.am | 3 + libswfdec/compiler.c | 58 ++--------------------------- libswfdec/swfdec_player.c | 35 +++++++++-------- test/trace/Makefile.am | 7 +++ test/trace/netstream-load-loop-6.swf |binary test/trace/netstream-load-loop-6.swf.trace | 54 +++++++++++++++++++++++++++ test/trace/netstream-load-loop-7.swf |binary test/trace/netstream-load-loop-7.swf.trace | 54 +++++++++++++++++++++++++++ test/trace/netstream-load-loop-8.swf |binary test/trace/netstream-load-loop-8.swf.trace | 54 +++++++++++++++++++++++++++ test/trace/netstream-load-loop.as | 20 ++++++++++ 13 files changed, 226 insertions(+), 72 deletions(-) New commits: diff-tree a8b2231bd54cdcc43345d69b1daef71286d20789 (from 11b12db4ea6042a986d0d60ce3fa32035c1b144d) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 19:19:50 2007 +0200 make compiler use new SWFAction_getByteCode() function This function has not hit any release yet, so for now, you'll need to use Ming CVS checkouts when you want to change the init actionscript diff --git a/libswfdec/compiler.c b/libswfdec/compiler.c index c702b8b..7299dd6 100644 --- a/libswfdec/compiler.c +++ b/libswfdec/compiler.c @@ -1,4 +1,4 @@ -//gcc -Wall -Werror `pkg-config --libs --cflags libming glib-2.0` compiler.c -o copiler +//gcc -Wall -Werror `pkg-config --libs --cflags libming glib-2.0` compiler.c -o compiler #include <glib.h> #include <ming.h> @@ -16,37 +16,6 @@ write_data (guint8 *data, gsize len) { gsize i; - /* debug */ - //g_file_set_contents ("foo", (char *) data, len, NULL); - - /* skip SWF crap */ - data += 25; - - /* sanity checks */ - /* 1) ensure file is long enough */ - if (len < 31) - return FALSE; - i = data[0] + (data[1] << 8); - data += 2; - /* 2) ensure we have a DoAction tag */ - if (((i >> 6) & 0x3ff) != 12) - return FALSE; - i = i & 0x3F; - if (i == 0x3F) { - i = data[0] + (data[1] << 8) + (data[2] << 16) + (data[3] << 24); - data += 4; - len -= 31; - } else { - len -= 27; - } - /* 3) check size of tag is correct */ - if (i >= len + 2) - return FALSE; - /* 4) check a ShowFrame comes next */ - if (data[i] != 0x40 || data[i + 1] != 0x00) - return FALSE; - /* trust the data */ - len = i; for (i = 0; i < len; i++) { switch (i % 16) { case 0: @@ -69,14 +38,6 @@ write_data (guint8 *data, gsize len) return TRUE; } -static void -output_array (guint8 b, void *data) -{ - GByteArray *array = data; - - g_byte_array_append (array, &b, 1); -} - static char * get_name (const char *filename) { @@ -95,12 +56,12 @@ get_name (const char *filename) int main (int argc, char **argv) { - SWFMovie movie; SWFAction action; - GByteArray *array; char *contents; GError *error = NULL; guint i; + size_t len; + byte *data; if (argc < 2) { g_print ("usage: %s FILE ...\n\n", argv[0]); @@ -118,23 +79,14 @@ main (int argc, char **argv) error = NULL; return 1; } - movie = newSWFMovie (); action = newSWFAction (contents); - SWFMovie_add (movie, (SWFBlock) action); - g_free (contents); - - array = g_byte_array_new (); - SWFMovie_output (movie, output_array, array); + data = SWFAction_getByteCode (action, &len); contents = get_name (argv[i]); g_print ("/* compiled from %s */\n", argv[i]); g_print ("const unsigned char %s[] = {\n", contents); g_free (contents); - if (!write_data (array->data, array->len)) { - g_printerr ("failed extracting compiled data for %s\n", argv[i]); - return 1; - } + write_data (data, len); g_print ("};\n\n"); - g_byte_array_free (array, TRUE); } return 0; } diff-tree 11b12db4ea6042a986d0d60ce3fa32035c1b144d (from adb5dfed72f93ef0a50993c8f17bb04f6048cedd) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 19:07:10 2007 +0200 fix make distcheck diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am index f1973eb..b8d2e07 100644 --- a/libswfdec/Makefile.am +++ b/libswfdec/Makefile.am @@ -230,7 +230,8 @@ CLEANFILES = \ $(BUILT_SOURCES) swfdec_asnative.h: $(libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES) - (echo "#include \"swfdec_as_types.h\"" \ + (cd $(srcdir) \ + && echo "#include \"swfdec_as_types.h\"" \ && echo "#define SWFDEC_AS_NATIVE(x, y, func) void func (SwfdecAsContext *cx, \\" \ && echo " SwfdecAsObject *object, guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret);" \ && grep -he "^SWFDEC_AS_NATIVE" $(libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES) \ diff-tree adb5dfed72f93ef0a50993c8f17bb04f6048cedd (from 441a5c28298c3f2539f26192c0766833f976c4ae) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 18:16:37 2007 +0200 update NEWS diff --git a/NEWS b/NEWS index fc07dc9..d1567bf 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,15 @@ + 0.5.1 ("Heeeeelium") + +Features! This release got some. And they even give you the long awaited +embedded Youtube support. At the cost of lost of API changes, but who cares? +- rewrite SwfdecLoader. Add SwfdecURL support structure in the process. +- implement AsBroadcaster actionscript object. +- implement Stage actionscript object. Movies can now do the scaling themselves. +- change the HTTP in swfdec-gtk from gnome-vfs to libsoup +- add an OSS backend for non-ALSA operating systems. +- various fixes to super and DefineFunction2 flags. + 0.5.0 ("Meet Plan Party!") Here's the long overdue update. Lots of backend stuff was rewritten. The only diff-tree 441a5c28298c3f2539f26192c0766833f976c4ae (from b4727b210bc1f135412c730c2e037944a133afe0) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 18:08:56 2007 +0200 always update the size, not just when we're in NO_SCALE diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index 7c73932..ff786ce 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -1824,7 +1824,8 @@ swfdec_player_update_size (gpointer play player->internal_width = width; player->internal_height = height; - swfdec_player_broadcast (player, SWFDEC_AS_STR_Stage, SWFDEC_AS_STR_onResize); + if (player->scale_mode == SWFDEC_SCALE_NONE) + swfdec_player_broadcast (player, SWFDEC_AS_STR_Stage, SWFDEC_AS_STR_onResize); } /** @@ -1856,7 +1857,7 @@ swfdec_player_set_size (SwfdecPlayer *pl changed = TRUE; } swfdec_player_update_scale (player); - if (changed && player->scale_mode == SWFDEC_SCALE_NONE) + if (changed) swfdec_player_add_external_action (player, player, swfdec_player_update_size, NULL); } diff-tree b4727b210bc1f135412c730c2e037944a133afe0 (from fa98dd370ffb6167d05c8ef6cf9cc4ecf25c3bd2) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 16:55:26 2007 +0200 use proper assertion check to make sure list is empty diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index f231a4a..7c73932 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -641,18 +641,19 @@ swfdec_player_dispose (GObject *object) /* we do this here so references to GC'd objects get freed */ G_OBJECT_CLASS (swfdec_player_parent_class)->dispose (object); + swfdec_player_remove_all_external_actions (player, player); #ifndef G_DISABLE_ASSERT { SwfdecPlayerAction *action; + while ((action = swfdec_ring_buffer_pop (player->external_actions)) != NULL) { + g_assert (action->object == NULL); /* skip removed actions */ + } while ((action = swfdec_ring_buffer_pop (player->actions)) != NULL) { g_assert (action->object == NULL); /* skip removed actions */ } } #endif - swfdec_player_remove_all_external_actions (player, player); - g_assert (swfdec_ring_buffer_pop (player->external_actions) == NULL); swfdec_ring_buffer_free (player->external_actions); - g_assert (swfdec_ring_buffer_pop (player->actions) == NULL); swfdec_ring_buffer_free (player->actions); g_assert (player->movies == NULL); g_assert (player->audio == NULL); diff-tree fa98dd370ffb6167d05c8ef6cf9cc4ecf25c3bd2 (from 1242855554cb2c8dba8274441a9eee05c277c59e) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 16:55:08 2007 +0200 add test to avoid loops diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am index 4136972..3481072 100644 --- a/test/trace/Makefile.am +++ b/test/trace/Makefile.am @@ -499,6 +499,13 @@ EXTRA_DIST = \ names.swf.trace \ netconnection.swf \ netconnection.swf.trace \ + netstream-load-loop.as \ + netstream-load-loop-6.swf \ + netstream-load-loop-6.swf.trace \ + netstream-load-loop-7.swf \ + netstream-load-loop-7.swf.trace \ + netstream-load-loop-8.swf \ + netstream-load-loop-8.swf.trace \ netstream-onstatus.c \ netstream-onstatus.swf \ netstream-onstatus.swf.trace \ diff --git a/test/trace/netstream-load-loop-6.swf b/test/trace/netstream-load-loop-6.swf new file mode 100644 index 0000000..41bee8d Binary files /dev/null and b/test/trace/netstream-load-loop-6.swf differ diff --git a/test/trace/netstream-load-loop-6.swf.trace b/test/trace/netstream-load-loop-6.swf.trace new file mode 100644 index 0000000..45634b3 --- /dev/null +++ b/test/trace/netstream-load-loop-6.swf.trace @@ -0,0 +1,54 @@ +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho diff --git a/test/trace/netstream-load-loop-7.swf b/test/trace/netstream-load-loop-7.swf new file mode 100644 index 0000000..d1ef89b Binary files /dev/null and b/test/trace/netstream-load-loop-7.swf differ diff --git a/test/trace/netstream-load-loop-7.swf.trace b/test/trace/netstream-load-loop-7.swf.trace new file mode 100644 index 0000000..45634b3 --- /dev/null +++ b/test/trace/netstream-load-loop-7.swf.trace @@ -0,0 +1,54 @@ +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho diff --git a/test/trace/netstream-load-loop-8.swf b/test/trace/netstream-load-loop-8.swf new file mode 100644 index 0000000..c3076c0 Binary files /dev/null and b/test/trace/netstream-load-loop-8.swf differ diff --git a/test/trace/netstream-load-loop-8.swf.trace b/test/trace/netstream-load-loop-8.swf.trace new file mode 100644 index 0000000..45634b3 --- /dev/null +++ b/test/trace/netstream-load-loop-8.swf.trace @@ -0,0 +1,54 @@ +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho +hey +hey +hey +hey +hey +hey +hey +hey +hey +hey +ho diff --git a/test/trace/netstream-load-loop.as b/test/trace/netstream-load-loop.as new file mode 100644 index 0000000..033c449 --- /dev/null +++ b/test/trace/netstream-load-loop.as @@ -0,0 +1,20 @@ +// makeswf -v 7 -s 200x150 -r 1 -o netstream-load-loop.swf netstream-load-loop.as + +nc = new NetConnection (); +nc.connect (null); +ns = new NetStream (nc); +ns.onStatus = function (o) { + ns.play ("doesnotexist.flv"); + trace ("hey"); +}; +onEnterFrame = function () { + trace ("ho"); + x++; + if (x >= 5) + loadMovie ("FSCommand:quit", ""); +}; +ns.play ("doesnotexist.flv"); +x = 0; + +//loadMovie ("FSCommand:quit", ""); + diff-tree 1242855554cb2c8dba8274441a9eee05c277c59e (from 6e20d6c28d20a9b127b31189a4bf661222dad29c) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 16:42:48 2007 +0200 allow removing of timeouts that should happen now diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index f5874ea..f231a4a 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -205,7 +205,7 @@ swfdec_player_remove_timeout (SwfdecPlay g_return_if_fail (SWFDEC_IS_PLAYER (player)); g_return_if_fail (timeout != NULL); - g_return_if_fail (timeout->timestamp > player->time); + g_return_if_fail (timeout->timestamp >= player->time); g_return_if_fail (timeout->callback != NULL); SWFDEC_LOG ("removing timeout %p", timeout); diff-tree 6e20d6c28d20a9b127b31189a4bf661222dad29c (from aa1a1a77ecc548d912c813af4d396506b7cb0f37) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 16:41:46 2007 +0200 fix external actions 1) run perform_actions after external actions 2) don't clear the timeout after calling the actions, clear it before diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index 26f6ca9..f5874ea 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -176,7 +176,8 @@ swfdec_player_add_timeout (SwfdecPlayer g_return_if_fail (timeout->timestamp > player->time); g_return_if_fail (timeout->callback != NULL); - SWFDEC_LOG ("adding timeout %p", timeout); + SWFDEC_LOG ("adding timeout %p in %"G_GUINT64_FORMAT" msecs", timeout, + SWFDEC_TICKS_TO_MSECS (timeout->timestamp - player->time)); next_tick = swfdec_player_get_next_event_time (player); /* the order is important, on events with the same time, we make sure the new one is last */ for (walk = player->timeouts; walk; walk = walk->next) { @@ -321,6 +322,12 @@ swfdec_player_perform_external_actions ( SwfdecPlayerAction *action; guint i; + /* remove timeout if it exists - do this before executing stuff below */ + if (player->external_timeout.callback) { + swfdec_player_remove_timeout (player, &player->external_timeout); + player->external_timeout.callback = NULL; + } + /* we need to query the number of current actions so newly added ones aren't * executed in here */ for (i = swfdec_ring_buffer_get_n_elements (player->external_actions); i > 0; i--) { @@ -332,10 +339,7 @@ swfdec_player_perform_external_actions ( action->func (action->object, action->data); } - if (player->external_timeout.callback) { - swfdec_player_remove_timeout (player, &player->external_timeout); - player->external_timeout.callback = NULL; - } + swfdec_player_perform_actions (player); } static void @@ -916,6 +920,7 @@ swfdec_player_iterate (SwfdecTimeout *ti SwfdecPlayer *player = SWFDEC_PLAYER ((guint8 *) timeout - G_STRUCT_OFFSET (SwfdecPlayer, iterate_timeout)); GList *walk; + swfdec_player_perform_external_actions (player); SWFDEC_INFO ("=== START ITERATION ==="); /* start the iteration. This performs a goto next frame on all * movies that are not stopped. It also queues onEnterFrame. @@ -953,8 +958,6 @@ swfdec_player_do_advance (SwfdecPlayer * guint frames_now; swfdec_player_lock (player); - swfdec_player_perform_external_actions (player); - swfdec_player_perform_actions (player); target_time = player->time + SWFDEC_MSECS_TO_TICKS (msecs); SWFDEC_DEBUG ("advancing %u msecs (%u audio frames)", msecs, audio_samples); @@ -1532,7 +1535,6 @@ swfdec_player_set_loader_with_variables g_object_ref (loader); swfdec_player_add_level_from_loader (player, 0, loader, variables); swfdec_player_perform_external_actions (player); - swfdec_player_perform_actions (player); swfdec_player_unlock (player); } diff-tree aa1a1a77ecc548d912c813af4d396506b7cb0f37 (from 1440c9f36abb495dfa96d60ea2c7b31857544cc9) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 16:38:41 2007 +0200 typo in comment diff --git a/libswfdec-gtk/swfdec_source.c b/libswfdec-gtk/swfdec_source.c index 5027e75..d570710 100644 --- a/libswfdec-gtk/swfdec_source.c +++ b/libswfdec-gtk/swfdec_source.c @@ -53,7 +53,7 @@ swfdec_iterate_get_msecs_to_next_event ( return G_MAXLONG; diff *= source->speed; g_source_get_current_time (source_, &now); - /* should really add to source->last instead of sutracting from now */ + /* should really add to source->last instead of subtracting from now */ g_time_val_add (&now, -diff * 1000); diff = my_time_val_difference (&source->last, &now); diff-tree 1440c9f36abb495dfa96d60ea2c7b31857544cc9 (from db20b4472b8409531a3d5f2b09faf5d072f58038) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 2 16:14:01 2007 +0200 fix swfdec_player_set_size() docs diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index ec8e159..26f6ca9 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -1832,9 +1832,6 @@ swfdec_player_update_size (gpointer play * * Sets the image size to the given values. The image size is what the area that * the @player will render and advocate with scripts. - * <note>Calling this function or setting the corresponding properties causes - * the emission of an event inside the script engine for listeners registered on - * the Stage object.</note> **/ void swfdec_player_set_size (SwfdecPlayer *player, int width, int height)
Maybe Matching Threads
- 9 commits - libswfdec-gtk/swfdec_source.c libswfdec/swfdec_marshal.list libswfdec/swfdec_player.c libswfdec/swfdec_player.h libswfdec/swfdec_player_internal.h libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_swf_instance.c test/dump.c test/Makefile.am
- 9 commits - doc/swfdec-sections.txt libswfdec/swfdec_as_frame.c libswfdec/swfdec_loader.c libswfdec/swfdec_loader.h libswfdec/swfdec_loader_internal.h libswfdec/swfdec_loadertarget.c libswfdec/swfdec_loadertarget.h libswfdec/swfdec_movie.c
- 11 commits - libswfdec/swfdec_as_interpret.c libswfdec/swfdec_loader.c libswfdec/swfdec_loader.h libswfdec/swfdec_net_stream.c libswfdec/swfdec_player.c libswfdec/swfdec_player_internal.h libswfdec/swfdec_resource.c libswfdec/swfdec_resource_request.c
- libswfdec-gtk/swfdec_gtk_player.c libswfdec/swfdec_as_date.c libswfdec/swfdec_audio.c libswfdec/swfdec_audio_event.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_interval.c libswfdec/swfdec_key_as.c libswfdec/swfdec_mouse_as.c libswfdec/swfdec_movie.c
- 5 commits - libswfdec/swfdec_net_stream.c libswfdec/swfdec_player.c libswfdec/swfdec_resource.c libswfdec/swfdec_resource.h player/swfdec_slow_loader.c test/trace