[Swfdec] 8 commits - libswfdec/swfdec_movie_as_drawing.c libswfdec/swfdec_player.c libswfdec/swfdec_resource.c libswfdec/swfdec_resource.h libswfdec/swfdec_sprite_movie.c

Benjamin Otte company at kemper.freedesktop.org
Fri Oct 19 05:54:12 PDT 2007


 libswfdec/swfdec_movie_as_drawing.c |    1 
 libswfdec/swfdec_player.c           |    2 +
 libswfdec/swfdec_resource.c         |   65 ++++++++++++++++++++++++++----------
 libswfdec/swfdec_resource.h         |    3 +
 libswfdec/swfdec_sprite_movie.c     |    2 +
 5 files changed, 55 insertions(+), 18 deletions(-)

New commits:
commit f5e934199517482e91225a4107a7b94c4a8b2d8d
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 14:44:38 2007 +0200

    add comment

diff --git a/libswfdec/swfdec_resource.h b/libswfdec/swfdec_resource.h
index f97ddaf..c5fd4e2 100644
--- a/libswfdec/swfdec_resource.h
+++ b/libswfdec/swfdec_resource.h
@@ -44,7 +44,7 @@ struct _SwfdecResource
   gboolean		initial;	/* TRUE if this is the initial resource */
 
   SwfdecLoader *	loader;		/* the loader providing data for the decoder */
-  SwfdecDecoder *	decoder;	/* decoder that decoded all the stuff used by us */
+  SwfdecDecoder *	decoder;	/* decoder in use or NULL if not yet created (only happens after loadMovie()) */
   char *		variables;	/* extra variables to be set */
 
   GHashTable *		exports;	/* string->SwfdecCharacter mapping of exported characters */
commit 8283af4ebc5efe8fd8d1072c37e604e988a50e2b
Merge: eedca0f... b4c20d7...
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 14:41:13 2007 +0200

    Merge branch 'master' of ssh://company@git.freedesktop.org/git/swfdec/swfdec

commit eedca0f0078275f7d548295036a7ebb6422e755c
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 13:08:26 2007 +0200

    add a comment

diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index c0fa6a8..ca2d962 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -703,6 +703,7 @@ swfdec_sprite_movie_unload (SwfdecSpriteMovie *movie)
 
   g_return_if_fail (SWFDEC_IS_SPRITE_MOVIE (movie));
 
+  /* This function does enough invalidating */
   swfdec_sprite_movie_clear (SWFDEC_AS_OBJECT (movie)->context, 
       SWFDEC_AS_OBJECT (movie), 0, NULL, &hack);
   movie->frame = 0;
commit f80e5cd132a292d957d09f2805c34b4898290c73
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 13:07:53 2007 +0200

    invalidate the extents when clearing

diff --git a/libswfdec/swfdec_movie_as_drawing.c b/libswfdec/swfdec_movie_as_drawing.c
index d77ef99..6817459 100644
--- a/libswfdec/swfdec_movie_as_drawing.c
+++ b/libswfdec/swfdec_movie_as_drawing.c
@@ -244,6 +244,7 @@ swfdec_sprite_movie_clear (SwfdecAsContext *cx, SwfdecAsObject *object,
   if (movie->draws == NULL)
     return;
   swfdec_movie_invalidate (movie);
+  swfdec_movie_queue_update (movie, SWFDEC_MOVIE_INVALID_EXTENTS);
   swfdec_rect_init_empty (&movie->draw_extents);
   g_slist_foreach (movie->draws, (GFunc) g_object_unref, NULL);
   g_slist_free (movie->draws);
commit 702849414e776be0b60b2fda84802b6ae5c63f54
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 12:55:35 2007 +0200

    load the initial movie step-by-step, but all others only after EOF

diff --git a/libswfdec/swfdec_resource.c b/libswfdec/swfdec_resource.c
index 7352e06..d9be02e 100644
--- a/libswfdec/swfdec_resource.c
+++ b/libswfdec/swfdec_resource.c
@@ -88,9 +88,8 @@ swfdec_resource_loader_target_image (SwfdecResource *instance)
 }
 
 static void
-swfdec_resource_loader_target_open (SwfdecLoaderTarget *target, SwfdecLoader *loader)
+swfdec_resource_open (SwfdecResource *instance, SwfdecLoader *loader)
 {
-  SwfdecResource *instance = SWFDEC_RESOURCE (target);
   const char *query;
 
   query = swfdec_url_get_query (swfdec_loader_get_url (loader));
@@ -105,9 +104,19 @@ swfdec_resource_loader_target_open (SwfdecLoaderTarget *target, SwfdecLoader *lo
 }
 
 static void
-swfdec_resource_loader_target_parse (SwfdecLoaderTarget *target, SwfdecLoader *loader)
+swfdec_resource_loader_target_open (SwfdecLoaderTarget *target, SwfdecLoader *loader)
 {
   SwfdecResource *instance = SWFDEC_RESOURCE (target);
+
+  if (!instance->initial)
+    return;
+
+  swfdec_resource_open (instance, loader);
+}
+
+static void
+swfdec_resource_parse (SwfdecResource *instance, SwfdecLoader *loader)
+{
   SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (instance->movie)->context);
   SwfdecDecoder *dec = instance->decoder;
   SwfdecDecoderClass *klass;
@@ -134,11 +143,6 @@ swfdec_resource_loader_target_parse (SwfdecLoaderTarget *target, SwfdecLoader *l
       swfdec_loader_set_target (loader, NULL);
       return;
     }
-    /* HACK for flv playback */
-    if (target != loader->target) {
-      swfdec_loader_target_parse (loader->target, loader);
-      return;
-    }
   }
   klass = SWFDEC_DECODER_GET_CLASS (dec);
   g_return_if_fail (klass->parse);
@@ -171,11 +175,39 @@ swfdec_resource_loader_target_parse (SwfdecLoaderTarget *target, SwfdecLoader *l
 }
 
 static void
+swfdec_resource_loader_target_parse (SwfdecLoaderTarget *target, SwfdecLoader *loader)
+{
+  SwfdecResource *instance = SWFDEC_RESOURCE (target);
+
+  if (!instance->initial)
+    return;
+
+  swfdec_resource_parse (instance, loader);
+}
+
+static void
+swfdec_resource_loader_target_eof (SwfdecLoaderTarget *target, SwfdecLoader *loader)
+{
+  SwfdecResource *resource = SWFDEC_RESOURCE (target);
+  SwfdecMovie *movie;
+
+  if (resource->initial)
+    return;
+
+  swfdec_resource_open (resource, loader);
+  swfdec_resource_parse (resource, loader);
+  /* FIXME: This someow initializes the first frame here. Is this ok? */
+  movie = SWFDEC_MOVIE (resource->movie);
+  swfdec_movie_initialize (movie);
+}
+
+static void
 swfdec_resource_loader_target_init (SwfdecLoaderTargetInterface *iface)
 {
   iface->get_player = swfdec_resource_loader_target_get_player;
   iface->open = swfdec_resource_loader_target_open;
   iface->parse = swfdec_resource_loader_target_parse;
+  iface->eof = swfdec_resource_loader_target_eof;
 }
 
 static void
commit 4cd1b65aa19f1fc14d98941d569ce7659bce521f
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 12:55:13 2007 +0200

    also reset the pointer to the next action

diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index 91bfb2f..c0fa6a8 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -707,6 +707,7 @@ swfdec_sprite_movie_unload (SwfdecSpriteMovie *movie)
       SWFDEC_AS_OBJECT (movie), 0, NULL, &hack);
   movie->frame = 0;
   movie->n_frames = 0;
+  movie->next_action = 0;
   movie->sprite = NULL;
 }
 
commit d2c22cde042a4bb363fb0e23ff707c3c68b73643
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 09:49:41 2007 +0200

    make SwfdecResource have an "initial" flag that is set for the first resource

diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index 6e8323d..f6e7317 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1919,6 +1919,7 @@ swfdec_player_set_loader_with_variables (SwfdecPlayer *player, SwfdecLoader *loa
   g_return_if_fail (SWFDEC_IS_LOADER (loader));
 
   player->resource = swfdec_resource_new (loader, variables);
+  player->resource->initial = TRUE;
   movie = swfdec_movie_new (player, -16384, NULL, player->resource, NULL, SWFDEC_AS_STR__level0);
   movie->name = SWFDEC_AS_STR_EMPTY;
   g_object_unref (loader);
diff --git a/libswfdec/swfdec_resource.c b/libswfdec/swfdec_resource.c
index b8c0256..7352e06 100644
--- a/libswfdec/swfdec_resource.c
+++ b/libswfdec/swfdec_resource.c
@@ -58,10 +58,12 @@ swfdec_resource_check_rights (SwfdecResource *resource)
   SwfdecFlashSecurity *sec = SWFDEC_FLASH_SECURITY (resource);
   SwfdecSwfDecoder *dec = SWFDEC_SWF_DECODER (resource->decoder);
 
-  if (dec->use_network && sec->sandbox == SWFDEC_SANDBOX_LOCAL_FILE)
-    sec->sandbox = SWFDEC_SANDBOX_LOCAL_NETWORK;
-  SWFDEC_INFO ("enabling local-with-network sandbox for %s",
-      swfdec_url_get_url (swfdec_loader_get_url (resource->loader)));
+  if (resource->initial) {
+    if (dec->use_network && sec->sandbox == SWFDEC_SANDBOX_LOCAL_FILE)
+      sec->sandbox = SWFDEC_SANDBOX_LOCAL_NETWORK;
+    SWFDEC_INFO ("enabling local-with-network sandbox for %s",
+	swfdec_url_get_url (swfdec_loader_get_url (resource->loader)));
+  }
 }
 
 static void
@@ -73,14 +75,11 @@ swfdec_resource_loader_target_image (SwfdecResource *instance)
     return;
 
   if (SWFDEC_IS_SWF_DECODER (instance->decoder)) {
-    SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (movie)->context);
     SwfdecSwfDecoder *dec = SWFDEC_SWF_DECODER (instance->decoder);
+
     movie->sprite = dec->main_sprite;
     swfdec_movie_invalidate (SWFDEC_MOVIE (movie));
-    
-    /* if first instance */
-    if (player->resource == instance)
-      swfdec_resource_check_rights (instance);
+    swfdec_resource_check_rights (instance);
   } else if (SWFDEC_IS_FLV_DECODER (instance->decoder)) {
     /* nothing to do, please move along */
   } else {
diff --git a/libswfdec/swfdec_resource.h b/libswfdec/swfdec_resource.h
index 8143d01..f97ddaf 100644
--- a/libswfdec/swfdec_resource.h
+++ b/libswfdec/swfdec_resource.h
@@ -41,6 +41,7 @@ struct _SwfdecResource
 
   SwfdecSpriteMovie * 	movie;		/* the movie responsible for creating this instance */
   guint			parse_frame;	/* next frame to parse */
+  gboolean		initial;	/* TRUE if this is the initial resource */
 
   SwfdecLoader *	loader;		/* the loader providing data for the decoder */
   SwfdecDecoder *	decoder;	/* decoder that decoded all the stuff used by us */
commit 0e38784c09bbfc9343e1b00a49b30b49f687f8ff
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Oct 19 09:43:39 2007 +0200

    fix memleak:  unref loader

diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index cb149f4..6e8323d 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1921,6 +1921,7 @@ swfdec_player_set_loader_with_variables (SwfdecPlayer *player, SwfdecLoader *loa
   player->resource = swfdec_resource_new (loader, variables);
   movie = swfdec_movie_new (player, -16384, NULL, player->resource, NULL, SWFDEC_AS_STR__level0);
   movie->name = SWFDEC_AS_STR_EMPTY;
+  g_object_unref (loader);
 }
 
 /**


More information about the Swfdec mailing list