[Swfdec] 15 commits - configure.ac doc/swfdec-sections.txt libswfdec-gtk/Makefile.am libswfdec-gtk/swfdec_gtk_loader.c libswfdec/Makefile.am libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_file_loader.c libswfdec/swfdec_file_loader.h libswfdec/swfdec.h libswfdec/swfdec_loader.c libswfdec/swfdec_loader.h libswfdec/swfdec_loader_internal.h libswfdec/swfdec_loadertarget.c libswfdec/swfdec_loadertarget.h libswfdec/swfdec_player.c libswfdec/swfdec_swf_instance.c libswfdec/swfdec_swf_instance.h libswfdec/swfdec_url.c player/swfdebug.c test/image test/sound test/trace

Benjamin Otte company at kemper.freedesktop.org
Thu Aug 2 02:35:11 PDT 2007


 configure.ac                       |   26 ++---
 doc/swfdec-sections.txt            |   11 ++
 libswfdec-gtk/Makefile.am          |    4 
 libswfdec-gtk/swfdec_gtk_loader.c  |  173 ++++++++++++-------------------------
 libswfdec/Makefile.am              |    2 
 libswfdec/swfdec.h                 |    1 
 libswfdec/swfdec_as_object.c       |    3 
 libswfdec/swfdec_as_object.h       |    3 
 libswfdec/swfdec_file_loader.c     |  134 ++++++++++++++++++++++++++++
 libswfdec/swfdec_file_loader.h     |   52 +++++++++++
 libswfdec/swfdec_loader.c          |  115 +-----------------------
 libswfdec/swfdec_loader.h          |    5 -
 libswfdec/swfdec_loader_internal.h |   22 ----
 libswfdec/swfdec_loadertarget.c    |    4 
 libswfdec/swfdec_loadertarget.h    |    6 -
 libswfdec/swfdec_player.c          |   12 +-
 libswfdec/swfdec_swf_instance.c    |   22 ++++
 libswfdec/swfdec_swf_instance.h    |    4 
 libswfdec/swfdec_url.c             |    2 
 player/swfdebug.c                  |    2 
 test/image/image.c                 |    2 
 test/sound/sound.c                 |    2 
 test/trace/trace.c                 |    2 
 23 files changed, 322 insertions(+), 287 deletions(-)

New commits:
diff-tree 3398ec3ae1d036d76054f7ddec170dc158e47079 (from ab7eb1380872f4239324fccb220fb5174517aa71)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 11:33:32 2007 +0200

    remove debugging g_print's

diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index 46b32a6..f676831 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -87,7 +87,6 @@ swfdec_gtk_loader_ensure_open (SwfdecGtk
     return;
 
   real_uri = soup_uri_to_string (soup_message_get_uri (gtk->message), FALSE);
-  g_print ("open %s\n", real_uri);
   swfdec_loader_open (SWFDEC_LOADER (gtk), real_uri);
   gtk->opened = TRUE;
   g_free (real_uri);
@@ -100,10 +99,8 @@ swfdec_gtk_loader_push (SoupMessage *msg
   SwfdecBuffer *buffer;
 
   swfdec_gtk_loader_ensure_open (gtk);
-  g_print ("push\n");
   buffer = swfdec_buffer_new_and_alloc (msg->response.length);
   memcpy (buffer->data, msg->response.body, msg->response.length);
-  g_print (" ... %u bytes\n", msg->response.length);
   swfdec_loader_push (loader, buffer);
 }
 
@@ -112,10 +109,8 @@ swfdec_gtk_loader_finish (SoupMessage *m
 {
   if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
     swfdec_gtk_loader_ensure_open (loader);
-    g_print ("eof\n");
     swfdec_loader_eof (loader);
   } else {
-    g_print ("error %u\n", msg->status_code);
     swfdec_loader_error (loader, "FIXME: make useful error message");
   }
 }
@@ -133,7 +128,6 @@ swfdec_gtk_loader_load (SwfdecLoader *lo
     SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
     SwfdecGtkLoaderClass *klass = SWFDEC_GTK_LOADER_GET_CLASS (gtk);
 
-    g_print ("new %s\n", swfdec_url_get_url (url));
     gtk->message = soup_message_new (request == SWFDEC_LOADER_REQUEST_POST ? "POST" : "GET",
 	swfdec_url_get_url (url));
     soup_message_set_flags (gtk->message, SOUP_MESSAGE_OVERWRITE_CHUNKS);
diff-tree ab7eb1380872f4239324fccb220fb5174517aa71 (from 83ecd1830fcef2f888cd87b733f0b6b23775acbc)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 11:30:23 2007 +0200

    remove got-headers callback

diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index 29fdc2d..46b32a6 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -79,12 +79,6 @@ swfdec_gtk_loader_dispose (GObject *obje
 }
 
 static void
-swfdec_gtk_loader_open (SoupMessage *msg, gpointer loader)
-{
-  g_print ("open %u\n", msg->status_code);
-}
-
-static void
 swfdec_gtk_loader_ensure_open (SwfdecGtkLoader *gtk)
 {
   char *real_uri;
@@ -143,7 +137,6 @@ swfdec_gtk_loader_load (SwfdecLoader *lo
     gtk->message = soup_message_new (request == SWFDEC_LOADER_REQUEST_POST ? "POST" : "GET",
 	swfdec_url_get_url (url));
     soup_message_set_flags (gtk->message, SOUP_MESSAGE_OVERWRITE_CHUNKS);
-    g_signal_connect (gtk->message, "got-headers", G_CALLBACK (swfdec_gtk_loader_open), gtk);
     g_signal_connect (gtk->message, "got-chunk", G_CALLBACK (swfdec_gtk_loader_push), gtk);
     if (data)
       soup_message_set_request (gtk->message, "appliation/x-www-urlencoded",
diff-tree 83ecd1830fcef2f888cd87b733f0b6b23775acbc (from 18e294218b36b523ff2f81a7fea5ff8c456b6ea6)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 11:29:48 2007 +0200

    ensure the loader is opened for EOF

diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index b076a8c..29fdc2d 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -85,18 +85,27 @@ swfdec_gtk_loader_open (SoupMessage *msg
 }
 
 static void
+swfdec_gtk_loader_ensure_open (SwfdecGtkLoader *gtk)
+{
+  char *real_uri;
+
+  if (gtk->opened)
+    return;
+
+  real_uri = soup_uri_to_string (soup_message_get_uri (gtk->message), FALSE);
+  g_print ("open %s\n", real_uri);
+  swfdec_loader_open (SWFDEC_LOADER (gtk), real_uri);
+  gtk->opened = TRUE;
+  g_free (real_uri);
+}
+
+static void
 swfdec_gtk_loader_push (SoupMessage *msg, gpointer loader)
 {
   SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
   SwfdecBuffer *buffer;
 
-  if (!gtk->opened) {
-    char *real_uri = soup_uri_to_string (soup_message_get_uri (msg), FALSE);
-    g_print ("open %s\n", real_uri);
-    swfdec_loader_open (loader, real_uri);
-    gtk->opened = TRUE;
-    g_free (real_uri);
-  }
+  swfdec_gtk_loader_ensure_open (gtk);
   g_print ("push\n");
   buffer = swfdec_buffer_new_and_alloc (msg->response.length);
   memcpy (buffer->data, msg->response.body, msg->response.length);
@@ -108,6 +117,7 @@ static void
 swfdec_gtk_loader_finish (SoupMessage *msg, gpointer loader)
 {
   if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
+    swfdec_gtk_loader_ensure_open (loader);
     g_print ("eof\n");
     swfdec_loader_eof (loader);
   } else {
diff-tree 18e294218b36b523ff2f81a7fea5ff8c456b6ea6 (from 5f45a922e06cc0595d6d5240ae47a2b825ecd2dc)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 11:26:51 2007 +0200

    various fixes
    
    - detect error in finish callback
    - pass the complete URI to swfdec

diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index 4a4d8d6..b076a8c 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -91,7 +91,7 @@ swfdec_gtk_loader_push (SoupMessage *msg
   SwfdecBuffer *buffer;
 
   if (!gtk->opened) {
-    char *real_uri = soup_uri_to_string (soup_message_get_uri (msg), TRUE);
+    char *real_uri = soup_uri_to_string (soup_message_get_uri (msg), FALSE);
     g_print ("open %s\n", real_uri);
     swfdec_loader_open (loader, real_uri);
     gtk->opened = TRUE;
@@ -105,10 +105,15 @@ swfdec_gtk_loader_push (SoupMessage *msg
 }
 
 static void
-swfdec_gtk_loader_eof (SoupMessage *msg, gpointer loader)
+swfdec_gtk_loader_finish (SoupMessage *msg, gpointer loader)
 {
-  g_print ("eof\n");
-  swfdec_loader_eof (loader);
+  if (SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
+    g_print ("eof\n");
+    swfdec_loader_eof (loader);
+  } else {
+    g_print ("error %u\n", msg->status_code);
+    swfdec_loader_error (loader, "FIXME: make useful error message");
+  }
 }
 
 static void
@@ -124,15 +129,16 @@ swfdec_gtk_loader_load (SwfdecLoader *lo
     SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
     SwfdecGtkLoaderClass *klass = SWFDEC_GTK_LOADER_GET_CLASS (gtk);
 
+    g_print ("new %s\n", swfdec_url_get_url (url));
     gtk->message = soup_message_new (request == SWFDEC_LOADER_REQUEST_POST ? "POST" : "GET",
-	swfdec_url_get_url (swfdec_loader_get_url (loader)));
+	swfdec_url_get_url (url));
     soup_message_set_flags (gtk->message, SOUP_MESSAGE_OVERWRITE_CHUNKS);
     g_signal_connect (gtk->message, "got-headers", G_CALLBACK (swfdec_gtk_loader_open), gtk);
     g_signal_connect (gtk->message, "got-chunk", G_CALLBACK (swfdec_gtk_loader_push), gtk);
     if (data)
       soup_message_set_request (gtk->message, "appliation/x-www-urlencoded",
 	  SOUP_BUFFER_USER_OWNED, (char *) data, data_len);
-    soup_session_queue_message (klass->session, gtk->message, swfdec_gtk_loader_eof, gtk);
+    soup_session_queue_message (klass->session, gtk->message, swfdec_gtk_loader_finish, gtk);
   }
 }
 
diff-tree 5f45a922e06cc0595d6d5240ae47a2b825ecd2dc (from 017114e242a8ffae75619581a21c23e43089403c)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 11:25:37 2007 +0200

    handle movie variables differently
    
    variables are now auto-parsed from the URL's query string.

diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index c7a67c9..78493bf 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1293,10 +1293,8 @@ swfdec_player_add_level_from_loader (Swf
   name = swfdec_as_context_give_string (SWFDEC_AS_CONTEXT (player), g_strdup_printf ("_level%u", depth));
   movie = swfdec_movie_new (player, depth - 16384, NULL, NULL, name);
   movie->name = SWFDEC_AS_STR_EMPTY;
-  swfdec_swf_instance_new (SWFDEC_SPRITE_MOVIE (movie), loader);
+  swfdec_swf_instance_new (SWFDEC_SPRITE_MOVIE (movie), loader, variables);
   g_object_unref (loader);
-  if (variables)
-    swfdec_movie_set_variables (movie, variables);
   return movie;
 }
 
diff --git a/libswfdec/swfdec_swf_instance.c b/libswfdec/swfdec_swf_instance.c
index 7f82971..df6b252 100644
--- a/libswfdec/swfdec_swf_instance.c
+++ b/libswfdec/swfdec_swf_instance.c
@@ -72,6 +72,23 @@ swfdec_swf_instance_loader_target_image 
 }
 
 static void
+swfdec_swf_instance_loader_target_open (SwfdecLoaderTarget *target, SwfdecLoader *loader)
+{
+  SwfdecSwfInstance *instance = SWFDEC_SWF_INSTANCE (target);
+  const char *query;
+
+  query = swfdec_url_get_query (swfdec_loader_get_url (loader));
+  if (query) {
+    SWFDEC_INFO ("set url query movie variables: %s", query);
+    swfdec_movie_set_variables (SWFDEC_MOVIE (instance->movie), query);
+  }
+  if (instance->variables) {
+    SWFDEC_INFO ("set manual movie variables: %s", instance->variables);
+    swfdec_movie_set_variables (SWFDEC_MOVIE (instance->movie), instance->variables);
+  }
+}
+
+static void
 swfdec_swf_instance_loader_target_parse (SwfdecLoaderTarget *target, SwfdecLoader *loader)
 {
   SwfdecSwfInstance *instance = SWFDEC_SWF_INSTANCE (target);
@@ -141,6 +158,7 @@ static void
 swfdec_swf_instance_loader_target_init (SwfdecLoaderTargetInterface *iface)
 {
   iface->get_player = swfdec_swf_instance_loader_target_get_player;
+  iface->open = swfdec_swf_instance_loader_target_open;
   iface->parse = swfdec_swf_instance_loader_target_parse;
 }
 
@@ -155,6 +173,7 @@ swfdec_swf_instance_dispose (GObject *ob
     g_object_unref (instance->decoder);
     instance->decoder = NULL;
   }
+  g_free (instance->variables);
   g_hash_table_destroy (instance->exports);
   g_hash_table_destroy (instance->export_names);
 
@@ -177,7 +196,7 @@ swfdec_swf_instance_init (SwfdecSwfInsta
 }
 
 SwfdecSwfInstance *
-swfdec_swf_instance_new (SwfdecSpriteMovie *movie, SwfdecLoader *loader)
+swfdec_swf_instance_new (SwfdecSpriteMovie *movie, SwfdecLoader *loader, const char *variables)
 {
   SwfdecMovie *mov;
   SwfdecSwfInstance *swf;
@@ -188,6 +207,7 @@ swfdec_swf_instance_new (SwfdecSpriteMov
   mov = SWFDEC_MOVIE (movie);
   swf = g_object_new (SWFDEC_TYPE_SWF_INSTANCE, NULL);
   /* set important variables */
+  swf->variables = g_strdup (variables);
   swf->movie = movie;
   if (mov->swf)
     g_object_unref (mov->swf);
diff --git a/libswfdec/swfdec_swf_instance.h b/libswfdec/swfdec_swf_instance.h
index 2ab3c06..89d1cdb 100644
--- a/libswfdec/swfdec_swf_instance.h
+++ b/libswfdec/swfdec_swf_instance.h
@@ -43,6 +43,7 @@ struct _SwfdecSwfInstance
 
   SwfdecLoader *	loader;		/* the loader providing data for the decoder */
   SwfdecDecoder *	decoder;	/* decoder that decoded all the stuff used by us */
+  char *		variables;	/* extra variables to be set */
 
   GHashTable *		exports;	/* string->SwfdecCharacter mapping of exported characters */
   GHashTable *		export_names;	/* SwfdecCharacter->string mapping of exported characters */
@@ -57,7 +58,8 @@ GType		swfdec_swf_instance_get_type	  	(
 
 SwfdecSwfInstance *
 		swfdec_swf_instance_new			(SwfdecSpriteMovie *  	movie,
-							 SwfdecLoader *		loader);
+							 SwfdecLoader *		loader,
+							 const char *		variables);
 
 void		swfdec_swf_instance_advance		(SwfdecSwfInstance *	instance);
 
diff-tree 017114e242a8ffae75619581a21c23e43089403c (from 3b9c222f1edab84789cc275500ef52cc56e42615)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 11:22:47 2007 +0200

    fix query string - don't omit the first character

diff --git a/libswfdec/swfdec_url.c b/libswfdec/swfdec_url.c
index 47b7142..16267f3 100644
--- a/libswfdec/swfdec_url.c
+++ b/libswfdec/swfdec_url.c
@@ -106,7 +106,7 @@ swfdec_url_new (const char *string)
   url->path = g_strndup (string, s - string);
   s++;
   if (*s)
-    url->query = g_strdup (s + 1);
+    url->query = g_strdup (s);
   return url;
 }
 
diff-tree 3b9c222f1edab84789cc275500ef52cc56e42615 (from 42a4019df077264961406edeffe828eeba3296ee)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 11:06:16 2007 +0200

    copy/paste error: use external_actions instead of actions ringbuffer

diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index 8b497da..c7a67c9 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -361,9 +361,9 @@ swfdec_player_add_external_action (Swfde
   action = swfdec_ring_buffer_push (player->external_actions);
   if (action == NULL) {
     /* FIXME: limit number of actions to not get inf loops due to scripts? */
-    swfdec_ring_buffer_set_size (player->actions,
-	swfdec_ring_buffer_get_size (player->actions) + 16);
-    action = swfdec_ring_buffer_push (player->actions);
+    swfdec_ring_buffer_set_size (player->external_actions,
+	swfdec_ring_buffer_get_size (player->external_actions) + 16);
+    action = swfdec_ring_buffer_push (player->external_actions);
     g_assert (action);
   }
   action->object = object;
diff-tree 42a4019df077264961406edeffe828eeba3296ee (from 475398f245045eff926c41d3e4a80ac0f907386a)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 09:26:14 2007 +0200

    Change the gtk loader to use libsoup instead of gnome-vfs

diff --git a/configure.ac b/configure.ac
index e2336c5..9abfa49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -246,21 +246,21 @@ fi
 AM_CONDITIONAL(HAVE_GST, [test "x$HAVE_GST" = xyes])
 
 
-AC_ARG_ENABLE(gnome-vfs,
-	AS_HELP_STRING([--enable-gnome-vfs],
-			[enable gnome-vfs support for swfdec-gtk (default=yes)])],
-	enable_gnomevfs=$enableval,
-	enable_gnomevfs="yes")
+AC_ARG_ENABLE(soup,
+	AS_HELP_STRING([--enable-soup],
+			[enable libaoup HTTP support for swfdec-gtk (default=yes)])],
+	enable_libsoup=$enableval,
+	enable_libsoup="yes")
 
-if test "$enable_gnomevfs" = "yes"; then
-	PKG_CHECK_MODULES(HTTP, gnome-vfs-2.0 >= 2.14.0, HAVE_HTTP=yes, HAVE_HTTP=no)
+if test "$enable_libsoup" = "yes"; then
+	PKG_CHECK_MODULES(HTTP, libsoup-2.2 >= 2.2.0, HAVE_HTTP=yes, HAVE_HTTP=no)
 	if test "x$HAVE_HTTP" = xyes; then
-	  AC_DEFINE(HAVE_HTTP, 1, [Define if gnome-vfs is enabled])
+	  AC_DEFINE(HAVE_HTTP, 1, [Define if libsoup is enabled])
 	else
-	  AC_MSG_ERROR([Couldn't find gnome-vfs-2.0.])
+	  AC_MSG_ERROR([Couldn't find libsoup-2.2.])
 	fi
 else
-	AC_MSG_WARN([*** gnome-vfs support was not enabled. ***])
+	AC_MSG_WARN([*** libsoup HTTP support was not enabled. ***])
 fi
 AM_CONDITIONAL(HAVE_HTTP, [test "x$HAVE_HTTP" = xyes])
 
diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index 73fa0fa..4a4d8d6 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -21,6 +21,8 @@
 #include "config.h"
 #endif
 
+#include <libsoup/soup.h>
+#include <string.h>
 #include "swfdec_gtk_loader.h"
 
 /*** GTK-DOC ***/
@@ -32,7 +34,7 @@
  * @see_also: #SwfdecLoader
  *
  * #SwfdecGtkLoader is a #SwfdecLoader that is intended as an easy way to be 
- * access ressources that are not stored in files, such as http. It can 
+ * access ressources that are not stored in files, such as HTTP. It can 
  * however be compiled with varying support for different protocols, so don't
  * rely on support for a particular protocol being available. If you need this,
  * code your own SwfdecLoader subclass.
@@ -45,147 +47,93 @@
  * backends, it is completely private.
  */
 
-#ifndef HAVE_HTTP
-
-#include <libswfdec/swfdec_loader_internal.h>
-
-GType
-swfdec_gtk_loader_get_type (void)
-{
-  return SWFDEC_TYPE_FILE_LOADER;
-}
-
-SwfdecLoader *
-swfdec_gtk_loader_new (const char *uri)
-{
-  g_return_val_if_fail (uri != NULL, NULL);
-
-  return swfdec_loader_new_from_file (uri);
-}
-
-
-#else /* HAVE_HTTP */
-
-/* size of buffer we read */
-#define BUFFER_SIZE 4096
-
-#include <libgnomevfs/gnome-vfs.h>
-
 struct _SwfdecGtkLoader
 {
   SwfdecLoader		loader;
 
-  GnomeVFSURI *		guri;		/* GnomeVFS URI used for resolving */
-  GnomeVFSAsyncHandle *	handle;		/* handle to file or NULL when done */
-  SwfdecBuffer *	current_buffer;	/* current buffer we're reading into */
+  SoupMessage *		message;	/* the message we're sending */
+  gboolean		opened;		/* set after first bytes of data have arrived */
 };
 
 struct _SwfdecGtkLoaderClass {
   SwfdecLoaderClass	loader_class;
+
+  SoupSession *		session;	/* the session used by the loader */
 };
 
 /*** SwfdecGtkLoader ***/
 
-G_DEFINE_TYPE (SwfdecGtkLoader, swfdec_gtk_loader, SWFDEC_TYPE_LOADER)
+G_DEFINE_TYPE (SwfdecGtkLoader, swfdec_gtk_loader, SWFDEC_TYPE_FILE_LOADER)
 
-static void swfdec_gtk_loader_start_read (SwfdecGtkLoader *gtk);
 static void
-swfdec_gtk_loader_read_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result,
-    gpointer buffer, GnomeVFSFileSize bytes_requested, GnomeVFSFileSize bytes_read, 
-    gpointer loaderp)
-{
-  SwfdecGtkLoader *gtk = loaderp;
-  SwfdecLoader *loader = loaderp;
-
-  if (result == GNOME_VFS_ERROR_EOF) {
-    swfdec_loader_eof (loader);
-    swfdec_buffer_unref (gtk->current_buffer);
-    gtk->current_buffer = NULL;
-    gnome_vfs_async_cancel (gtk->handle);
-    gtk->handle = NULL;
-    return;
-  } else if (result != GNOME_VFS_OK) {
-    char *err = g_strdup_printf ("%s: %s", 
-	swfdec_url_get_url (swfdec_loader_get_url (loader)),
-	gnome_vfs_result_to_string (result));
-    swfdec_loader_error (loader, err);
-    g_free (err);
-    swfdec_buffer_unref (gtk->current_buffer);
-    gtk->current_buffer = NULL;
-    gnome_vfs_async_cancel (gtk->handle);
-    gtk->handle = NULL;
-    return;
-  }
-  if (bytes_read) {
-    gtk->current_buffer->length = bytes_read;
-    swfdec_loader_push (loader, gtk->current_buffer);
-  } else {
-    swfdec_buffer_unref (gtk->current_buffer);
+swfdec_gtk_loader_dispose (GObject *object)
+{
+  SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (object);
+
+  if (gtk->message) {
+    g_object_unref (gtk->message);
+    gtk->message = NULL;
   }
-  gtk->current_buffer = NULL;
-  swfdec_gtk_loader_start_read (gtk);
+
+  G_OBJECT_CLASS (swfdec_gtk_loader_parent_class)->dispose (object);
 }
 
 static void
-swfdec_gtk_loader_start_read (SwfdecGtkLoader *gtk)
+swfdec_gtk_loader_open (SoupMessage *msg, gpointer loader)
 {
-  g_assert (gtk->current_buffer == NULL);
-  g_assert (gtk->handle != NULL);
-
-  gtk->current_buffer = swfdec_buffer_new_and_alloc (BUFFER_SIZE);
-  gnome_vfs_async_read (gtk->handle, gtk->current_buffer->data,
-      gtk->current_buffer->length, swfdec_gtk_loader_read_cb, gtk);
+  g_print ("open %u\n", msg->status_code);
 }
 
 static void
-swfdec_gtk_loader_open_cb (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, 
-    gpointer loaderp)
+swfdec_gtk_loader_push (SoupMessage *msg, gpointer loader)
 {
-  SwfdecGtkLoader *gtk = loaderp;
-  SwfdecLoader *loader = loaderp;
+  SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
+  SwfdecBuffer *buffer;
 
-  if (result != GNOME_VFS_OK) {
-    char *err = g_strdup_printf ("%s: %s",
-	swfdec_url_get_url (swfdec_loader_get_url (loader)),
-	gnome_vfs_result_to_string (result));
-    swfdec_loader_error (loader, err);
-    g_free (err);
-    gnome_vfs_async_cancel (gtk->handle);
-    gtk->handle = NULL;
-    return;
+  if (!gtk->opened) {
+    char *real_uri = soup_uri_to_string (soup_message_get_uri (msg), TRUE);
+    g_print ("open %s\n", real_uri);
+    swfdec_loader_open (loader, real_uri);
+    gtk->opened = TRUE;
+    g_free (real_uri);
   }
-  swfdec_gtk_loader_start_read (gtk);
+  g_print ("push\n");
+  buffer = swfdec_buffer_new_and_alloc (msg->response.length);
+  memcpy (buffer->data, msg->response.body, msg->response.length);
+  g_print (" ... %u bytes\n", msg->response.length);
+  swfdec_loader_push (loader, buffer);
 }
 
 static void
-swfdec_gtk_loader_dispose (GObject *object)
+swfdec_gtk_loader_eof (SoupMessage *msg, gpointer loader)
 {
-  SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (object);
-
-  if (gtk->current_buffer) {
-    swfdec_buffer_unref (gtk->current_buffer);
-    gtk->current_buffer = NULL;
-  }
-  if (gtk->handle) {
-    gnome_vfs_async_cancel (gtk->handle);
-    gtk->handle = NULL;
-  }
-  if (gtk->guri) {
-    gnome_vfs_uri_unref (gtk->guri);
-    gtk->guri = NULL;
-  }
-
-  G_OBJECT_CLASS (swfdec_gtk_loader_parent_class)->dispose (object);
+  g_print ("eof\n");
+  swfdec_loader_eof (loader);
 }
 
 static void
 swfdec_gtk_loader_load (SwfdecLoader *loader,
     SwfdecLoaderRequest request, const char *data, gsize data_len)
 {
-  SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
+  const SwfdecURL *url = swfdec_loader_get_url (loader);
 
-  gnome_vfs_async_open (&gtk->handle, swfdec_url_get_url (swfdec_loader_get_url (loader)), 
-      GNOME_VFS_OPEN_READ, GNOME_VFS_PRIORITY_DEFAULT, swfdec_gtk_loader_open_cb, gtk);
+  if (g_ascii_strcasecmp (swfdec_url_get_protocol (url), "http") != 0 &&
+      g_ascii_strcasecmp (swfdec_url_get_protocol (url), "https") != 0) {
+    SWFDEC_LOADER_CLASS (swfdec_gtk_loader_parent_class)->load (loader, request, data, data_len);
+  } else {
+    SwfdecGtkLoader *gtk = SWFDEC_GTK_LOADER (loader);
+    SwfdecGtkLoaderClass *klass = SWFDEC_GTK_LOADER_GET_CLASS (gtk);
+
+    gtk->message = soup_message_new (request == SWFDEC_LOADER_REQUEST_POST ? "POST" : "GET",
+	swfdec_url_get_url (swfdec_loader_get_url (loader)));
+    soup_message_set_flags (gtk->message, SOUP_MESSAGE_OVERWRITE_CHUNKS);
+    g_signal_connect (gtk->message, "got-headers", G_CALLBACK (swfdec_gtk_loader_open), gtk);
+    g_signal_connect (gtk->message, "got-chunk", G_CALLBACK (swfdec_gtk_loader_push), gtk);
+    if (data)
+      soup_message_set_request (gtk->message, "appliation/x-www-urlencoded",
+	  SOUP_BUFFER_USER_OWNED, (char *) data, data_len);
+    soup_session_queue_message (klass->session, gtk->message, swfdec_gtk_loader_eof, gtk);
+  }
 }
 
 static void
@@ -194,11 +142,12 @@ swfdec_gtk_loader_class_init (SwfdecGtkL
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   SwfdecLoaderClass *loader_class = SWFDEC_LOADER_CLASS (klass);
 
-  gnome_vfs_init ();
-
   object_class->dispose = swfdec_gtk_loader_dispose;
 
   loader_class->load = swfdec_gtk_loader_load;
+  
+  g_thread_init (NULL);
+  klass->session = soup_session_async_new ();
 }
 
 static void
@@ -210,13 +159,10 @@ swfdec_gtk_loader_init (SwfdecGtkLoader 
  * swfdec_gtk_loader_new:
  * @uri: The location of the file to open
  *
- * Creates a new loader for the given URI using gnome-vfs (or using the local
- * file backend, if compiled without gnome-vfs support). The uri must be valid
- * UTF-8. If using gnome-vfs, you might want to use 
- * gnome_vfs_make_uri_from_shell_arg() or gnome_vfs_make_uri_from_input() on
- * the @uri prior to calling this function.
+ * Creates a new loader for the given URI. The uri must be a valid UTF-8-encoded
+ * URL. 
  *
- * Returns: a new #SwfdecLoader using gnome-vfs.
+ * Returns: a new #SwfdecGtkLoader
  **/
 SwfdecLoader *
 swfdec_gtk_loader_new (const char *uri)
@@ -230,5 +176,3 @@ swfdec_gtk_loader_new (const char *uri)
   swfdec_gtk_loader_load (loader, SWFDEC_LOADER_REQUEST_DEFAULT, NULL, 0);
   return loader;
 }
-
-#endif /* HAVE_GNOMEVFS */
diff-tree 475398f245045eff926c41d3e4a80ac0f907386a (from 3ddffa3a51e8c1eacb15d89fa0960cc4b15f5e74)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Aug 2 09:25:58 2007 +0200

    get rid of the HTTP status on open(). Instead allow changing the URL.
    
    The HTTP status is not needed on open. It's only needed on errors or on eof.
    We'll need to find a better way to set it.
    Changing the URL is useful because it allows forwards to be honoured.

diff --git a/libswfdec/swfdec_loader.c b/libswfdec/swfdec_loader.c
index aba9990..9e8a9a5 100644
--- a/libswfdec/swfdec_loader.c
+++ b/libswfdec/swfdec_loader.c
@@ -196,7 +196,7 @@ swfdec_loader_perform_open (gpointer loa
 {
   SwfdecLoader *loader = loaderp;
 
-  swfdec_loader_target_open (loader->target, loader, loader->open_status);
+  swfdec_loader_target_open (loader->target, loader);
 }
 
 static void
@@ -321,21 +321,24 @@ swfdec_loader_error (SwfdecLoader *loade
 /**
  * swfdec_loader_open:
  * @loader: a #SwfdecLoader
- * @status: HTTP state code when opening the connection or 0 if unknown or not
- *          a HTTP connection.
+ * @url: the real URL used for this loader if it has changed (e.g. after HTTP 
+ *       redirects) or %NULL if it hasn't changed
  *
  * Call this function when your loader opened the resulting file. For HTTP this
  * is when having received the headers. You must call this function before 
  * swfdec_laoder_push() can be called.
  **/
 void
-swfdec_loader_open (SwfdecLoader *loader, guint status)
+swfdec_loader_open (SwfdecLoader *loader, const char *url)
 {
   g_return_if_fail (SWFDEC_IS_LOADER (loader));
   g_return_if_fail (loader->state == SWFDEC_LOADER_STATE_NEW);
 
   loader->state = SWFDEC_LOADER_STATE_OPEN;
-  loader->open_status = status;
+  if (url) {
+    swfdec_url_free (loader->url);
+    loader->url = swfdec_url_new (url);
+  }
   if (loader->player)
     swfdec_player_add_external_action (loader->player, loader, swfdec_loader_perform_open, NULL);
 }
diff --git a/libswfdec/swfdec_loader.h b/libswfdec/swfdec_loader.h
index 73c54ad..3f5db15 100644
--- a/libswfdec/swfdec_loader.h
+++ b/libswfdec/swfdec_loader.h
@@ -58,7 +58,6 @@ struct _SwfdecLoader
   /*< private >*/
   guint			state;		/* SwfdecLoaderState the loader is currently in */
   SwfdecURL *		url;		/* the URL for this loader in UTF-8 - must be set on creation */
-  guint			open_status;	/* HTTP status when opening or 0 if unknown */
   gulong		size;		/* number of bytes in stream or 0 if unknown */
   char *		error;		/* error message if in error state or NULL */
   gpointer		target;		/* SwfdecLoaderTarget that gets notified about loading progress */
@@ -81,7 +80,7 @@ struct _SwfdecLoaderClass
 GType		swfdec_loader_get_type		(void);
 
 void		swfdec_loader_open		(SwfdecLoader *		loader,
-						 guint			status);
+						 const char *		url);
 void		swfdec_loader_push		(SwfdecLoader *		loader,
 						 SwfdecBuffer *		buffer);
 void		swfdec_loader_eof		(SwfdecLoader *		loader);
diff --git a/libswfdec/swfdec_loadertarget.c b/libswfdec/swfdec_loadertarget.c
index a6723b1..39bc745 100644
--- a/libswfdec/swfdec_loadertarget.c
+++ b/libswfdec/swfdec_loadertarget.c
@@ -76,7 +76,7 @@ swfdec_loader_target_get_player (SwfdecL
 }
 
 void
-swfdec_loader_target_open (SwfdecLoaderTarget *target, SwfdecLoader *loader, guint status)
+swfdec_loader_target_open (SwfdecLoaderTarget *target, SwfdecLoader *loader)
 {
   SwfdecLoaderTargetInterface *iface;
   
@@ -87,7 +87,7 @@ swfdec_loader_target_open (SwfdecLoaderT
 
   iface = SWFDEC_LOADER_TARGET_GET_INTERFACE (target);
   if (iface->open)
-    iface->open (target, loader, status);
+    iface->open (target, loader);
 }
 
 void
diff --git a/libswfdec/swfdec_loadertarget.h b/libswfdec/swfdec_loadertarget.h
index 81178c5..1e9c523 100644
--- a/libswfdec/swfdec_loadertarget.h
+++ b/libswfdec/swfdec_loadertarget.h
@@ -40,8 +40,7 @@ struct _SwfdecLoaderTargetInterface {
   SwfdecPlayer *	(* get_player)      	(SwfdecLoaderTarget *	target);
   /* optional vfuncs */
   void			(* open)		(SwfdecLoaderTarget *   target,
-						 SwfdecLoader *		loader,
-						 guint			status);
+						 SwfdecLoader *		loader);
   void			(* parse)		(SwfdecLoaderTarget *   target,
 						 SwfdecLoader *		loader);
   void			(* eof)			(SwfdecLoaderTarget *   target,
@@ -54,8 +53,7 @@ GType		swfdec_loader_target_get_type		(v
 
 SwfdecPlayer *	swfdec_loader_target_get_player		(SwfdecLoaderTarget *	target);
 void		swfdec_loader_target_open		(SwfdecLoaderTarget *	target,
-							 SwfdecLoader *		loader,
-							 guint			status);
+							 SwfdecLoader *		loader);
 void		swfdec_loader_target_parse		(SwfdecLoaderTarget *	target,
 							 SwfdecLoader *		loader);
 void		swfdec_loader_target_eof		(SwfdecLoaderTarget *	target,
diff-tree 3ddffa3a51e8c1eacb15d89fa0960cc4b15f5e74 (from e2eb4c063546555cb2ebfc956d7510cee36580b2)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 1 20:31:23 2007 +0200

    fix docs

diff --git a/doc/swfdec-sections.txt b/doc/swfdec-sections.txt
index a250b3a..a58478d 100644
--- a/doc/swfdec-sections.txt
+++ b/doc/swfdec-sections.txt
@@ -18,7 +18,8 @@ SWFDEC_AUDIO_GET_CLASS
 <FILE>SwfdecLoader</FILE>
 <TITLE>SwfdecLoader</TITLE>
 SwfdecLoader
-swfdec_loader_new_from_file
+SwfdecFileLoader
+swfdec_file_loader_new
 swfdec_loader_open
 swfdec_loader_push
 swfdec_loader_eof
@@ -38,6 +39,14 @@ swfdec_loader_get_type
 SWFDEC_LOADER_CLASS
 SWFDEC_IS_LOADER_CLASS
 SWFDEC_LOADER_GET_CLASS
+SwfdecFileLoaderClass
+SWFDEC_FILE_LOADER
+SWFDEC_FILE_LOADER_CLASS
+SWFDEC_FILE_LOADER_GET_CLASS
+SWFDEC_IS_FILE_LOADER
+SWFDEC_IS_FILE_LOADER_CLASS
+SWFDEC_TYPE_FILE_LOADER
+swfdec_file_loader_get_type
 </SECTION>
 
 <SECTION>
diff-tree e2eb4c063546555cb2ebfc956d7510cee36580b2 (from de83e4b08aba8b934c0ea54eefc475642259c6d5)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 1 20:31:11 2007 +0200

    actually commit the file loader code (oops)

diff --git a/libswfdec/swfdec_file_loader.c b/libswfdec/swfdec_file_loader.c
new file mode 100644
index 0000000..54308c8
--- /dev/null
+++ b/libswfdec/swfdec_file_loader.c
@@ -0,0 +1,134 @@
+/* Swfdec
+ * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include "swfdec_loader_internal.h"
+#include "swfdec_buffer.h"
+#include "swfdec_debug.h"
+#include "swfdec_loadertarget.h"
+#include "swfdec_player_internal.h"
+
+/**
+ * SwfdecFileLoader:
+ *
+ * This is a #SwfdecLoader that can load content from files. This symbol is
+ * exported so you can subclass your own loaders from it and have automatic
+ * file access.
+ */
+
+G_DEFINE_TYPE (SwfdecFileLoader, swfdec_file_loader, SWFDEC_TYPE_LOADER)
+
+static void
+swfdec_file_loader_load (SwfdecLoader *loader, SwfdecLoaderRequest request, 
+    const char *data, gsize data_len)
+{
+  const SwfdecURL *url;
+  SwfdecBuffer *buffer;
+  GError *error = NULL;
+  char *real;
+
+  url = swfdec_loader_get_url (loader);
+  if (!g_str_equal (swfdec_url_get_protocol (url), "file")) {
+    swfdec_loader_error (loader, "Don't know how to handle other protocols than file");
+    return;
+  }
+  if (swfdec_url_get_host (url)) {
+    swfdec_loader_error (loader, "filenames cannot have hostnames");
+    return;
+  }
+
+  /* FIXME: append query string here? */
+  real = g_strconcat ("/", swfdec_url_get_path (url), NULL);
+  buffer = swfdec_buffer_new_from_file (real, &error);
+  if (buffer == NULL) {
+    swfdec_loader_error (loader, error->message);
+    g_error_free (error);
+  } else {
+    swfdec_loader_set_size (loader, buffer->length);
+    swfdec_loader_open (loader, 0);
+    swfdec_loader_push (loader, buffer);
+    swfdec_loader_eof (loader);
+  }
+}
+
+static void
+swfdec_file_loader_class_init (SwfdecFileLoaderClass *klass)
+{
+  SwfdecLoaderClass *loader_class = SWFDEC_LOADER_CLASS (klass);
+
+  loader_class->load = swfdec_file_loader_load;
+}
+
+static void
+swfdec_file_loader_init (SwfdecFileLoader *loader)
+{
+}
+
+/**
+ * swfdec_file_loader_new:
+ * @filename: name of the file to load
+ *
+ * Creates a new loader for local files. If an error occurred, the loader will
+ * be in error.
+ *
+ * Returns: a new loader
+ **/
+SwfdecLoader *
+swfdec_file_loader_new (const char *filename)
+{
+  SwfdecBuffer *buf;
+  SwfdecLoader *loader;
+  GError *error = NULL;
+  char *url;
+
+  g_return_val_if_fail (filename != NULL, NULL);
+
+  buf = swfdec_buffer_new_from_file (filename, &error);
+
+  if (g_path_is_absolute (filename)) {
+    url = g_strconcat ("file://", filename, NULL);
+  } else {
+    char *abs, *cur;
+    cur = g_get_current_dir ();
+    abs = g_build_filename (cur, filename, NULL);
+    g_free (cur);
+    url = g_strconcat ("file://", abs, NULL);
+    g_free (abs);
+  }
+
+  loader = g_object_new (SWFDEC_TYPE_FILE_LOADER, NULL);
+  loader->url = swfdec_url_new (url);
+  g_assert (loader->url);
+  g_free (url);
+  if (buf == NULL) {
+    swfdec_loader_error (loader, error->message);
+    g_error_free (error);
+  } else {
+    swfdec_loader_set_size (loader, buf->length);
+    swfdec_loader_open (loader, 0);
+    swfdec_loader_push (loader, buf);
+    swfdec_loader_eof (loader);
+  }
+  return loader;
+}
+
diff --git a/libswfdec/swfdec_file_loader.h b/libswfdec/swfdec_file_loader.h
new file mode 100644
index 0000000..5e1063c
--- /dev/null
+++ b/libswfdec/swfdec_file_loader.h
@@ -0,0 +1,52 @@
+/* Swfdec
+ * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA  02110-1301  USA
+ */
+
+#ifndef _SWFDEC_FILE_LOADER_H_
+#define _SWFDEC_FILE_LOADER_H_
+
+#include "swfdec_loader.h"
+#include "swfdec_loadertarget.h"
+
+G_BEGIN_DECLS
+
+typedef struct _SwfdecFileLoader SwfdecFileLoader;
+typedef struct _SwfdecFileLoaderClass SwfdecFileLoaderClass;
+
+#define SWFDEC_TYPE_FILE_LOADER                    (swfdec_file_loader_get_type())
+#define SWFDEC_IS_FILE_LOADER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_FILE_LOADER))
+#define SWFDEC_IS_FILE_LOADER_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_FILE_LOADER))
+#define SWFDEC_FILE_LOADER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_FILE_LOADER, SwfdecFileLoader))
+#define SWFDEC_FILE_LOADER_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_FILE_LOADER, SwfdecFileLoaderClass))
+#define SWFDEC_FILE_LOADER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_FILE_LOADER, SwfdecFileLoaderClass))
+
+struct _SwfdecFileLoader
+{
+  SwfdecLoader		loader;
+};
+
+struct _SwfdecFileLoaderClass
+{
+  SwfdecLoaderClass   	loader_class;
+};
+
+GType		swfdec_file_loader_get_type	(void);
+
+SwfdecLoader *	swfdec_file_loader_new		(const char *	filename);
+
+#endif /* _SWFDEC_FILE_LOADER_H_ */
diff-tree de83e4b08aba8b934c0ea54eefc475642259c6d5 (from 23c4af4dbe061bee791bc54035cd0274611d02ec)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 1 20:29:17 2007 +0200

    fix docs - protected values aren't mentioned in gtk-doc

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index ec00ec2..2931172 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -51,9 +51,6 @@
 
 /**
  * SwfdecAsObject:
- * @object: do not access
- * @context: the context the object was added to or %NULL if it has not yet been
- *           added. Read-only.
  *
  * Every object value inside the Swfdec script engine must be a SwfdecAsObject.
  * If you want to add custom objects to your script engine, you need to create a
diff --git a/libswfdec/swfdec_as_object.h b/libswfdec/swfdec_as_object.h
index 04deb10..f82cd9c 100644
--- a/libswfdec/swfdec_as_object.h
+++ b/libswfdec/swfdec_as_object.h
@@ -46,9 +46,8 @@ typedef gboolean (* SwfdecAsVariableFore
 #define SWFDEC_AS_OBJECT_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_OBJECT, SwfdecAsObjectClass))
 
 struct _SwfdecAsObject {
-  GObject		object;
-
   /*< protected >*/
+  GObject		object;
   SwfdecAsContext *	context;	/* context the object belongs to */
   /*< private >*/
   SwfdecAsObject *	prototype;	/* prototype object (referred to as __proto__) */
diff-tree 23c4af4dbe061bee791bc54035cd0274611d02ec (from e8f224d82464181f93c34440774e657a599539f9)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 1 19:39:48 2007 +0200

    export the file loader so subclassing gets possible

diff --git a/libswfdec/Makefile.am b/libswfdec/Makefile.am
index 2476e54..f1973eb 100644
--- a/libswfdec/Makefile.am
+++ b/libswfdec/Makefile.am
@@ -65,6 +65,7 @@ libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES
 	swfdec_edittext_movie.c \
 	swfdec_enums.c \
 	swfdec_event.c \
+	swfdec_file_loader.c \
 	swfdec_flv_decoder.c \
 	swfdec_font.c \
 	swfdec_graphic.c \
@@ -128,6 +129,7 @@ public_headers = \
 	swfdec_as_types.h \
 	swfdec_audio.h \
 	swfdec_buffer.h \
+	swfdec_file_loader.h \
 	swfdec_loader.h \
 	swfdec_player.h \
 	swfdec_url.h
diff --git a/libswfdec/swfdec.h b/libswfdec/swfdec.h
index 5e3055a..d49dc69 100644
--- a/libswfdec/swfdec.h
+++ b/libswfdec/swfdec.h
@@ -30,6 +30,7 @@
 #include <libswfdec/swfdec_audio.h>
 #include <libswfdec/swfdec_buffer.h>
 #include <libswfdec/swfdec_enums.h>
+#include <libswfdec/swfdec_file_loader.h>
 #include <libswfdec/swfdec_loader.h>
 #include <libswfdec/swfdec_player.h>
 #include <libswfdec/swfdec_url.h>
diff --git a/libswfdec/swfdec_loader.c b/libswfdec/swfdec_loader.c
index cddbe10..aba9990 100644
--- a/libswfdec/swfdec_loader.c
+++ b/libswfdec/swfdec_loader.c
@@ -189,56 +189,6 @@ swfdec_loader_init (SwfdecLoader *loader
   loader->data_type = SWFDEC_LOADER_DATA_UNKNOWN;
 }
 
-/*** SwfdecFileLoader ***/
-
-G_DEFINE_TYPE (SwfdecFileLoader, swfdec_file_loader, SWFDEC_TYPE_LOADER)
-
-static void
-swfdec_file_loader_load (SwfdecLoader *loader, SwfdecLoaderRequest request, 
-    const char *data, gsize data_len)
-{
-  const SwfdecURL *url;
-  SwfdecBuffer *buffer;
-  GError *error = NULL;
-  char *real;
-
-  url = swfdec_loader_get_url (loader);
-  if (!g_str_equal (swfdec_url_get_protocol (url), "file")) {
-    swfdec_loader_error (loader, "Don't know how to handle other protocols than file");
-    return;
-  }
-  if (swfdec_url_get_host (url)) {
-    swfdec_loader_error (loader, "filenames cannot have hostnames");
-    return;
-  }
-
-  /* FIXME: append query string here? */
-  real = g_strconcat ("/", swfdec_url_get_path (url), NULL);
-  buffer = swfdec_buffer_new_from_file (real, &error);
-  if (buffer == NULL) {
-    swfdec_loader_error (loader, error->message);
-    g_error_free (error);
-  } else {
-    swfdec_loader_set_size (loader, buffer->length);
-    swfdec_loader_open (loader, 0);
-    swfdec_loader_push (loader, buffer);
-    swfdec_loader_eof (loader);
-  }
-}
-
-static void
-swfdec_file_loader_class_init (SwfdecFileLoaderClass *klass)
-{
-  SwfdecLoaderClass *loader_class = SWFDEC_LOADER_CLASS (klass);
-
-  loader_class->load = swfdec_file_loader_load;
-}
-
-static void
-swfdec_file_loader_init (SwfdecFileLoader *loader)
-{
-}
-
 /*** INTERNAL API ***/
 
 static void
@@ -342,58 +292,6 @@ swfdec_loader_set_target (SwfdecLoader *
 /** PUBLIC API ***/
 
 /**
- * swfdec_loader_new_from_file:
- * @filename: name of the file to load
- *
- * Creates a new loader for local files. If an error occurred, the loader will
- * be in error.
- *
- * Returns: a new loader
- **/
-SwfdecLoader *
-swfdec_loader_new_from_file (const char *filename)
-{
-  SwfdecBuffer *buf;
-  SwfdecLoader *loader;
-  GError *error = NULL;
-  char *url;
-
-  g_return_val_if_fail (filename != NULL, NULL);
-
-  buf = swfdec_buffer_new_from_file (filename, &error);
-
-  if (g_path_is_absolute (filename)) {
-    url = g_strconcat ("file://", filename, NULL);
-  } else {
-    char *abs, *cur;
-    cur = g_get_current_dir ();
-    abs = g_build_filename (cur, filename, NULL);
-    g_free (cur);
-    url = g_strconcat ("file://", abs, NULL);
-    g_free (abs);
-  }
-
-  loader = g_object_new (SWFDEC_TYPE_FILE_LOADER, NULL);
-  loader->url = swfdec_url_new (url);
-  if (loader->url == NULL) {
-    g_warning ("WTF? %s is not a valid url!", url);
-    loader->url = swfdec_url_new ("file:///");
-  }
-  g_assert (loader->url);
-  g_free (url);
-  if (buf == NULL) {
-    swfdec_loader_error (loader, error->message);
-    g_error_free (error);
-  } else {
-    swfdec_loader_set_size (loader, buf->length);
-    swfdec_loader_open (loader, 0);
-    swfdec_loader_push (loader, buf);
-    swfdec_loader_eof (loader);
-  }
-  return loader;
-}
-
-/**
  * swfdec_loader_error:
  * @loader: a #SwfdecLoader
  * @error: a string describing the error
diff --git a/libswfdec/swfdec_loader.h b/libswfdec/swfdec_loader.h
index 6bed2d2..73c54ad 100644
--- a/libswfdec/swfdec_loader.h
+++ b/libswfdec/swfdec_loader.h
@@ -80,8 +80,6 @@ struct _SwfdecLoaderClass
 
 GType		swfdec_loader_get_type		(void);
 
-SwfdecLoader *	swfdec_loader_new_from_file	(const char *	 	filename);
-
 void		swfdec_loader_open		(SwfdecLoader *		loader,
 						 guint			status);
 void		swfdec_loader_push		(SwfdecLoader *		loader,
diff --git a/libswfdec/swfdec_loader_internal.h b/libswfdec/swfdec_loader_internal.h
index a6a477f..fb851bd 100644
--- a/libswfdec/swfdec_loader_internal.h
+++ b/libswfdec/swfdec_loader_internal.h
@@ -33,28 +33,6 @@ typedef enum {
   SWFDEC_LOADER_STATE_ERROR		/* loader is in error state */
 } SwfdecLoaderState;
 
-typedef struct _SwfdecFileLoader SwfdecFileLoader;
-typedef struct _SwfdecFileLoaderClass SwfdecFileLoaderClass;
-
-#define SWFDEC_TYPE_FILE_LOADER                    (swfdec_file_loader_get_type())
-#define SWFDEC_IS_FILE_LOADER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_FILE_LOADER))
-#define SWFDEC_IS_FILE_LOADER_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_FILE_LOADER))
-#define SWFDEC_FILE_LOADER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_FILE_LOADER, SwfdecFileLoader))
-#define SWFDEC_FILE_LOADER_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_FILE_LOADER, SwfdecFileLoaderClass))
-#define SWFDEC_FILE_LOADER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_FILE_LOADER, SwfdecFileLoaderClass))
-
-struct _SwfdecFileLoader
-{
-  SwfdecLoader		loader;
-};
-
-struct _SwfdecFileLoaderClass
-{
-  SwfdecLoaderClass   	loader_class;
-};
-
-GType			swfdec_file_loader_get_type	(void);
-
 SwfdecLoader *		swfdec_loader_load		(SwfdecLoader *		loader,
 							 const char *		url,
 							 SwfdecLoaderRequest	request,
diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c
index ab9d34a..8b497da 100644
--- a/libswfdec/swfdec_player.c
+++ b/libswfdec/swfdec_player.c
@@ -1551,7 +1551,7 @@ swfdec_player_new_from_file (const char 
 
   g_return_val_if_fail (filename != NULL, NULL);
 
-  loader = swfdec_loader_new_from_file (filename);
+  loader = swfdec_file_loader_new (filename);
   player = swfdec_player_new ();
   swfdec_player_set_loader (player, loader);
 
diff --git a/player/swfdebug.c b/player/swfdebug.c
index 5c759db..fbae7ac 100644
--- a/player/swfdebug.c
+++ b/player/swfdebug.c
@@ -404,7 +404,7 @@ main (int argc, char *argv[])
     return 1;
   }
 
-  loader = swfdec_loader_new_from_file (argv[1]);
+  loader = swfdec_file_loader_new (argv[1]);
   if (loader->error) {
     g_printerr ("Couldn't open file \"%s\": %s\n", argv[1], loader->error);
     g_object_unref (loader);
diff --git a/test/image/image.c b/test/image/image.c
index a50664e..70e6f43 100644
--- a/test/image/image.c
+++ b/test/image/image.c
@@ -161,7 +161,7 @@ run_test (const char *filename)
 
   g_print ("Testing %s:\n", filename);
 
-  loader = swfdec_loader_new_from_file (filename);
+  loader = swfdec_file_loader_new (filename);
   if (loader->error) {
     g_print ("  ERROR: %s\n", loader->error);
     g_object_unref (loader);
diff --git a/test/sound/sound.c b/test/sound/sound.c
index 9624a4a..c962453 100644
--- a/test/sound/sound.c
+++ b/test/sound/sound.c
@@ -200,7 +200,7 @@ run_test (const char *filename)
   g_free (dirname);
   g_free (basename);
 
-  loader = swfdec_loader_new_from_file (filename);
+  loader = swfdec_file_loader_new (filename);
   if (loader->error) {
     g_print ("  ERROR: %s\n", loader->error);
     g_object_unref (loader);
diff --git a/test/trace/trace.c b/test/trace/trace.c
index 832fe1b..0f986e5 100644
--- a/test/trace/trace.c
+++ b/test/trace/trace.c
@@ -94,7 +94,7 @@ run_test (gpointer testp, gpointer unuse
 
   output = g_string_new ("");
   g_string_append_printf (output, "Testing %s:\n", test->filename);
-  loader = swfdec_loader_new_from_file (test->filename);
+  loader = swfdec_file_loader_new (test->filename);
   if (loader->error) {
     g_string_append_printf (output, "  ERROR: %s\n", loader->error);
     goto fail;
diff-tree e8f224d82464181f93c34440774e657a599539f9 (from f45062b4332d3e44688fdf00bed92d5ebcf5d2da)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 1 19:07:19 2007 +0200

    we want HTTP_CFLAGS and HTTP_LIBS here

diff --git a/libswfdec-gtk/Makefile.am b/libswfdec-gtk/Makefile.am
index ac8e912..bec8353 100644
--- a/libswfdec-gtk/Makefile.am
+++ b/libswfdec-gtk/Makefile.am
@@ -23,12 +23,12 @@ noinst_HEADERS = \
 
 libswfdec_gtk_ at SWFDEC_MAJORMINOR@_la_CFLAGS = \
 	-I$(top_srcdir) $(js_cflags) $(GLOBAL_CFLAGS) $(SWFDEC_CFLAGS) $(GTK_CFLAGS) \
-	$(AUDIO_CFLAGS) $(GNOMEVFS_CFLAGS) \
+	$(AUDIO_CFLAGS) $(HTTP_CFLAGS) \
 	-DG_LOG_DOMAIN=\"Swfdec-Gtk\" -DXP_UNIX
 libswfdec_gtk_ at SWFDEC_MAJORMINOR@_la_LDFLAGS = \
 	-version-info $(SWFDEC_LIBVERSION) \
 	-export-symbols-regex '^(swfdec_.*)' \
-	$(GTK_LIBS) $(SWFDEC_LIBS) $(AUDIO_LIBS) $(GNOMEVFS_LIBS)
+	$(GTK_LIBS) $(SWFDEC_LIBS) $(AUDIO_LIBS) $(HTTP_LIBS)
 libswfdec_ at SWFDEC_MAJORMINOR@includedir = $(includedir)/swfdec- at SWFDEC_MAJORMINOR@/libswfdec-gtk
 libswfdec_ at SWFDEC_MAJORMINOR@include_HEADERS = \
 	swfdec-gtk.h \
diff-tree f45062b4332d3e44688fdf00bed92d5ebcf5d2da (from e24deaade92d1c0b55dd2fda9c422a9759e2aa18)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 1 19:06:40 2007 +0200

    s/HAVE_GNOMEVFS/HAVE_HTTP/

diff --git a/configure.ac b/configure.ac
index 79461a2..e2336c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,16 +253,16 @@ AC_ARG_ENABLE(gnome-vfs,
 	enable_gnomevfs="yes")
 
 if test "$enable_gnomevfs" = "yes"; then
-	PKG_CHECK_MODULES(GNOMEVFS, gnome-vfs-2.0 >= 2.14.0, HAVE_GNOMEVFS=yes, HAVE_GNOMEVFS=no)
-	if test "x$HAVE_GNOMEVFS" = xyes; then
-	  AC_DEFINE(HAVE_GNOMEVFS, 1, [Define if gnome-vfs is enabled])
+	PKG_CHECK_MODULES(HTTP, gnome-vfs-2.0 >= 2.14.0, HAVE_HTTP=yes, HAVE_HTTP=no)
+	if test "x$HAVE_HTTP" = xyes; then
+	  AC_DEFINE(HAVE_HTTP, 1, [Define if gnome-vfs is enabled])
 	else
 	  AC_MSG_ERROR([Couldn't find gnome-vfs-2.0.])
 	fi
 else
 	AC_MSG_WARN([*** gnome-vfs support was not enabled. ***])
 fi
-AM_CONDITIONAL(HAVE_GNOMEVFS, [test "x$HAVE_GNOMEVFS" = xyes])
+AM_CONDITIONAL(HAVE_HTTP, [test "x$HAVE_HTTP" = xyes])
 
 AC_SUBST(GLOBAL_CFLAGS)
 AC_SUBST(GLOBAL_CFLAGS)
diff --git a/libswfdec-gtk/swfdec_gtk_loader.c b/libswfdec-gtk/swfdec_gtk_loader.c
index d506537..73fa0fa 100644
--- a/libswfdec-gtk/swfdec_gtk_loader.c
+++ b/libswfdec-gtk/swfdec_gtk_loader.c
@@ -45,7 +45,7 @@
  * backends, it is completely private.
  */
 
-#ifndef HAVE_GNOMEVFS
+#ifndef HAVE_HTTP
 
 #include <libswfdec/swfdec_loader_internal.h>
 
@@ -64,7 +64,7 @@ swfdec_gtk_loader_new (const char *uri)
 }
 
 
-#else /* HAVE_GNOMEVFS */
+#else /* HAVE_HTTP */
 
 /* size of buffer we read */
 #define BUFFER_SIZE 4096


More information about the Swfdec mailing list