[Swfdec] 4 commits - libswfdec/swfdec_as_context.c libswfdec/swfdec_movie.c libswfdec/swfdec_player.c libswfdec/swfdec_resource.c libswfdec/swfdec_resource_request.c libswfdec/swfdec_resource_request.h libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_sprite_movie.h

Benjamin Otte company at kemper.freedesktop.org
Thu Nov 1 06:51:31 PDT 2007


 libswfdec/swfdec_as_context.c       |    6 ++++--
 libswfdec/swfdec_movie.c            |    2 +-
 libswfdec/swfdec_player.c           |    3 ++-
 libswfdec/swfdec_resource.c         |    1 -
 libswfdec/swfdec_resource_request.c |    9 +++------
 libswfdec/swfdec_resource_request.h |    1 +
 libswfdec/swfdec_sprite_movie.c     |   12 ++++++++++--
 libswfdec/swfdec_sprite_movie.h     |    2 +-
 8 files changed, 22 insertions(+), 14 deletions(-)

New commits:
commit f7646d6a12993c2f8dc276f0ddfcde0a35fa7b89
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 1 14:43:15 2007 +0100

    only abort once

diff --git a/libswfdec/swfdec_as_context.c b/libswfdec/swfdec_as_context.c
index ca1af3d..3182c08 100644
--- a/libswfdec/swfdec_as_context.c
+++ b/libswfdec/swfdec_as_context.c
@@ -169,8 +169,10 @@ swfdec_as_context_abort (SwfdecAsContext *context, const char *reason)
   g_return_if_fail (context);
 
   SWFDEC_ERROR ("%s", reason);
-  context->state = SWFDEC_AS_CONTEXT_ABORTED;
-  g_object_notify (G_OBJECT (context), "aborted");
+  if (context->state != SWFDEC_AS_CONTEXT_ABORTED) {
+    context->state = SWFDEC_AS_CONTEXT_ABORTED;
+    g_object_notify (G_OBJECT (context), "aborted");
+  }
 }
 
 /*** MEMORY MANAGEMENT ***/
commit 4b2983dee8426e0c1c7609737979e283dc92fdcd
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 1 12:48:40 2007 +0100

    remove a comment left for debugging

diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index 6e78ae8..d03e6d2 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1887,7 +1887,7 @@ swfdec_player_initialize (SwfdecPlayer *player, guint version,
   player->internal_height = player->stage_height >= 0 ? (guint) player->stage_height : player->height;
   player->initialized = TRUE;
   if (rate) {
-    player->iterate_timeout.timestamp = player->time;//+ SWFDEC_TICKS_PER_SECOND * 256 / player->rate;
+    player->iterate_timeout.timestamp = player->time;
     swfdec_player_add_timeout (player, &player->iterate_timeout);
     SWFDEC_LOG ("initialized iterate timeout %p to %"G_GUINT64_FORMAT" (now %"G_GUINT64_FORMAT")",
 	&player->iterate_timeout, player->iterate_timeout.timestamp, player->time);
commit 34441beed5fd4fabd7aa8c8d9d4e9fa7908e05a9
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 1 12:48:02 2007 +0100

    revert a previous patch that changed MovieClip initialization
    
    It seems the first frame of movie clips gets initialized during iteration, and
    not during load as previously assumed.

diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index c75ae73..6e78ae8 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1342,6 +1342,7 @@ swfdec_player_unlock (SwfdecPlayer *player)
   context = SWFDEC_AS_CONTEXT (player);
   g_return_if_fail (context->state != SWFDEC_AS_CONTEXT_INTERRUPTED);
 
+  swfdec_player_resource_request_perform (player);
   if (context->state == SWFDEC_AS_CONTEXT_RUNNING)
     swfdec_as_context_maybe_gc (SWFDEC_AS_CONTEXT (player));
   swfdec_player_unlock_soft (player);
@@ -1886,7 +1887,7 @@ swfdec_player_initialize (SwfdecPlayer *player, guint version,
   player->internal_height = player->stage_height >= 0 ? (guint) player->stage_height : player->height;
   player->initialized = TRUE;
   if (rate) {
-    player->iterate_timeout.timestamp = player->time + SWFDEC_TICKS_PER_SECOND * 256 / player->rate;
+    player->iterate_timeout.timestamp = player->time;//+ SWFDEC_TICKS_PER_SECOND * 256 / player->rate;
     swfdec_player_add_timeout (player, &player->iterate_timeout);
     SWFDEC_LOG ("initialized iterate timeout %p to %"G_GUINT64_FORMAT" (now %"G_GUINT64_FORMAT")",
 	&player->iterate_timeout, player->iterate_timeout.timestamp, player->time);
diff --git a/libswfdec/swfdec_resource.c b/libswfdec/swfdec_resource.c
index d231111..8560608 100644
--- a/libswfdec/swfdec_resource.c
+++ b/libswfdec/swfdec_resource.c
@@ -90,7 +90,6 @@ swfdec_resource_loader_target_image (SwfdecResource *instance)
   } else {
     g_assert_not_reached ();
   }
-  swfdec_movie_initialize (SWFDEC_MOVIE (movie));
 }
 
 static void
diff --git a/libswfdec/swfdec_resource_request.c b/libswfdec/swfdec_resource_request.c
index 32a5ed6..398335a 100644
--- a/libswfdec/swfdec_resource_request.c
+++ b/libswfdec/swfdec_resource_request.c
@@ -69,10 +69,10 @@ swfdec_request_resource_perform_one (gpointer requestp, gpointer playerp)
   swfdec_resource_request_free (request);
 }
 
-static void
-swfdec_request_resource_perform (gpointer playerp, gpointer unused)
+void
+swfdec_player_resource_request_perform (SwfdecPlayer *player)
 {
-  SwfdecPlayer *player = SWFDEC_PLAYER (playerp);
+  g_return_if_fail (SWFDEC_IS_PLAYER (player));
 
   g_slist_foreach (player->resource_requests, swfdec_request_resource_perform_one, player);
   g_slist_free (player->resource_requests);
@@ -101,9 +101,6 @@ swfdec_player_request_resource (SwfdecPlayer *player, SwfdecSecurity *security,
   request->destroy = destroy;
   request->data = data;
 
-  if (player->resource_requests == NULL) {
-    swfdec_player_add_external_action (player, player, swfdec_request_resource_perform, NULL);
-  }
   player->resource_requests = g_slist_append (player->resource_requests, request);
 }
 
diff --git a/libswfdec/swfdec_resource_request.h b/libswfdec/swfdec_resource_request.h
index b970a0a..0c6977b 100644
--- a/libswfdec/swfdec_resource_request.h
+++ b/libswfdec/swfdec_resource_request.h
@@ -54,6 +54,7 @@ void		swfdec_player_request_resource		(SwfdecPlayer *		player,
 
 /* private api for swfdec_player.c */
 void		swfdec_player_resource_request_init	(SwfdecPlayer *		player);
+void		swfdec_player_resource_request_perform	(SwfdecPlayer *		player);
 void		swfdec_player_resource_request_finish	(SwfdecPlayer *		player);
 
 G_END_DECLS
diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index a78a306..dcd01c6 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -559,9 +559,13 @@ swfdec_sprite_movie_dispose (GObject *object)
 }
 
 static void
-swfdec_sprite_movie_init_movie (SwfdecMovie *movie)
+swfdec_sprite_movie_init_movie (SwfdecMovie *mov)
 {
-  swfdec_sprite_movie_goto (SWFDEC_SPRITE_MOVIE (movie), 1);
+  SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (mov);
+
+  g_assert (movie->frame == (guint) -1);
+  movie->frame = 0;
+  swfdec_sprite_movie_goto (movie, 1);
 }
 
 static void
@@ -585,6 +589,9 @@ swfdec_sprite_movie_iterate (SwfdecMovie *mov)
   if (mov->will_be_removed)
     return;
 
+  if (movie->sprite && movie->frame == (guint) -1)
+    movie->frame = 0;
+
   swfdec_player_add_action (player, mov, SWFDEC_EVENT_ENTER, 2);
   if (movie->playing && movie->sprite != NULL) {
     if (movie->frame == movie->n_frames)
@@ -711,6 +718,7 @@ static void
 swfdec_sprite_movie_init (SwfdecSpriteMovie * movie)
 {
   movie->playing = TRUE;
+  movie->frame = (guint) -1;
 }
 
 /* cute little hack */
diff --git a/libswfdec/swfdec_sprite_movie.h b/libswfdec/swfdec_sprite_movie.h
index 3062bd1..70c9f74 100644
--- a/libswfdec/swfdec_sprite_movie.h
+++ b/libswfdec/swfdec_sprite_movie.h
@@ -45,7 +45,7 @@ struct _SwfdecSpriteMovie
   /* frame information */
   guint			next_action;	/* next action in sprite to perform */
   guint			max_action;	/* next action in sprite tthat has never ben executed (used to detect first-time execution) */
-  guint			frame;		/* current frame */
+  guint			frame;		/* current frame or -1 if none */
   guint			n_frames;	/* amount of frames */
   gboolean		playing;	/* TRUE if the movie automatically advances */
 
commit a0580c0ba8663fec456f22ae7ab01e6441870f44
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 1 12:45:10 2007 +0100

    initiliaze the copy, not the original (oops)

diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index a5ed52d..cc05c52 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -1398,7 +1398,7 @@ swfdec_movie_duplicate (SwfdecMovie *movie, const char *name, int depth)
     swfdec_movie_queue_script (copy, SWFDEC_EVENT_LOAD);
     swfdec_movie_execute (copy, SWFDEC_EVENT_CONSTRUCT);
   }
-  swfdec_movie_initialize (movie);
+  swfdec_movie_initialize (copy);
   return copy;
 }
 


More information about the Swfdec mailing list