[Swfdec-commits] 10 commits - configure.ac m4/as-compiler-flag.m4 swfdec/Makefile.am swfdec/swfdec_audio_decoder_adpcm.c swfdec/swfdec_audio_decoder.c swfdec/swfdec_audio_decoder_gst.c swfdec/swfdec_audio_decoder_gst.h swfdec/swfdec_audio_decoder.h swfdec/swfdec_audio_decoder_uncompressed.c swfdec/swfdec_bots.h swfdec/swfdec_movie.c swfdec/swfdec_player.c swfdec/swfdec_resource.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Fri Jun 6 13:19:36 PDT 2008


 configure.ac                               |   10 --
 m4/as-compiler-flag.m4                     |   33 +++++-
 swfdec/Makefile.am                         |    1 
 swfdec/swfdec_audio_decoder.c              |   57 +++--------
 swfdec/swfdec_audio_decoder.h              |   10 ++
 swfdec/swfdec_audio_decoder_adpcm.c        |   17 +++
 swfdec/swfdec_audio_decoder_gst.c          |  142 ++++++++++++++---------------
 swfdec/swfdec_audio_decoder_gst.h          |    6 -
 swfdec/swfdec_audio_decoder_uncompressed.c |   19 +++
 swfdec/swfdec_bots.h                       |    4 
 swfdec/swfdec_movie.c                      |    7 +
 swfdec/swfdec_player.c                     |   49 ----------
 swfdec/swfdec_resource.c                   |    8 +
 test/trace/Makefile.am                     |    9 +
 test/trace/resolve-parent-5.swf            |binary
 test/trace/resolve-parent-5.swf.trace      |    2 
 test/trace/resolve-parent-6.swf            |binary
 test/trace/resolve-parent-6.swf.trace      |    2 
 test/trace/resolve-parent-7.swf            |binary
 test/trace/resolve-parent-7.swf.trace      |    2 
 test/trace/resolve-parent-8.swf            |binary
 test/trace/resolve-parent-8.swf.trace      |    2 
 test/trace/resolve-parent.as               |   12 ++
 23 files changed, 209 insertions(+), 183 deletions(-)

New commits:
commit c4a2ce227e78793647be30ae37a09a707120e764
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 22:17:40 2008 +0200

    move audio decoders closer to an expoted API for plugging new decoders

diff --git a/swfdec/Makefile.am b/swfdec/Makefile.am
index b887678..6c8f5c1 100644
--- a/swfdec/Makefile.am
+++ b/swfdec/Makefile.am
@@ -88,6 +88,7 @@ libswfdec_source_files = \
 	swfdec_graphic_movie.c \
 	swfdec_image.c \
 	swfdec_image_decoder.c \
+	swfdec_init.c \
 	swfdec_interval.c \
 	swfdec_key_as.c \
 	swfdec_load_object.c \
diff --git a/swfdec/swfdec_audio_decoder.c b/swfdec/swfdec_audio_decoder.c
index eee4ecc..e969d27 100644
--- a/swfdec/swfdec_audio_decoder.c
+++ b/swfdec/swfdec_audio_decoder.c
@@ -22,9 +22,6 @@
 #endif
 
 #include "swfdec_audio_decoder.h"
-#include "swfdec_audio_decoder_adpcm.h"
-#include "swfdec_audio_decoder_gst.h"
-#include "swfdec_audio_decoder_uncompressed.h"
 #include "swfdec_debug.h"
 #include "swfdec_internal.h"
 
@@ -40,51 +37,30 @@ swfdec_audio_decoder_init (SwfdecAudioDecoder *audio_decoder)
 {
 }
 
-static SwfdecAudioDecoder *
-swfdec_audio_decoder_builtin_new (guint codec, SwfdecAudioFormat format)
-{
-  switch (codec) {
-    case SWFDEC_AUDIO_CODEC_UNDEFINED:
-    case SWFDEC_AUDIO_CODEC_UNCOMPRESSED:
-      return g_object_new (SWFDEC_TYPE_AUDIO_DECODER_UNCOMPRESSED, NULL);
-    case SWFDEC_AUDIO_CODEC_ADPCM:
-      return g_object_new (SWFDEC_TYPE_AUDIO_DECODER_ADPCM, NULL);
-    default:
-      return NULL;
-  }
-}
+static GSList *audio_codecs = NULL;
 
-static gboolean
-swfdec_audio_decoder_builtin_prepare (guint codec, SwfdecAudioFormat format, char **detail)
+void
+swfdec_audio_decoder_register (GType type)
 {
-  return codec == SWFDEC_AUDIO_CODEC_UNCOMPRESSED ||
-    codec == SWFDEC_AUDIO_CODEC_UNDEFINED ||
-    codec == SWFDEC_AUDIO_CODEC_ADPCM;
-}
+  g_return_if_fail (g_type_is_a (type, SWFDEC_TYPE_AUDIO_DECODER));
 
-static const struct {
-  const char *		name;
-  SwfdecAudioDecoder *	(* func) (guint, SwfdecAudioFormat);
-  gboolean		(* prepare) (guint, SwfdecAudioFormat, char **);
-} audio_codecs[] = {
-  { "builtin",	swfdec_audio_decoder_builtin_new, swfdec_audio_decoder_builtin_prepare },
-#ifdef HAVE_GST
-  { "gst",	swfdec_audio_decoder_gst_new, swfdec_audio_decoder_gst_prepare },
-#endif
-};
+  audio_codecs = g_slist_append (audio_codecs, GSIZE_TO_POINTER ((gsize) type));
+}
 
 gboolean
 swfdec_audio_decoder_prepare (guint codec, SwfdecAudioFormat format, char **missing)
 {
   char *detail = NULL, *s = NULL;
-  guint i;
+  GSList *walk;
   
-  for (i = 0; i < G_N_ELEMENTS (audio_codecs); i++) {
-    if (audio_codecs[i].prepare (codec, format, &s)) {
+  for (walk = audio_codecs; walk; walk = walk->next) {
+    SwfdecAudioDecoderClass *klass = g_type_class_ref (GPOINTER_TO_SIZE (walk->data));
+    if (klass->prepare (codec, format, &s)) {
       g_free (detail);
       g_free (s);
       if (missing)
 	*missing = NULL;
+      g_type_class_unref (klass);
       return TRUE;
     }
     if (s) {
@@ -94,6 +70,7 @@ swfdec_audio_decoder_prepare (guint codec, SwfdecAudioFormat format, char **miss
 	g_free (s);
       s = NULL;
     }
+    g_type_class_unref (klass);
   }
   if (missing)
     *missing = detail;
@@ -113,12 +90,14 @@ SwfdecAudioDecoder *
 swfdec_audio_decoder_new (guint codec, SwfdecAudioFormat format)
 {
   SwfdecAudioDecoder *ret;
-  guint i;
-
+  GSList *walk;
+  
   g_return_val_if_fail (SWFDEC_IS_AUDIO_FORMAT (format), NULL);
 
-  for (i = 0; i < G_N_ELEMENTS (audio_codecs); i++) {
-    ret = audio_codecs[i].func (codec, format);
+  for (walk = audio_codecs; walk; walk = walk->next) {
+    SwfdecAudioDecoderClass *klass = g_type_class_ref (GPOINTER_TO_SIZE (walk->data));
+    ret = klass->create (codec, format);
+    g_type_class_unref (klass);
     if (ret)
       break;
   }
diff --git a/swfdec/swfdec_audio_decoder.h b/swfdec/swfdec_audio_decoder.h
index 3f4363a..24e52f5 100644
--- a/swfdec/swfdec_audio_decoder.h
+++ b/swfdec/swfdec_audio_decoder.h
@@ -56,8 +56,16 @@ struct _SwfdecAudioDecoder
 
 struct _SwfdecAudioDecoderClass
 {
+  /*< private >*/
   GObjectClass		object_class;
 
+  /*< public >*/
+  gboolean		(* prepare)	(guint                  codec,
+                                         SwfdecAudioFormat      format,
+					 char **                missing);
+  SwfdecAudioDecoder *	(* create)	(guint                  codec,
+					 SwfdecAudioFormat      format);
+
   void			(* push)	(SwfdecAudioDecoder *	decoder,
 					 SwfdecBuffer *		buffer);
   SwfdecBuffer *	(* pull)	(SwfdecAudioDecoder *	decoder);
@@ -65,6 +73,8 @@ struct _SwfdecAudioDecoderClass
 
 GType			swfdec_audio_decoder_get_type	(void);
 
+void			swfdec_audio_decoder_register	(GType			type);
+
 gboolean		swfdec_audio_decoder_prepare	(guint			codec,
 							 SwfdecAudioFormat	format,
 							 char **		missing);
diff --git a/swfdec/swfdec_audio_decoder_adpcm.c b/swfdec/swfdec_audio_decoder_adpcm.c
index 257fb23..18eaab1 100644
--- a/swfdec/swfdec_audio_decoder_adpcm.c
+++ b/swfdec/swfdec_audio_decoder_adpcm.c
@@ -27,6 +27,21 @@
 
 G_DEFINE_TYPE (SwfdecAudioDecoderAdpcm, swfdec_audio_decoder_adpcm, SWFDEC_TYPE_AUDIO_DECODER)
 
+static gboolean
+swfdec_audio_decoder_adpcm_prepare (guint codec, SwfdecAudioFormat format, char **missing)
+{
+  return codec == SWFDEC_AUDIO_CODEC_ADPCM;
+}
+
+static SwfdecAudioDecoder *
+swfdec_audio_decoder_adpcm_create (guint codec, SwfdecAudioFormat format)
+{
+  if (codec != SWFDEC_AUDIO_CODEC_ADPCM)
+    return NULL;
+
+  return g_object_new (SWFDEC_TYPE_AUDIO_DECODER_ADPCM, NULL);
+}
+
 static const int indexTable[4][16] = {
   { -1, 2 },
   { -1, -1, 2, 4 },
@@ -188,6 +203,8 @@ swfdec_audio_decoder_adpcm_class_init (SwfdecAudioDecoderAdpcmClass *klass)
 
   object_class->dispose = swfdec_audio_decoder_adpcm_dispose;
 
+  decoder_class->prepare = swfdec_audio_decoder_adpcm_prepare;
+  decoder_class->create = swfdec_audio_decoder_adpcm_create;
   decoder_class->pull = swfdec_audio_decoder_adpcm_pull;
   decoder_class->push = swfdec_audio_decoder_adpcm_push;
 }
diff --git a/swfdec/swfdec_audio_decoder_gst.c b/swfdec/swfdec_audio_decoder_gst.c
index 73f4d06..ea343fa 100644
--- a/swfdec/swfdec_audio_decoder_gst.c
+++ b/swfdec/swfdec_audio_decoder_gst.c
@@ -59,59 +59,28 @@ swfdec_audio_decoder_get_caps (guint codec, SwfdecAudioFormat format)
 
 G_DEFINE_TYPE (SwfdecAudioDecoderGst, swfdec_audio_decoder_gst, SWFDEC_TYPE_AUDIO_DECODER)
 
-static void
-swfdec_audio_decoder_gst_push (SwfdecAudioDecoder *dec, SwfdecBuffer *buffer)
-{
-  SwfdecAudioDecoderGst *player = SWFDEC_AUDIO_DECODER_GST (dec);
-  GstBuffer *buf;
-
-  if (buffer == NULL) {
-    swfdec_gst_decoder_push_eos (&player->dec);
-  } else {
-    swfdec_buffer_ref (buffer);
-    buf = swfdec_gst_buffer_new (buffer);
-    if (!swfdec_gst_decoder_push (&player->dec, buf))
-      swfdec_audio_decoder_error (dec, "error pushing");
-  }
-}
-
-static SwfdecBuffer *
-swfdec_audio_decoder_gst_pull (SwfdecAudioDecoder *dec)
-{
-  SwfdecAudioDecoderGst *player = SWFDEC_AUDIO_DECODER_GST (dec);
-  GstBuffer *buf;
-
-  buf = swfdec_gst_decoder_pull (&player->dec);
-  if (buf == NULL)
-    return NULL;
-  return swfdec_buffer_new_from_gst (buf);
-}
-
-static void
-swfdec_audio_decoder_gst_dispose (GObject *object)
-{
-  SwfdecAudioDecoderGst *player = (SwfdecAudioDecoderGst *) object;
-
-  swfdec_gst_decoder_finish (&player->dec);
-
-  G_OBJECT_CLASS (swfdec_audio_decoder_gst_parent_class)->dispose (object);
-}
-
-static void
-swfdec_audio_decoder_gst_class_init (SwfdecAudioDecoderGstClass *klass)
+static gboolean
+swfdec_audio_decoder_gst_prepare (guint codec, SwfdecAudioFormat format, char **detail)
 {
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  SwfdecAudioDecoderClass *decoder_class = SWFDEC_AUDIO_DECODER_CLASS (klass);
+  GstElementFactory *factory;
+  GstCaps *caps;
 
-  object_class->dispose = swfdec_audio_decoder_gst_dispose;
+  /* Check if we can handle the format at all. If not, no plugin will help us. */
+  caps = swfdec_audio_decoder_get_caps (codec, format);
+  if (caps == NULL)
+    return FALSE;
 
-  decoder_class->pull = swfdec_audio_decoder_gst_pull;
-  decoder_class->push = swfdec_audio_decoder_gst_push;
-}
+  /* If we can already handle it, woohoo! */
+  factory = swfdec_gst_get_element_factory (caps);
+  if (factory != NULL) {
+    gst_object_unref (factory);
+    return TRUE;
+  }
 
-static void
-swfdec_audio_decoder_gst_init (SwfdecAudioDecoderGst *audio_decoder_gst)
-{
+  /* need to install plugins... */
+  *detail = gst_missing_decoder_installer_detail_new (caps);
+  gst_caps_unref (caps);
+  return FALSE;
 }
 
 static const char *
@@ -137,8 +106,8 @@ swfdec_audio_decoder_get_resampler (void)
   return NULL;
 }
 
-SwfdecAudioDecoder *
-swfdec_audio_decoder_gst_new (guint type, SwfdecAudioFormat format)
+static SwfdecAudioDecoder *
+swfdec_audio_decoder_gst_create (guint type, SwfdecAudioFormat format)
 {
   SwfdecAudioDecoderGst *player;
   GstCaps *srccaps, *sinkcaps;
@@ -171,29 +140,60 @@ error:
   return NULL;
 }
 
-/*** MISSING PLUGIN SUPPORT ***/
-  
-gboolean
-swfdec_audio_decoder_gst_prepare (guint codec, SwfdecAudioFormat format, char **detail)
+static void
+swfdec_audio_decoder_gst_push (SwfdecAudioDecoder *dec, SwfdecBuffer *buffer)
 {
-  GstElementFactory *factory;
-  GstCaps *caps;
-
-  /* Check if we can handle the format at all. If not, no plugin will help us. */
-  caps = swfdec_audio_decoder_get_caps (codec, format);
-  if (caps == NULL)
-    return FALSE;
+  SwfdecAudioDecoderGst *player = SWFDEC_AUDIO_DECODER_GST (dec);
+  GstBuffer *buf;
 
-  /* If we can already handle it, woohoo! */
-  factory = swfdec_gst_get_element_factory (caps);
-  if (factory != NULL) {
-    gst_object_unref (factory);
-    return TRUE;
+  if (buffer == NULL) {
+    swfdec_gst_decoder_push_eos (&player->dec);
+  } else {
+    swfdec_buffer_ref (buffer);
+    buf = swfdec_gst_buffer_new (buffer);
+    if (!swfdec_gst_decoder_push (&player->dec, buf))
+      swfdec_audio_decoder_error (dec, "error pushing");
   }
+}
 
-  /* need to install plugins... */
-  *detail = gst_missing_decoder_installer_detail_new (caps);
-  gst_caps_unref (caps);
-  return FALSE;
+static SwfdecBuffer *
+swfdec_audio_decoder_gst_pull (SwfdecAudioDecoder *dec)
+{
+  SwfdecAudioDecoderGst *player = SWFDEC_AUDIO_DECODER_GST (dec);
+  GstBuffer *buf;
+
+  buf = swfdec_gst_decoder_pull (&player->dec);
+  if (buf == NULL)
+    return NULL;
+  return swfdec_buffer_new_from_gst (buf);
+}
+
+static void
+swfdec_audio_decoder_gst_dispose (GObject *object)
+{
+  SwfdecAudioDecoderGst *player = (SwfdecAudioDecoderGst *) object;
+
+  swfdec_gst_decoder_finish (&player->dec);
+
+  G_OBJECT_CLASS (swfdec_audio_decoder_gst_parent_class)->dispose (object);
+}
+
+static void
+swfdec_audio_decoder_gst_class_init (SwfdecAudioDecoderGstClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  SwfdecAudioDecoderClass *decoder_class = SWFDEC_AUDIO_DECODER_CLASS (klass);
+
+  object_class->dispose = swfdec_audio_decoder_gst_dispose;
+
+  decoder_class->prepare = swfdec_audio_decoder_gst_prepare;
+  decoder_class->create = swfdec_audio_decoder_gst_create;
+  decoder_class->pull = swfdec_audio_decoder_gst_pull;
+  decoder_class->push = swfdec_audio_decoder_gst_push;
+}
+
+static void
+swfdec_audio_decoder_gst_init (SwfdecAudioDecoderGst *audio_decoder_gst)
+{
 }
 
diff --git a/swfdec/swfdec_audio_decoder_gst.h b/swfdec/swfdec_audio_decoder_gst.h
index 18fd146..3354cc6 100644
--- a/swfdec/swfdec_audio_decoder_gst.h
+++ b/swfdec/swfdec_audio_decoder_gst.h
@@ -50,12 +50,6 @@ struct _SwfdecAudioDecoderGstClass
 
 GType			swfdec_audio_decoder_gst_get_type	(void);
 
-SwfdecAudioDecoder *	swfdec_audio_decoder_gst_new		(guint			codec, 
-								 SwfdecAudioFormat	format);
-gboolean		swfdec_audio_decoder_gst_prepare	(guint			codec,
-								 SwfdecAudioFormat	format,
-								 char **		missing);
-
 
 G_END_DECLS
 #endif
diff --git a/swfdec/swfdec_audio_decoder_uncompressed.c b/swfdec/swfdec_audio_decoder_uncompressed.c
index b9be106..6681f2a 100644
--- a/swfdec/swfdec_audio_decoder_uncompressed.c
+++ b/swfdec/swfdec_audio_decoder_uncompressed.c
@@ -27,6 +27,23 @@
 
 G_DEFINE_TYPE (SwfdecAudioDecoderUncompressed, swfdec_audio_decoder_uncompressed, SWFDEC_TYPE_AUDIO_DECODER)
 
+static gboolean
+swfdec_audio_decoder_uncompressed_prepare (guint codec, SwfdecAudioFormat format, char **missing)
+{
+  return codec == SWFDEC_AUDIO_CODEC_UNDEFINED ||
+      codec == SWFDEC_AUDIO_CODEC_UNCOMPRESSED;
+}
+
+static SwfdecAudioDecoder *
+swfdec_audio_decoder_uncompressed_create (guint codec, SwfdecAudioFormat format)
+{
+  if (codec != SWFDEC_AUDIO_CODEC_UNDEFINED &&
+      codec != SWFDEC_AUDIO_CODEC_UNCOMPRESSED)
+    return NULL;
+
+  return g_object_new (SWFDEC_TYPE_AUDIO_DECODER_UNCOMPRESSED, NULL);
+}
+
 static SwfdecBuffer *
 swfdec_audio_decoder_uncompressed_upscale (SwfdecBuffer *buffer, SwfdecAudioFormat format)
 {
@@ -134,6 +151,8 @@ swfdec_audio_decoder_uncompressed_class_init (SwfdecAudioDecoderUncompressedClas
 
   object_class->dispose = swfdec_audio_decoder_uncompressed_dispose;
 
+  decoder_class->prepare = swfdec_audio_decoder_uncompressed_prepare;
+  decoder_class->create = swfdec_audio_decoder_uncompressed_create;
   decoder_class->pull = swfdec_audio_decoder_uncompressed_pull;
   decoder_class->push = swfdec_audio_decoder_uncompressed_push;
 }
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index e5deee0..4e29909 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -1,5 +1,5 @@
 /* Swfdec
- * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
+ * Copyright (C) 2006-2008 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
@@ -22,14 +22,9 @@
 #endif
 
 #include <errno.h>
-#ifdef HAVE_GST
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-#endif
 #include <math.h>
 #include <string.h>
 #include <stdlib.h>
-#include <liboil/liboil.h>
 
 #include "swfdec_player_internal.h"
 #include "swfdec_as_frame_internal.h"
@@ -2836,43 +2831,6 @@ swfdec_player_new (SwfdecAsDebugger *debugger)
 }
 
 /**
- * swfdec_init:
- *
- * Initializes the Swfdec library.
- **/
-void
-swfdec_init (void)
-{
-  static gboolean _inited = FALSE;
-  const char *s;
-
-  if (_inited)
-    return;
-
-  _inited = TRUE;
-
-  if (!g_thread_supported ())
-    g_thread_init (NULL);
-  g_type_init ();
-  oil_init ();
-#ifdef HAVE_GST
-  gst_init (NULL, NULL);
-  gst_pb_utils_init ();
-#endif
-
-  s = g_getenv ("SWFDEC_DEBUG");
-  if (s && s[0]) {
-    char *end;
-    int level;
-
-    level = strtoul (s, &end, 0);
-    if (end[0] == 0) {
-      swfdec_debug_set_level (level);
-    }
-  }
-}
-
-/**
  * swfdec_player_mouse_move:
  * @player: a #SwfdecPlayer
  * @x: x coordinate of mouse
commit b27a9aad5255fbcfafa2b1b65e5df283252dc5b3
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 22:17:31 2008 +0200

    resolve parent

diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 15d4656..95f622a 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -119,10 +119,12 @@ swfdec_resource_emit_signal (SwfdecResource *resource, const char *name, gboolea
     return;
   cx = SWFDEC_AS_OBJECT (resource->clip_loader)->context;
   /* This feels wrong. Why do we resolve here by real name? */
-  if (resource->target)
-    movie = swfdec_movie_get_by_name (resource->target->parent, resource->target->name, FALSE);
-  else
+  if (resource->target) {
+    SwfdecMovie *parent = swfdec_movie_resolve (resource->target->parent);
+    movie = swfdec_movie_get_by_name (parent, resource->target->name, FALSE);
+  } else {
     movie = NULL;
+  }
   if (movie == NULL && resource->movie != NULL) {
     SWFDEC_DEBUG ("no movie, not emitting signal");
     return;
commit b18feb69f5f07a9e7436aa471f0d145ea842100e
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 22:16:21 2008 +0200

    convert to AS_COMPILER_FLAGS

diff --git a/configure.ac b/configure.ac
index 6fd23d9..8ea8590 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,13 +19,11 @@ AC_CONFIG_MACRO_DIR([m4])
 
 dnl decide on error flags
 dnl if we support them, we set them unconditionally
-AS_COMPILER_FLAG(-Wall, GLOBAL_CFLAGS="-Wall", GLOBAL_CFLAGS="")
-dnl I want this but stupid headers don't let me
-dnl AS_COMPILER_FLAG(-Wshadow, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wshadow")
-AS_COMPILER_FLAG(-Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security -Wswitch-enum -Wswitch-default, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security -Wswitch-enum -Wswitch-default")
+dnl FIXME: I want this but stupid headers don't let me: -Wshadow
+AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wold-style-definition -Wdeclaration-after-statement -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Winline -Wformat-nonliteral -Wformat-security -Wswitch-enum -Wswitch-default")
 dnl if we're in nano >= 1, add -Werror if supported
 if test x$SWFDEC_CVS = xyes ; then
-  AS_COMPILER_FLAG(-Werror, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -Werror")
+  AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Werror")
   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_WARNING"
 else
   DEFAULT_DEBUG_LEVEL="SWFDEC_LEVEL_ERROR"
@@ -37,7 +35,7 @@ AC_SUBST(SWFDEC_LIBVERSION)
 AM_PROG_LIBTOOL
 
 dnl C99 is only required to get definitions for NAN and INFINITY.
-AS_COMPILER_FLAG(-std=gnu99, GLOBAL_CFLAGS="$GLOBAL_CFLAGS -std=gnu99")
+AS_COMPILER_FLAG(GLOBAL_CFLAGS, "-std=gnu99")
 
 dnl ensures the library is linked against the internal Mozilla
 dnl if this doesn't work on your platform, I'll take patches :)
commit f00a89bf2e7ae9fdbaa1e52d717bf751e0ca4da7
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 22:16:05 2008 +0200

    update to improve output

diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4
index 19b7879..3c40a87 100644
--- a/m4/as-compiler-flag.m4
+++ b/m4/as-compiler-flag.m4
@@ -37,19 +37,20 @@ dnl Tries to compile with the given CFLAGS.
 AC_DEFUN([AS_COMPILER_FLAGS],
 [
   list=$2
+  flag_list=""
+  AC_MSG_CHECKING([for supported compiler flags])
   for each in $list
   do
-    AC_MSG_CHECKING([to see if compiler understands $each])
-
     save_CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS $each"
     AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
     CFLAGS="$save_CFLAGS"
 
     if test "X$flag_ok" = Xyes ; then
-      $1="$$1 $each"
+      flag_list="$flag_list $each"
     fi
-    AC_MSG_RESULT([$flag_ok])
   done
+  AC_MSG_RESULT([$flag_list])
+  $1="$$1 $flag_list"
 ])
 
commit b5e06e1eecd2aaba292dbe638949f62b3c654c79
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 21:22:52 2008 +0200

    make second and third arguments to AS_COMPILER_FLAG optional

diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4
index 9685fbf..19b7879 100644
--- a/m4/as-compiler-flag.m4
+++ b/m4/as-compiler-flag.m4
@@ -22,10 +22,10 @@ AC_DEFUN([AS_COMPILER_FLAG],
   CFLAGS="$save_CFLAGS"
 
   if test "X$flag_ok" = Xyes ; then
-    $2
+    m4_ifvaln([$2],[$2])
     true
   else
-    $3
+    m4_ifvaln([$3],[$3])
     true
   fi
   AC_MSG_RESULT([$flag_ok])
commit 3900a275aec4ded9112156c36bd32cc16e851e14
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 21:09:53 2008 +0200

    upgrade to schrodinger's version

diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4
index 76cf4cd..9685fbf 100644
--- a/m4/as-compiler-flag.m4
+++ b/m4/as-compiler-flag.m4
@@ -4,7 +4,7 @@ dnl autostars m4 macro for detection of compiler flags
 
 dnl David Schleef <ds at schleef.org>
 
-dnl $Id: as-compiler-flag.m4,v 1.2 2006/02/12 05:26:26 otte Exp $
+dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
 
 dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
 dnl Tries to compile with the given CFLAGS.
@@ -18,22 +18,38 @@ AC_DEFUN([AS_COMPILER_FLAG],
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $1"
 
-  AC_TRY_COMPILE([
-int main (int argc, char **argv)
-{
-#if 0
-], [
-#endif
-], [flag_ok=yes], [flag_ok=no])
+  AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
   CFLAGS="$save_CFLAGS"
 
   if test "X$flag_ok" = Xyes ; then
-    m4_ifvaln([$2],[$2])
+    $2
     true
   else
-    m4_ifvaln([$3],[$3])
+    $3
     true
   fi
   AC_MSG_RESULT([$flag_ok])
 ])
 
+dnl AS_COMPILER_FLAGS(VAR, FLAGS)
+dnl Tries to compile with the given CFLAGS.
+
+AC_DEFUN([AS_COMPILER_FLAGS],
+[
+  list=$2
+  for each in $list
+  do
+    AC_MSG_CHECKING([to see if compiler understands $each])
+
+    save_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $each"
+    AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
+    CFLAGS="$save_CFLAGS"
+
+    if test "X$flag_ok" = Xyes ; then
+      $1="$$1 $each"
+    fi
+    AC_MSG_RESULT([$flag_ok])
+  done
+])
+
commit 0d2d1cccdf8c9d4d5c5bc5a8ed6f5514c98ffec3
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 13:51:56 2008 +0200

    add test for parent resolving

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index c4dd3f9..b0c25b2 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -2730,6 +2730,15 @@ EXTRA_DIST = \
 	replaceText-newline-8.swf \
 	replaceText-newline-8.swf.trace \
 	replaceText-newline.as \
+	resolve-parent-5.swf \
+	resolve-parent-5.swf.trace \
+	resolve-parent-6.swf \
+	resolve-parent-6.swf.trace \
+	resolve-parent-7.swf \
+	resolve-parent-7.swf.trace \
+	resolve-parent-8.swf \
+	resolve-parent-8.swf.trace \
+	resolve-parent.as \
 	rewind-remove.c \
 	rewind-remove-5.swf \
 	rewind-remove-5.swf.trace \
diff --git a/test/trace/resolve-parent-5.swf b/test/trace/resolve-parent-5.swf
new file mode 100644
index 0000000..0826f46
Binary files /dev/null and b/test/trace/resolve-parent-5.swf differ
diff --git a/test/trace/resolve-parent-5.swf.trace b/test/trace/resolve-parent-5.swf.trace
new file mode 100644
index 0000000..d4f80bf
--- /dev/null
+++ b/test/trace/resolve-parent-5.swf.trace
@@ -0,0 +1,2 @@
+undefined
+undefined
diff --git a/test/trace/resolve-parent-6.swf b/test/trace/resolve-parent-6.swf
new file mode 100644
index 0000000..6e78c62
Binary files /dev/null and b/test/trace/resolve-parent-6.swf differ
diff --git a/test/trace/resolve-parent-6.swf.trace b/test/trace/resolve-parent-6.swf.trace
new file mode 100644
index 0000000..25adf05
--- /dev/null
+++ b/test/trace/resolve-parent-6.swf.trace
@@ -0,0 +1,2 @@
+
+_level0.a.a
diff --git a/test/trace/resolve-parent-7.swf b/test/trace/resolve-parent-7.swf
new file mode 100644
index 0000000..81934d0
Binary files /dev/null and b/test/trace/resolve-parent-7.swf differ
diff --git a/test/trace/resolve-parent-7.swf.trace b/test/trace/resolve-parent-7.swf.trace
new file mode 100644
index 0000000..25adf05
--- /dev/null
+++ b/test/trace/resolve-parent-7.swf.trace
@@ -0,0 +1,2 @@
+
+_level0.a.a
diff --git a/test/trace/resolve-parent-8.swf b/test/trace/resolve-parent-8.swf
new file mode 100644
index 0000000..06df506
Binary files /dev/null and b/test/trace/resolve-parent-8.swf differ
diff --git a/test/trace/resolve-parent-8.swf.trace b/test/trace/resolve-parent-8.swf.trace
new file mode 100644
index 0000000..25adf05
--- /dev/null
+++ b/test/trace/resolve-parent-8.swf.trace
@@ -0,0 +1,2 @@
+
+_level0.a.a
diff --git a/test/trace/resolve-parent.as b/test/trace/resolve-parent.as
new file mode 100644
index 0000000..630a234
--- /dev/null
+++ b/test/trace/resolve-parent.as
@@ -0,0 +1,12 @@
+// makeswf -v 7 -s 200x150 -r 1 -o resolve-parent.swf resolve-parent.as
+
+createEmptyMovieClip ("a", 0);
+x = a.createEmptyMovieClip ("a", 0);
+
+a.removeMovieClip ();
+createEmptyMovieClip ("a", 0);
+trace (x);
+a.createEmptyMovieClip ("a", 0);
+trace (x);
+
+getURL ("fscommand:quit", "");
commit 2eec226b0125afadc472d8edff2a39689718735a
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Jun 6 13:49:57 2008 +0200

    resolve parent movies, too

diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 9af35e8..8cfa5a8 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -463,6 +463,8 @@ swfdec_movie_destroy (SwfdecMovie *movie)
 SwfdecMovie *
 swfdec_movie_resolve (SwfdecMovie *movie)
 {
+  SwfdecMovie *parent;
+
   g_return_val_if_fail (SWFDEC_IS_MOVIE (movie), NULL);
 
   if (movie->state != SWFDEC_MOVIE_STATE_DESTROYED)
@@ -471,8 +473,11 @@ swfdec_movie_resolve (SwfdecMovie *movie)
     SWFDEC_FIXME ("figure out how to resolve root movies");
     return NULL;
   }
+  parent = swfdec_movie_resolve (movie->parent);
+  if (parent == NULL)
+    return NULL;
   /* FIXME: include unnamed ones? */
-  return swfdec_movie_get_by_name (movie->parent, movie->original_name, FALSE);
+  return swfdec_movie_get_by_name (parent, movie->original_name, FALSE);
 }
 
 guint
commit 2c3f5ef7918321f76b0a5f1babad26c3875fae19
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Jun 5 16:28:49 2008 +0200

    fix outdated info in docs

diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 7130445..e5deee0 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -3218,10 +3218,7 @@ swfdec_player_get_next_event (SwfdecPlayer *player)
  * @player: a #SwfdecPlayer
  *
  * Queries the framerate of this movie. This number specifies the number
- * of frames that are supposed to pass per second. It is a 
- * multiple of 1/256. It is possible that the movie has no framerate if it does
- * not display a Flash movie but an FLV video for example. This does not mean
- * it will not change however.
+ * of frames that are supposed to pass per second. It is a multiple of 1/256. 
  *
  * Returns: The framerate of this movie or 0 if it isn't known yet or the
  *          movie doesn't have a framerate.
commit 5324cd797f952ff9a0b08fb8a739324f2b540138
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Jun 4 22:03:16 2008 +0200

    use the right ifdef marker here

diff --git a/swfdec/swfdec_bots.h b/swfdec/swfdec_bots.h
index 809477a..87640c7 100644
--- a/swfdec/swfdec_bots.h
+++ b/swfdec/swfdec_bots.h
@@ -17,8 +17,8 @@
  * Boston, MA  02110-1301  USA
  */
 
-#ifndef __SWFDEC_OUT_H__
-#define __SWFDEC_OUT_H__
+#ifndef __SWFDEC_BOTS_H__
+#define __SWFDEC_BOTS_H__
 
 #include <swfdec/swfdec_buffer.h>
 #include <swfdec/swfdec_color.h>


More information about the Swfdec-commits mailing list