[Swfdec-commits] 7 commits - swfdec-gtk/swfdec_playback_alsa.c swfdec/Makefile.am swfdec/swfdec_display_object.c swfdec/swfdec_display_object_container.c swfdec/swfdec_display_object_container.h swfdec/swfdec_display_object.h swfdec/swfdec_event_dispatcher.c swfdec/swfdec_event_dispatcher.h swfdec/swfdec_interactive_object.c swfdec/swfdec_interactive_object.h swfdec/swfdec_net_stream.c swfdec/swfdec_types.h swfdec/swfdec_video_decoder.c swfdec/swfdec_video_decoder_gst.c swfdec/swfdec_video_decoder.h swfdec/swfdec_video_decoder_screen.c swfdec/swfdec_video_decoder_vp6_alpha.c swfdec/swfdec_video_video_provider.c

Benjamin Otte company at kemper.freedesktop.org
Thu Oct 16 04:12:24 PDT 2008


 swfdec-gtk/swfdec_playback_alsa.c        |    7 ++-
 swfdec/Makefile.am                       |   15 +++++--
 swfdec/swfdec_display_object.c           |   39 ++++++++++++++++++
 swfdec/swfdec_display_object.h           |   52 +++++++++++++++++++++++++
 swfdec/swfdec_display_object_container.c |   39 ++++++++++++++++++
 swfdec/swfdec_display_object_container.h |   51 ++++++++++++++++++++++++
 swfdec/swfdec_event_dispatcher.c         |   39 ++++++++++++++++++
 swfdec/swfdec_event_dispatcher.h         |   52 +++++++++++++++++++++++++
 swfdec/swfdec_interactive_object.c       |   39 ++++++++++++++++++
 swfdec/swfdec_interactive_object.h       |   51 ++++++++++++++++++++++++
 swfdec/swfdec_net_stream.c               |   64 ++++++++++++++++++++++++++++---
 swfdec/swfdec_types.h                    |    4 +
 swfdec/swfdec_video_decoder.c            |    7 ++-
 swfdec/swfdec_video_decoder.h            |    7 ++-
 swfdec/swfdec_video_decoder_gst.c        |   19 +++++++--
 swfdec/swfdec_video_decoder_screen.c     |    2 
 swfdec/swfdec_video_decoder_vp6_alpha.c  |    6 +-
 swfdec/swfdec_video_video_provider.c     |    2 
 18 files changed, 471 insertions(+), 24 deletions(-)

New commits:
commit cc5ad40ffad9d6b7f4d66363bb84f9e4668e6daa
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 16 13:11:43 2008 +0200

    add support for H264 video

diff --git a/swfdec/swfdec_net_stream.c b/swfdec/swfdec_net_stream.c
index 601576d..b9de530 100644
--- a/swfdec/swfdec_net_stream.c
+++ b/swfdec/swfdec_net_stream.c
@@ -100,11 +100,62 @@ swfdec_net_stream_decode_video (SwfdecVideoDecoder *decoder, SwfdecBuffer *buffe
       decoder->width -= wsub;
       decoder->height -= hsub;
     }
+  } else if (decoder->codec == SWFDEC_VIDEO_CODEC_H264) {
+    SwfdecBits bits;
+    guint type;
+    SwfdecBuffer *data;
+    swfdec_bits_init (&bits, buffer);
+    type = swfdec_bits_get_u8 (&bits);
+    /* composition_time_offset = */ swfdec_bits_get_bu24 (&bits);
+    switch (type) {
+      case 0:
+	SWFDEC_ERROR ("new data stream?!");
+	break;
+      case 1:
+	data = swfdec_bits_get_buffer (&bits, -1);
+	if (data) {
+	  swfdec_video_decoder_decode (decoder, data);
+	} else {
+	  SWFDEC_ERROR ("no data in H264 buffer?");
+	}
+	break;
+      case 2:
+	break;
+      default:
+	SWFDEC_ERROR ("H264 data type %u not supported", type);
+	break;
+    }
   } else {
     swfdec_video_decoder_decode (decoder, buffer);
   }
 }
 
+/* returns TRUE if the buffer was consumed */
+static gboolean
+swfdec_net_stream_new_video_decoder (SwfdecNetStream *stream, guint format, SwfdecBuffer *buffer)
+{
+  if (format == SWFDEC_VIDEO_CODEC_H264) {
+    SwfdecBits bits;
+
+    swfdec_bits_init (&bits, buffer);
+    if (swfdec_bits_get_u8 (&bits) == 0) {
+      SwfdecBuffer *data;
+      /* composition_time_offset = */ swfdec_bits_get_bu24 (&bits);
+      data = swfdec_bits_get_buffer (&bits, -1);
+      stream->decoder = swfdec_video_decoder_new (format, data);
+      if (data)
+	swfdec_buffer_unref (data);
+      return TRUE;
+    } else {
+      stream->decoder = swfdec_video_decoder_new (format, NULL);
+      return FALSE;
+    }
+  } else {
+    stream->decoder = swfdec_video_decoder_new (format, NULL);
+    return FALSE;
+  }
+}
+
 static void swfdec_net_stream_update_playing (SwfdecNetStream *stream);
 static void
 swfdec_net_stream_video_goto (SwfdecNetStream *stream, guint timestamp)
@@ -112,7 +163,7 @@ swfdec_net_stream_video_goto (SwfdecNetStream *stream, guint timestamp)
   SwfdecBuffer *buffer;
   guint format;
   cairo_surface_t *old;
-  gboolean process_events;
+  gboolean process_events, skip;
   guint process_events_from;
 
   SWFDEC_LOG ("goto %ums", timestamp);
@@ -146,12 +197,14 @@ swfdec_net_stream_video_goto (SwfdecNetStream *stream, guint timestamp)
       stream->decoder = NULL;
     }
 
+    skip = FALSE;
     if (stream->decoder == NULL) {
       buffer = swfdec_flv_decoder_get_video (stream->flvdecoder, 
 	  stream->current_time, TRUE, &format, &stream->decoder_time,
 	  &next);
-      stream->decoder = swfdec_video_decoder_new (format);
-    } else {
+      skip = !swfdec_net_stream_new_video_decoder (stream, format, buffer);
+    }
+    if (!skip) {
       swfdec_flv_decoder_get_video (stream->flvdecoder, 
 	  stream->decoder_time, FALSE, NULL, NULL, &next);
       if (next != stream->current_time) {
@@ -182,9 +235,10 @@ swfdec_net_stream_video_goto (SwfdecNetStream *stream, guint timestamp)
     for (;;) {
       if (format != swfdec_video_decoder_get_codec (stream->decoder)) {
 	g_object_unref (stream->decoder);
-	stream->decoder = swfdec_video_decoder_new (format);
+	skip = swfdec_net_stream_new_video_decoder (stream, format, buffer);
       }
-      swfdec_net_stream_decode_video (stream->decoder, buffer);
+      if (!skip)
+	swfdec_net_stream_decode_video (stream->decoder, buffer);
       if (stream->decoder_time >= stream->current_time)
 	break;
 
diff --git a/swfdec/swfdec_video_decoder.c b/swfdec/swfdec_video_decoder.c
index c09a293..43ddb98 100644
--- a/swfdec/swfdec_video_decoder.c
+++ b/swfdec/swfdec_video_decoder.c
@@ -65,6 +65,7 @@ swfdec_video_codec_get_format (guint codec)
     case SWFDEC_VIDEO_CODEC_H263:
     case SWFDEC_VIDEO_CODEC_VP6:
     case SWFDEC_VIDEO_CODEC_VP6_ALPHA:
+    case SWFDEC_VIDEO_CODEC_H264:
       return SWFDEC_VIDEO_FORMAT_I420;
     case SWFDEC_VIDEO_CODEC_UNDEFINED:
     case SWFDEC_VIDEO_CODEC_SCREEN:
@@ -111,6 +112,8 @@ swfdec_video_decoder_prepare (guint codec, char **missing)
 /**
  * swfdec_video_decoder_new:
  * @codec: codec id
+ * @data: initialization data for the video codec or %NULL if none. Currently 
+ *        only used for H264
  *
  * Creates a decoder suitable for decoding @format. If no decoder is available
  * for the given for mat, %NULL is returned.
@@ -118,14 +121,14 @@ swfdec_video_decoder_prepare (guint codec, char **missing)
  * Returns: a new decoder or %NULL
  **/
 SwfdecVideoDecoder *
-swfdec_video_decoder_new (guint codec)
+swfdec_video_decoder_new (guint codec, SwfdecBuffer *buffer)
 {
   SwfdecVideoDecoder *ret = NULL;
   GSList *walk;
   
   for (walk = video_codecs; walk; walk = walk->next) {
     SwfdecVideoDecoderClass *klass = g_type_class_ref (GPOINTER_TO_SIZE (walk->data));
-    ret = klass->create (codec);
+    ret = klass->create (codec, buffer);
     g_type_class_unref (klass);
     if (ret)
       break;
diff --git a/swfdec/swfdec_video_decoder.h b/swfdec/swfdec_video_decoder.h
index 2b1b663..091c42c 100644
--- a/swfdec/swfdec_video_decoder.h
+++ b/swfdec/swfdec_video_decoder.h
@@ -32,6 +32,7 @@ G_BEGIN_DECLS
 #define SWFDEC_VIDEO_CODEC_VP6 4
 #define SWFDEC_VIDEO_CODEC_VP6_ALPHA 5
 #define SWFDEC_VIDEO_CODEC_SCREEN2 6
+#define SWFDEC_VIDEO_CODEC_H264 7
 
 typedef enum {
   SWFDEC_VIDEO_FORMAT_RGBA,
@@ -73,7 +74,8 @@ struct _SwfdecVideoDecoderClass
   /*< public >*/
   gboolean		(* prepare)	(guint                  codec,
 					 char **                missing);
-  SwfdecVideoDecoder *	(* create)	(guint                  codec);
+  SwfdecVideoDecoder *	(* create)	(guint                  codec,
+					 SwfdecBuffer *		data);
 
   void			(* decode)	(SwfdecVideoDecoder *	decoder,
 					 SwfdecBuffer *		buffer);
@@ -88,7 +90,8 @@ void			swfdec_video_decoder_register	(GType			type);
 gboolean		swfdec_video_decoder_prepare	(guint			codec,
 							 char **		missing);
 
-SwfdecVideoDecoder *   	swfdec_video_decoder_new      	(guint			codec);
+SwfdecVideoDecoder *   	swfdec_video_decoder_new      	(guint			codec,
+							 SwfdecBuffer *		buffer);
 
 void			swfdec_video_decoder_decode	(SwfdecVideoDecoder *	decoder,
 							 SwfdecBuffer *		buffer);
diff --git a/swfdec/swfdec_video_decoder_gst.c b/swfdec/swfdec_video_decoder_gst.c
index 893fc45..38f393d 100644
--- a/swfdec/swfdec_video_decoder_gst.c
+++ b/swfdec/swfdec_video_decoder_gst.c
@@ -29,7 +29,7 @@
 #include "swfdec_debug.h"
 
 static GstCaps *
-swfdec_video_decoder_get_caps (guint codec)
+swfdec_video_decoder_get_caps (guint codec, SwfdecBuffer *buffer)
 {
   GstCaps *caps;
 
@@ -40,6 +40,17 @@ swfdec_video_decoder_get_caps (guint codec)
     case SWFDEC_VIDEO_CODEC_VP6:
       caps = gst_caps_from_string ("video/x-vp6-flash");
       break;
+    case SWFDEC_VIDEO_CODEC_H264:
+      caps = gst_caps_from_string ("video/x-h264");
+      if (buffer) {
+	GstBuffer *gstbuf;
+	
+	swfdec_buffer_ref (buffer);
+	gstbuf = swfdec_gst_buffer_new (buffer);
+	gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, gstbuf, NULL);
+	gst_buffer_unref (gstbuf);
+      }
+      break;
     default:
       return NULL;
   }
@@ -75,7 +86,7 @@ swfdec_video_decoder_gst_prepare (guint codec, char **missing)
   GstCaps *caps;
 
   /* Check if we can handle the format at all. If not, no plugin will help us. */
-  caps = swfdec_video_decoder_get_caps (codec);
+  caps = swfdec_video_decoder_get_caps (codec, NULL);
   if (caps == NULL)
     return FALSE;
 
@@ -94,12 +105,12 @@ swfdec_video_decoder_gst_prepare (guint codec, char **missing)
 }
 
 static SwfdecVideoDecoder *
-swfdec_video_decoder_gst_create (guint codec)
+swfdec_video_decoder_gst_create (guint codec, SwfdecBuffer *buffer)
 {
   SwfdecVideoDecoderGst *player;
   GstCaps *srccaps, *sinkcaps;
 
-  srccaps = swfdec_video_decoder_get_caps (codec);
+  srccaps = swfdec_video_decoder_get_caps (codec, buffer);
   if (srccaps == NULL)
     return NULL;
   sinkcaps = swfdec_video_decoder_get_sink_caps (codec);
diff --git a/swfdec/swfdec_video_decoder_screen.c b/swfdec/swfdec_video_decoder_screen.c
index 42504b5..c4c8be3 100644
--- a/swfdec/swfdec_video_decoder_screen.c
+++ b/swfdec/swfdec_video_decoder_screen.c
@@ -34,7 +34,7 @@ swfdec_video_decoder_screen_prepare (guint codec, char **missing)
 }
 
 static SwfdecVideoDecoder *
-swfdec_video_decoder_screen_create (guint codec)
+swfdec_video_decoder_screen_create (guint codec, SwfdecBuffer *buffer)
 {
   if (codec != SWFDEC_VIDEO_CODEC_SCREEN)
     return NULL;
diff --git a/swfdec/swfdec_video_decoder_vp6_alpha.c b/swfdec/swfdec_video_decoder_vp6_alpha.c
index 8e443fc..e7fba2c 100644
--- a/swfdec/swfdec_video_decoder_vp6_alpha.c
+++ b/swfdec/swfdec_video_decoder_vp6_alpha.c
@@ -38,7 +38,7 @@ swfdec_video_decoder_vp6_alpha_prepare (guint codec, char **missing)
 }
 
 static SwfdecVideoDecoder *
-swfdec_video_decoder_vp6_alpha_create (guint codec)
+swfdec_video_decoder_vp6_alpha_create (guint codec, SwfdecBuffer *buffer)
 {
   if (codec != SWFDEC_VIDEO_CODEC_VP6_ALPHA)
     return NULL;
@@ -128,8 +128,8 @@ swfdec_video_decoder_vp6_alpha_class_init (SwfdecVideoDecoderVp6AlphaClass *klas
 static void
 swfdec_video_decoder_vp6_alpha_init (SwfdecVideoDecoderVp6Alpha *vp6)
 {
-  vp6->image = swfdec_video_decoder_new (SWFDEC_VIDEO_CODEC_VP6);
-  vp6->mask = swfdec_video_decoder_new (SWFDEC_VIDEO_CODEC_VP6);
+  vp6->image = swfdec_video_decoder_new (SWFDEC_VIDEO_CODEC_VP6, NULL);
+  vp6->mask = swfdec_video_decoder_new (SWFDEC_VIDEO_CODEC_VP6, NULL);
 
   if (swfdec_video_decoder_get_error (vp6->image) ||
       swfdec_video_decoder_get_error (vp6->mask)) {
diff --git a/swfdec/swfdec_video_video_provider.c b/swfdec/swfdec_video_video_provider.c
index 74d6bd3..7e05d66 100644
--- a/swfdec/swfdec_video_video_provider.c
+++ b/swfdec/swfdec_video_video_provider.c
@@ -99,7 +99,7 @@ swfdec_video_video_provider_get_image (SwfdecVideoProvider *prov,
     if (provider->decoder != NULL) {
       g_object_unref (provider->decoder);
     }
-    provider->decoder = swfdec_video_decoder_new (provider->video->format);
+    provider->decoder = swfdec_video_decoder_new (provider->video->format, NULL);
     if (provider->decoder == NULL)
       return NULL;
     frame = &g_array_index (provider->video->images, SwfdecVideoFrame, 0);
commit 2e1bf0e7c4f8d27ad087e1008d9f67e9598fe5c6
Merge: a93158f... 3e8e080...
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 16 12:06:20 2008 +0200

    Merge branch '0.8'

commit 3e8e0806329734d407a8ef7eda72d6b6ba05725c
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Oct 16 12:04:51 2008 +0200

    fix potential deadlock
    
    This could happen when a 0-byte sound stream was encountered and the
    stream was finished before it was properly setup. This would cause setup
    to be restarted causing an infinite loop.

diff --git a/swfdec-gtk/swfdec_playback_alsa.c b/swfdec-gtk/swfdec_playback_alsa.c
index af83c9f..733c94a 100644
--- a/swfdec-gtk/swfdec_playback_alsa.c
+++ b/swfdec-gtk/swfdec_playback_alsa.c
@@ -173,9 +173,12 @@ try_write_so_pa_gets_it (Stream *stream)
     stream->offset += step;
   }
 
-  if (finish)
+  if (finish) {
     swfdec_playback_stream_remove_handlers (stream);
-  return TRUE;
+    return FALSE;
+  } else {
+    return TRUE;
+  }
 #undef STEP
 }
 
commit a93158fbd97cea2cbd46e12f111a9487526eaaa9
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Oct 15 09:59:13 2008 +0200

    remove unused variables

diff --git a/swfdec/Makefile.am b/swfdec/Makefile.am
index 5f20ea8..e4a3842 100644
--- a/swfdec/Makefile.am
+++ b/swfdec/Makefile.am
@@ -189,15 +189,14 @@ libswfdec_ at SWFDEC_MAJORMINOR@_la_SOURCES = \
 
 libswfdec_ at SWFDEC_MAJORMINOR@_la_CFLAGS = \
 	$(GLOBAL_CFLAGS) $(CAIRO_CFLAGS) $(GLIB_CFLAGS) $(PANGO_CFLAGS) \
-	-I$(top_srcdir) -I$(srcdir)/jpeg/ $(LIBOIL_CFLAGS) \
-	$(GST_CFLAGS) $(FFMPEG_CFLAGS) $(MAD_CFLAGS) \
+	-I$(top_srcdir) -I$(srcdir)/jpeg/ $(LIBOIL_CFLAGS) $(GST_CFLAGS) \ 
 	-DG_LOG_DOMAIN=\"Swfdec\"
 libswfdec_ at SWFDEC_MAJORMINOR@_la_LDFLAGS = \
 	$(SYMBOLIC_LDFLAGS) \
 	-version-info $(SWFDEC_LIBVERSION) \
 	-export-symbols-regex '^(swfdec_.*)' \
-	$(CAIRO_LIBS) $(GLIB_LIBS) $(PANGO_LIBS) $(LIBOIL_LIBS) -lz \
-	$(MAD_LIBS) $(FFMPEG_LIBS) $(GST_LIBS)
+	$(CAIRO_LIBS) $(GLIB_LIBS) $(PANGO_LIBS) \
+	$(LIBOIL_LIBS) -lz $(GST_LIBS)
 
 public_headers = \
 	swfdec.h \
commit 72fcfb517e9aa385c84654f32fdb96f132f157df
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Oct 14 22:35:13 2008 +0200

    add more new objects

diff --git a/swfdec/Makefile.am b/swfdec/Makefile.am
index 482b47f..5f20ea8 100644
--- a/swfdec/Makefile.am
+++ b/swfdec/Makefile.am
@@ -74,6 +74,7 @@ libswfdec_source_files = \
 	swfdec_decoder.c \
 	swfdec_displacement_map_filter.c \
 	swfdec_display_object.c \
+	swfdec_display_object_container.c \
 	swfdec_draw.c \
 	swfdec_drop_shadow_filter.c \
 	swfdec_event.c \
@@ -95,6 +96,7 @@ libswfdec_source_files = \
 	swfdec_graphic_movie.c \
 	swfdec_image.c \
 	swfdec_image_decoder.c \
+	swfdec_interactive_object.c \
 	swfdec_init.c \
 	swfdec_interval.c \
 	swfdec_key_as.c \
@@ -278,6 +280,7 @@ noinst_HEADERS = \
 	swfdec_debug.h \
 	swfdec_decoder.h \
 	swfdec_display_object.h \
+	swfdec_display_object_container.h \
 	swfdec_draw.h \
 	swfdec_text_field.h \
 	swfdec_text_field_movie.h \
@@ -293,6 +296,7 @@ noinst_HEADERS = \
 	swfdec_image.h \
 	swfdec_image_decoder.h \
 	swfdec_initialize.h \
+	swfdec_interactive_object.h \
 	swfdec_internal.h \
 	swfdec_interval.h \
 	swfdec_load_object.h \
diff --git a/swfdec/swfdec_display_object_container.c b/swfdec/swfdec_display_object_container.c
new file mode 100644
index 0000000..bb09ff1
--- /dev/null
+++ b/swfdec/swfdec_display_object_container.c
@@ -0,0 +1,39 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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 "swfdec_display_object_container.h"
+#include "swfdec_debug.h"
+
+
+G_DEFINE_TYPE (SwfdecDisplayObjectContainer, swfdec_display_object_container, SWFDEC_TYPE_INTERACTIVE_OBJECT)
+
+static void
+swfdec_display_object_container_class_init (SwfdecDisplayObjectContainerClass *klass)
+{
+}
+
+static void
+swfdec_display_object_container_init (SwfdecDisplayObjectContainer *display_object_container)
+{
+}
+
diff --git a/swfdec/swfdec_display_object_container.h b/swfdec/swfdec_display_object_container.h
new file mode 100644
index 0000000..a1c2601
--- /dev/null
+++ b/swfdec/swfdec_display_object_container.h
@@ -0,0 +1,51 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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_DISPLAY_OBJECT_CONTAINER_H_
+#define _SWFDEC_DISPLAY_OBJECT_CONTAINER_H_
+
+#include <swfdec/swfdec_interactive_object.h>
+
+G_BEGIN_DECLS
+
+//typedef struct _SwfdecDisplayObjectContainer SwfdecDisplayObjectContainer;
+typedef struct _SwfdecDisplayObjectContainerClass SwfdecDisplayObjectContainerClass;
+
+#define SWFDEC_TYPE_DISPLAY_OBJECT_CONTAINER                    (swfdec_display_object_container_get_type())
+#define SWFDEC_IS_DISPLAY_OBJECT_CONTAINER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_DISPLAY_OBJECT_CONTAINER))
+#define SWFDEC_IS_DISPLAY_OBJECT_CONTAINER_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_DISPLAY_OBJECT_CONTAINER))
+#define SWFDEC_DISPLAY_OBJECT_CONTAINER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_DISPLAY_OBJECT_CONTAINER, SwfdecDisplayObjectContainer))
+#define SWFDEC_DISPLAY_OBJECT_CONTAINER_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_DISPLAY_OBJECT_CONTAINER, SwfdecDisplayObjectContainerClass))
+#define SWFDEC_DISPLAY_OBJECT_CONTAINER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_DISPLAY_OBJECT_CONTAINER, SwfdecDisplayObjectContainerClass))
+
+struct _SwfdecDisplayObjectContainer
+{
+  SwfdecInteractiveObject	interactive_object;
+};
+
+struct _SwfdecDisplayObjectContainerClass
+{
+  SwfdecInteractiveObjectClass	interactive_object_class;
+};
+
+GType			swfdec_display_object_container_get_type	(void);
+
+
+G_END_DECLS
+#endif
diff --git a/swfdec/swfdec_interactive_object.c b/swfdec/swfdec_interactive_object.c
new file mode 100644
index 0000000..3d1d1b2
--- /dev/null
+++ b/swfdec/swfdec_interactive_object.c
@@ -0,0 +1,39 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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 "swfdec_interactive_object.h"
+#include "swfdec_debug.h"
+
+
+G_DEFINE_TYPE (SwfdecInteractiveObject, swfdec_interactive_object, SWFDEC_TYPE_DISPLAY_OBJECT)
+
+static void
+swfdec_interactive_object_class_init (SwfdecInteractiveObjectClass *klass)
+{
+}
+
+static void
+swfdec_interactive_object_init (SwfdecInteractiveObject *interactive_object)
+{
+}
+
diff --git a/swfdec/swfdec_interactive_object.h b/swfdec/swfdec_interactive_object.h
new file mode 100644
index 0000000..8d901c0
--- /dev/null
+++ b/swfdec/swfdec_interactive_object.h
@@ -0,0 +1,51 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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_INTERACTIVE_OBJECT_H_
+#define _SWFDEC_INTERACTIVE_OBJECT_H_
+
+#include <swfdec/swfdec_display_object.h>
+
+G_BEGIN_DECLS
+
+//typedef struct _SwfdecInteractiveObject SwfdecInteractiveObject;
+typedef struct _SwfdecInteractiveObjectClass SwfdecInteractiveObjectClass;
+
+#define SWFDEC_TYPE_INTERACTIVE_OBJECT                    (swfdec_interactive_object_get_type())
+#define SWFDEC_IS_INTERACTIVE_OBJECT(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_INTERACTIVE_OBJECT))
+#define SWFDEC_IS_INTERACTIVE_OBJECT_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_INTERACTIVE_OBJECT))
+#define SWFDEC_INTERACTIVE_OBJECT(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_INTERACTIVE_OBJECT, SwfdecInteractiveObject))
+#define SWFDEC_INTERACTIVE_OBJECT_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_INTERACTIVE_OBJECT, SwfdecInteractiveObjectClass))
+#define SWFDEC_INTERACTIVE_OBJECT_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_INTERACTIVE_OBJECT, SwfdecInteractiveObjectClass))
+
+struct _SwfdecInteractiveObject
+{
+  SwfdecDisplayObject		display_object;
+};
+
+struct _SwfdecInteractiveObjectClass
+{
+  SwfdecDisplayObjectClass	display_object_class;
+};
+
+GType			swfdec_interactive_object_get_type	(void);
+
+
+G_END_DECLS
+#endif
diff --git a/swfdec/swfdec_types.h b/swfdec/swfdec_types.h
index 9f629c0..8a9ed93 100644
--- a/swfdec/swfdec_types.h
+++ b/swfdec/swfdec_types.h
@@ -39,6 +39,7 @@ typedef struct _SwfdecCharacter SwfdecCharacter;
 typedef struct _SwfdecColorTransform SwfdecColorTransform;
 typedef struct _SwfdecDecoder SwfdecDecoder;
 typedef struct _SwfdecDisplayObject SwfdecDisplayObject;
+typedef struct _SwfdecDisplayObjectContainer SwfdecDisplayObjectContainer;
 typedef struct _SwfdecDraw SwfdecDraw;
 typedef struct _SwfdecEventDispatcher SwfdecEventDispatcher;
 typedef struct _SwfdecEventList SwfdecEventList;
@@ -46,6 +47,7 @@ typedef struct _SwfdecFilter SwfdecFilter;
 typedef struct _SwfdecFont SwfdecFont;
 typedef struct _SwfdecGraphic SwfdecGraphic;
 typedef struct _SwfdecImage SwfdecImage;
+typedef struct _SwfdecInteractiveObject SwfdecInteractiveObject;
 typedef struct _SwfdecListener SwfdecListener;
 typedef struct _SwfdecMovie SwfdecMovie;
 typedef struct _SwfdecMovieClipLoader SwfdecMovieClipLoader;
commit 76a559f4e52af4e9c36a9d5550593868cd7b3ed8
Author: Benjamin Otte <otte at gnome.org>
Date:   Tue Oct 14 22:15:55 2008 +0200

    add some Flash 9 types
    
    next step: making the real subclasses of them be subclasses of these
    without breaking the testsuite.

diff --git a/swfdec/Makefile.am b/swfdec/Makefile.am
index 2ad2dd5..482b47f 100644
--- a/swfdec/Makefile.am
+++ b/swfdec/Makefile.am
@@ -73,9 +73,11 @@ libswfdec_source_files = \
 	swfdec_debug.c \
 	swfdec_decoder.c \
 	swfdec_displacement_map_filter.c \
+	swfdec_display_object.c \
 	swfdec_draw.c \
 	swfdec_drop_shadow_filter.c \
 	swfdec_event.c \
+	swfdec_event_dispatcher.c \
 	swfdec_external_interface.c \
 	swfdec_file_loader.c \
 	swfdec_file_reference.c \
@@ -275,10 +277,12 @@ noinst_HEADERS = \
 	swfdec_convolution_matrix.h \
 	swfdec_debug.h \
 	swfdec_decoder.h \
+	swfdec_display_object.h \
 	swfdec_draw.h \
 	swfdec_text_field.h \
 	swfdec_text_field_movie.h \
 	swfdec_event.h \
+	swfdec_event_dispatcher.h \
 	swfdec_filter.h \
 	swfdec_flv_decoder.h \
 	swfdec_font.h \
diff --git a/swfdec/swfdec_display_object.c b/swfdec/swfdec_display_object.c
new file mode 100644
index 0000000..bd423c5
--- /dev/null
+++ b/swfdec/swfdec_display_object.c
@@ -0,0 +1,39 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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 "swfdec_display_object.h"
+#include "swfdec_debug.h"
+
+
+G_DEFINE_TYPE (SwfdecDisplayObject, swfdec_display_object, SWFDEC_TYPE_EVENT_DISPATCHER)
+
+static void
+swfdec_display_object_class_init (SwfdecDisplayObjectClass *klass)
+{
+}
+
+static void
+swfdec_display_object_init (SwfdecDisplayObject *display_object)
+{
+}
+
diff --git a/swfdec/swfdec_display_object.h b/swfdec/swfdec_display_object.h
new file mode 100644
index 0000000..78ae1b7
--- /dev/null
+++ b/swfdec/swfdec_display_object.h
@@ -0,0 +1,52 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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_DISPLAY_OBJECT_H_
+#define _SWFDEC_DISPLAY_OBJECT_H_
+
+#include <swfdec/swfdec_event_dispatcher.h>
+#include <swfdec/swfdec_types.h>
+
+G_BEGIN_DECLS
+
+//typedef struct _SwfdecDisplayObject SwfdecDisplayObject;
+typedef struct _SwfdecDisplayObjectClass SwfdecDisplayObjectClass;
+
+#define SWFDEC_TYPE_DISPLAY_OBJECT                    (swfdec_display_object_get_type())
+#define SWFDEC_IS_DISPLAY_OBJECT(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_DISPLAY_OBJECT))
+#define SWFDEC_IS_DISPLAY_OBJECT_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_DISPLAY_OBJECT))
+#define SWFDEC_DISPLAY_OBJECT(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_DISPLAY_OBJECT, SwfdecDisplayObject))
+#define SWFDEC_DISPLAY_OBJECT_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_DISPLAY_OBJECT, SwfdecDisplayObjectClass))
+#define SWFDEC_DISPLAY_OBJECT_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_DISPLAY_OBJECT, SwfdecDisplayObjectClass))
+
+struct _SwfdecDisplayObject
+{
+  SwfdecEventDispatcher		dispatcher;
+};
+
+struct _SwfdecDisplayObjectClass
+{
+  SwfdecEventDispatcherClass	dispatcher_class;
+};
+
+GType			swfdec_display_object_get_type	(void);
+
+
+G_END_DECLS
+#endif
diff --git a/swfdec/swfdec_event_dispatcher.c b/swfdec/swfdec_event_dispatcher.c
new file mode 100644
index 0000000..299d179
--- /dev/null
+++ b/swfdec/swfdec_event_dispatcher.c
@@ -0,0 +1,39 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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 "swfdec_event_dispatcher.h"
+#include "swfdec_debug.h"
+
+
+G_DEFINE_TYPE (SwfdecEventDispatcher, swfdec_event_dispatcher, SWFDEC_TYPE_GC_OBJECT)
+
+static void
+swfdec_event_dispatcher_class_init (SwfdecEventDispatcherClass *klass)
+{
+}
+
+static void
+swfdec_event_dispatcher_init (SwfdecEventDispatcher *event_dispatcher)
+{
+}
+
diff --git a/swfdec/swfdec_event_dispatcher.h b/swfdec/swfdec_event_dispatcher.h
new file mode 100644
index 0000000..b6622b9
--- /dev/null
+++ b/swfdec/swfdec_event_dispatcher.h
@@ -0,0 +1,52 @@
+/* Swfdec
+ * Copyright (C) 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
+ * 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_EVENT_DISPATCHER_H_
+#define _SWFDEC_EVENT_DISPATCHER_H_
+
+#include <swfdec/swfdec_gc_object.h>
+#include <swfdec/swfdec_types.h>
+
+G_BEGIN_DECLS
+
+//typedef struct _SwfdecEventDispatcher SwfdecEventDispatcher;
+typedef struct _SwfdecEventDispatcherClass SwfdecEventDispatcherClass;
+
+#define SWFDEC_TYPE_EVENT_DISPATCHER                    (swfdec_event_dispatcher_get_type())
+#define SWFDEC_IS_EVENT_DISPATCHER(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_EVENT_DISPATCHER))
+#define SWFDEC_IS_EVENT_DISPATCHER_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_EVENT_DISPATCHER))
+#define SWFDEC_EVENT_DISPATCHER(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_EVENT_DISPATCHER, SwfdecEventDispatcher))
+#define SWFDEC_EVENT_DISPATCHER_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_EVENT_DISPATCHER, SwfdecEventDispatcherClass))
+#define SWFDEC_EVENT_DISPATCHER_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_EVENT_DISPATCHER, SwfdecEventDispatcherClass))
+
+struct _SwfdecEventDispatcher
+{
+  SwfdecGcObject	object;
+};
+
+struct _SwfdecEventDispatcherClass
+{
+  SwfdecGcObjectClass	object_class;
+};
+
+GType			swfdec_event_dispatcher_get_type	(void);
+
+
+G_END_DECLS
+#endif
diff --git a/swfdec/swfdec_types.h b/swfdec/swfdec_types.h
index d8281c9..9f629c0 100644
--- a/swfdec/swfdec_types.h
+++ b/swfdec/swfdec_types.h
@@ -38,7 +38,9 @@ typedef struct _SwfdecButton SwfdecButton;
 typedef struct _SwfdecCharacter SwfdecCharacter;
 typedef struct _SwfdecColorTransform SwfdecColorTransform;
 typedef struct _SwfdecDecoder SwfdecDecoder;
+typedef struct _SwfdecDisplayObject SwfdecDisplayObject;
 typedef struct _SwfdecDraw SwfdecDraw;
+typedef struct _SwfdecEventDispatcher SwfdecEventDispatcher;
 typedef struct _SwfdecEventList SwfdecEventList;
 typedef struct _SwfdecFilter SwfdecFilter;
 typedef struct _SwfdecFont SwfdecFont;
commit 20d82d0bfb234c4886c6648fb352cc9bc2445f17
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Oct 13 15:24:02 2008 +0200

    fix invalid write when reading unaligned data (fixes #18029)

diff --git a/swfdec/swfdec_audio_decoder_uncompressed.c b/swfdec/swfdec_audio_decoder_uncompressed.c
index 69a6922..5371d9f 100644
--- a/swfdec/swfdec_audio_decoder_uncompressed.c
+++ b/swfdec/swfdec_audio_decoder_uncompressed.c
@@ -99,10 +99,13 @@ swfdec_audio_decoder_uncompressed_decode_16bit (SwfdecBuffer *buffer)
   gint16 *src, *dest;
   guint i;
 
-  ret = swfdec_buffer_new (buffer->length);
+  if (buffer->length & 2) {
+    SWFDEC_ERROR ("buffer length not a multiple of 16bit");
+  }
+  ret = swfdec_buffer_new (buffer->length & ~1);
   src = (gint16 *) buffer->data;
   dest = (gint16 *) ret->data;
-  for (i = 0; i < buffer->length; i += 2) {
+  for (i = 0; i < ret->length; i += 2) {
     *dest = GINT16_FROM_LE (*src);
     dest++;
     src++;


More information about the Swfdec-commits mailing list