[Swfdec] 4 commits - libswfdec/swfdec_audio_flv.c libswfdec/swfdec_audio_stream.c libswfdec/swfdec_codec_adpcm.c libswfdec/swfdec_codec.c libswfdec/swfdec_codec_ffmpeg.c libswfdec/swfdec_codec_gst.c libswfdec/swfdec_codec.h libswfdec/swfdec_codec_mad.c libswfdec/swfdec_codec_screen.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_sound.c libswfdec/swfdec_sprite.c libswfdec/swfdec_video.c

Benjamin Otte company at kemper.freedesktop.org
Thu Apr 5 09:19:37 PDT 2007


 libswfdec/swfdec_audio_flv.c    |    5 +-
 libswfdec/swfdec_audio_stream.c |    2 
 libswfdec/swfdec_codec.c        |   27 +++++++-----
 libswfdec/swfdec_codec.h        |   31 +++++++-------
 libswfdec/swfdec_codec_adpcm.c  |    2 
 libswfdec/swfdec_codec_ffmpeg.c |   85 ++++++++++++++++------------------------
 libswfdec/swfdec_codec_gst.c    |   32 ++++++++++++---
 libswfdec/swfdec_codec_mad.c    |    2 
 libswfdec/swfdec_codec_screen.c |    2 
 libswfdec/swfdec_flv_decoder.c  |    2 
 libswfdec/swfdec_net_stream.c   |    2 
 libswfdec/swfdec_sound.c        |    2 
 libswfdec/swfdec_sprite.c       |    2 
 libswfdec/swfdec_video.c        |    2 
 14 files changed, 108 insertions(+), 90 deletions(-)

New commits:
diff-tree bb03d104fbecb67c43dd6822288f57a73e6897c3 (from cfa44f89551fd40d78259a902c81875dfd8a3209)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 5 18:19:08 2007 +0200

    revamp the codec API to take the format as a parameter to the init function
    
    This should make it a lot easier when hooking up new codecs.
    Also hook up an initial VP6 decoder using gst, but that one doesn't seem to work yet.

diff --git a/libswfdec/swfdec_audio_flv.c b/libswfdec/swfdec_audio_flv.c
index 6e8560a..feb6b57 100644
--- a/libswfdec/swfdec_audio_flv.c
+++ b/libswfdec/swfdec_audio_flv.c
@@ -100,7 +100,7 @@ next:
       flv->in = in;
       flv->codec = swfdec_codec_get_audio (flv->format);
       if (flv->codec) {
-	flv->decoder = swfdec_audio_codec_init (flv->codec, flv->width, flv->in);
+	flv->decoder = swfdec_audio_codec_init (flv->codec, flv->format, flv->width, flv->in);
 	flv->out = swfdec_audio_codec_get_format (flv->codec, flv->decoder);
       }
     } else if (format != flv->format ||
diff --git a/libswfdec/swfdec_audio_stream.c b/libswfdec/swfdec_audio_stream.c
index 58e2175..b2c7fd3 100644
--- a/libswfdec/swfdec_audio_stream.c
+++ b/libswfdec/swfdec_audio_stream.c
@@ -202,7 +202,7 @@ swfdec_audio_stream_new (SwfdecPlayer *p
   stream->codec = swfdec_codec_get_audio (stream->sound->format);
   if (stream->codec)
     stream->decoder = swfdec_audio_codec_init (stream->codec, 
-	stream->sound->width, stream->sound->original_format);
+	stream->sound->format, stream->sound->width, stream->sound->original_format);
   if (stream->decoder)
     stream->format = swfdec_audio_codec_get_format (stream->codec, stream->decoder);
   swfdec_audio_add (SWFDEC_AUDIO (stream), player);
diff --git a/libswfdec/swfdec_codec.c b/libswfdec/swfdec_codec.c
index 1875572..8affa1c 100644
--- a/libswfdec/swfdec_codec.c
+++ b/libswfdec/swfdec_codec.c
@@ -34,19 +34,17 @@ extern const SwfdecAudioCodec swfdec_cod
 #endif
 
 #ifdef HAVE_FFMPEG
-extern const SwfdecAudioCodec swfdec_codec_ffmpeg_adpcm;
-extern const SwfdecAudioCodec swfdec_codec_ffmpeg_mp3;
-extern const SwfdecVideoCodec swfdec_codec_ffmpeg_h263;
-extern const SwfdecVideoCodec swfdec_codec_ffmpeg_screen;
+extern const SwfdecAudioCodec swfdec_codec_ffmpeg_audio;
+extern const SwfdecVideoCodec swfdec_codec_ffmpeg_video;
 #endif
 
-extern const SwfdecVideoCodec swfdec_codec_gst_h263;
+extern const SwfdecVideoCodec swfdec_codec_gst_video;
 
 /*** UNCOMPRESSED SOUND ***/
 
 #define U8_FLAG (0x10000)
 static gpointer
-swfdec_codec_uncompressed_init (gboolean width, SwfdecAudioOut format)
+swfdec_codec_uncompressed_init (SwfdecAudioFormat type, gboolean width, SwfdecAudioOut format)
 {
   guint ret = format;
   if (!width)
@@ -121,7 +119,7 @@ swfdec_codec_get_audio (SwfdecAudioForma
     case SWFDEC_AUDIO_FORMAT_ADPCM:
       return &swfdec_codec_adpcm;
 #ifdef HAVE_FFMPEG
-      return &swfdec_codec_ffmpeg_adpcm;
+      return &swfdec_codec_ffmpeg_audio;
 #else
       SWFDEC_ERROR ("adpcm sound requires ffmpeg");
       return NULL;
@@ -131,7 +129,7 @@ swfdec_codec_get_audio (SwfdecAudioForma
       return &swfdec_codec_mad;
 #else
 #ifdef HAVE_FFMPEG
-      return &swfdec_codec_ffmpeg_mp3;
+      return &swfdec_codec_ffmpeg_audio;
 #else
       SWFDEC_ERROR ("mp3 sound requires ffmpeg or mad");
       return NULL;
@@ -153,21 +151,28 @@ swfdec_codec_get_video (SwfdecVideoForma
     case SWFDEC_VIDEO_FORMAT_SCREEN:
       return &swfdec_codec_screen;
 #ifdef HAVE_FFMPEG
-      return &swfdec_codec_ffmpeg_screen;
+      return &swfdec_codec_ffmpeg_video;
 #endif
       SWFDEC_ERROR ("Screen video requires ffmpeg");
       return NULL;
     case SWFDEC_VIDEO_FORMAT_H263:
 #ifdef HAVE_GST
-      return &swfdec_codec_gst_h263;
+      return &swfdec_codec_gst_video;
 #else
 #ifdef HAVE_FFMPEG
-      return &swfdec_codec_ffmpeg_h263;
+      return &swfdec_codec_ffmpeg_video;
 #else
       SWFDEC_ERROR ("H263 video requires ffmpeg or GStreamer");
       return NULL;
 #endif
 #endif
+    case SWFDEC_VIDEO_FORMAT_VP6:
+#ifdef HAVE_GST
+      return &swfdec_codec_gst_video;
+#else
+      SWFDEC_ERROR ("VP6 video requires ffmpeg or GStreamer");
+      return NULL;
+#endif
     default:
       SWFDEC_ERROR ("video codec %u not implemented yet", (guint) format);
       return NULL;
diff --git a/libswfdec/swfdec_codec.h b/libswfdec/swfdec_codec.h
index 58acaaf..a248170 100644
--- a/libswfdec/swfdec_codec.h
+++ b/libswfdec/swfdec_codec.h
@@ -46,34 +46,35 @@ typedef enum {
 } SwfdecVideoFormat;
 
 struct _SwfdecAudioCodec {
-  gpointer		(* init)	(gboolean	width,
-					 SwfdecAudioOut	format);
-  SwfdecAudioOut	(* get_format)	(gpointer       codec_data);
+  gpointer		(* init)	(SwfdecAudioFormat	type,
+					 gboolean		width,
+					 SwfdecAudioOut		format);
+  SwfdecAudioOut	(* get_format)	(gpointer	        codec_data);
   /* FIXME: add SwfdecRect *invalid for invalidated region - might make sense for screen? */
-  SwfdecBuffer *	(* decode)	(gpointer	codec_data,
-					 SwfdecBuffer *	buffer);
-  SwfdecBuffer *	(* finish)	(gpointer	codec_data);
+  SwfdecBuffer *	(* decode)	(gpointer		codec_data,
+					 SwfdecBuffer *		buffer);
+  SwfdecBuffer *	(* finish)	(gpointer		codec_data);
 };
 
 struct _SwfdecVideoCodec {
-  gpointer		(* init)	(void);
-  gboolean	    	(* get_size)	(gpointer	codec_data,
-					 guint *	width,
-					 guint *	height);
-  SwfdecBuffer *	(* decode)	(gpointer	codec_data,
-					 SwfdecBuffer *	buffer);
-  void			(* finish)	(gpointer	codec_data);
+  gpointer		(* init)	(SwfdecVideoFormat	type);
+  gboolean	    	(* get_size)	(gpointer		codec_data,
+					 guint *		width,
+					 guint *		height);
+  SwfdecBuffer *	(* decode)	(gpointer		codec_data,
+					 SwfdecBuffer *		buffer);
+  void			(* finish)	(gpointer		codec_data);
 };
 
 const SwfdecAudioCodec *   	swfdec_codec_get_audio		(SwfdecAudioFormat	format);
 const SwfdecVideoCodec *  	swfdec_codec_get_video		(SwfdecVideoFormat	format);
 
-#define swfdec_audio_codec_init(codec,width,format) (codec)->init (width, format)
+#define swfdec_audio_codec_init(codec,type,width,format) (codec)->init (type, width, format)
 #define swfdec_audio_codec_get_format(codec, codec_data) (codec)->get_format (codec_data)
 #define swfdec_audio_codec_decode(codec, codec_data, buffer) (codec)->decode (codec_data, buffer)
 #define swfdec_audio_codec_finish(codec, codec_data) (codec)->finish (codec_data)
 
-#define swfdec_video_codec_init(codec) (codec)->init ()
+#define swfdec_video_codec_init(codec,type) (codec)->init (type)
 #define swfdec_video_codec_get_size(codec, codec_data, width, height) (codec)->get_size (codec_data, width, height)
 #define swfdec_video_codec_decode(codec, codec_data, buffer) (codec)->decode (codec_data, buffer)
 #define swfdec_video_codec_finish(codec, codec_data) (codec)->finish (codec_data)
diff --git a/libswfdec/swfdec_codec_adpcm.c b/libswfdec/swfdec_codec_adpcm.c
index 93775c2..20cfc1e 100644
--- a/libswfdec/swfdec_codec_adpcm.c
+++ b/libswfdec/swfdec_codec_adpcm.c
@@ -45,7 +45,7 @@ static const int stepSizeTable[89] = {
 };
     
 static gpointer
-swfdec_codec_adpcm_init (gboolean width, SwfdecAudioOut format)
+swfdec_codec_adpcm_init (SwfdecAudioFormat type, gboolean width, SwfdecAudioOut format)
 {
   return GUINT_TO_POINTER ((guint) format);
 }
diff --git a/libswfdec/swfdec_codec_ffmpeg.c b/libswfdec/swfdec_codec_ffmpeg.c
index 28f4f31..5f2dcaf 100644
--- a/libswfdec/swfdec_codec_ffmpeg.c
+++ b/libswfdec/swfdec_codec_ffmpeg.c
@@ -60,23 +60,24 @@ fail:
 /*** AUDIO ***/
 
 static gpointer
-swfdec_codec_ffmpeg_mp3_init (gboolean width, SwfdecAudioOut format)
+swfdec_codec_ffmpeg_audio_init (SwfdecAudioFormat type, gboolean width, SwfdecAudioOut format)
 {
   AVCodecContext *ctx;
-  
-  ctx = swfdec_codec_ffmpeg_init (CODEC_ID_MP3);
-  ctx->sample_rate = SWFDEC_AUDIO_OUT_RATE (format);
-  ctx->channels = SWFDEC_AUDIO_OUT_N_CHANNELS (format);
-
-  return ctx;
-}
+  enum CodecID id;
 
-static gpointer
-swfdec_codec_ffmpeg_adpcm_init (gboolean width, SwfdecAudioOut format)
-{
-  AVCodecContext *ctx;
-  
-  ctx = swfdec_codec_ffmpeg_init (CODEC_ID_ADPCM_SWF);
+  switch (type) {
+    case SWFDEC_AUDIO_FORMAT_ADPCM:
+      id = CODEC_ID_ADPCM_SWF;
+      break;
+    case SWFDEC_AUDIO_FORMAT_MP3:
+      id = CODEC_ID_MP3;
+      break;
+    default:
+      g_assert_not_reached ();
+      id = 0;
+      break;
+  }
+  ctx = swfdec_codec_ffmpeg_init (id);
   ctx->sample_rate = SWFDEC_AUDIO_OUT_RATE (format);
   ctx->channels = SWFDEC_AUDIO_OUT_N_CHANNELS (format);
 
@@ -190,15 +191,8 @@ swfdec_codec_ffmpeg_audio_finish (gpoint
 }
 
 
-const SwfdecAudioCodec swfdec_codec_ffmpeg_mp3 = {
-  swfdec_codec_ffmpeg_mp3_init,
-  swfdec_codec_ffmpeg_get_format,
-  swfdec_codec_ffmpeg_decode,
-  swfdec_codec_ffmpeg_audio_finish
-};
-
-const SwfdecAudioCodec swfdec_codec_ffmpeg_adpcm = {
-  swfdec_codec_ffmpeg_adpcm_init,
+const SwfdecAudioCodec swfdec_codec_ffmpeg_audio = {
+  swfdec_codec_ffmpeg_audio_init,
   swfdec_codec_ffmpeg_get_format,
   swfdec_codec_ffmpeg_decode,
   swfdec_codec_ffmpeg_audio_finish
@@ -212,10 +206,25 @@ typedef struct {
 } SwfdecCodecFFMpegVideo;
 
 static gpointer
-swfdec_codec_ffmpeg_h263_init (void)
+swfdec_codec_ffmpeg_video_init (SwfdecVideoFormat type)
 {
   SwfdecCodecFFMpegVideo *codec;
-  AVCodecContext *ctx = swfdec_codec_ffmpeg_init (CODEC_ID_FLV1);
+  AVCodecContext *ctx;
+  enum CodecID id;
+
+  switch (type) {
+    case SWFDEC_VIDEO_FORMAT_H263:
+      id = CODEC_ID_FLV1;
+      break;
+    case SWFDEC_VIDEO_FORMAT_SCREEN:
+      id = CODEC_ID_FLASHSV;
+      break;
+    default:
+      g_assert_not_reached ();
+      id = 0;
+      break;
+  }
+  ctx = swfdec_codec_ffmpeg_init (id);
 
   if (ctx == NULL)
     return NULL;
@@ -273,31 +282,9 @@ swfdec_codec_ffmpeg_video_finish (gpoint
   av_free (codec->frame);
 }
 
-static gpointer
-swfdec_codec_ffmpeg_screen_init (void)
-{
-  SwfdecCodecFFMpegVideo *codec;
-  AVCodecContext *ctx = swfdec_codec_ffmpeg_init (CODEC_ID_FLASHSV);
-
-  if (ctx == NULL)
-    return NULL;
-  codec = g_new (SwfdecCodecFFMpegVideo, 1);
-  codec->ctx = ctx;
-  codec->frame = avcodec_alloc_frame ();
-
-  return codec;
-}
-
-
-const SwfdecVideoCodec swfdec_codec_ffmpeg_h263 = {
-  swfdec_codec_ffmpeg_h263_init,
-  swfdec_codec_ffmpeg_video_get_size,
-  swfdec_codec_ffmpeg_video_decode,
-  swfdec_codec_ffmpeg_video_finish
-};
 
-const SwfdecVideoCodec swfdec_codec_ffmpeg_screen = {
-  swfdec_codec_ffmpeg_screen_init,
+const SwfdecVideoCodec swfdec_codec_ffmpeg_video = {
+  swfdec_codec_ffmpeg_video_init,
   swfdec_codec_ffmpeg_video_get_size,
   swfdec_codec_ffmpeg_video_decode,
   swfdec_codec_ffmpeg_video_finish
diff --git a/libswfdec/swfdec_codec_gst.c b/libswfdec/swfdec_codec_gst.c
index ad8c536..c10a201 100644
--- a/libswfdec/swfdec_codec_gst.c
+++ b/libswfdec/swfdec_codec_gst.c
@@ -26,7 +26,7 @@
 #include "swfdec_codec.h"
 #include "swfdec_debug.h"
 
-#if 0
+#if 1
 #define swfdec_cond_wait(cond, mutex) G_STMT_START { \
   g_print ("waiting at %s\n", G_STRLOC); \
   g_cond_wait (cond, mutex); \
@@ -95,6 +95,7 @@ swfdec_codec_gst_fakesrc_handoff (GstEle
     g_mutex_unlock (player->mutex);
     return;
   }
+  g_print ("got one\n");
   buf->data = g_memdup (player->in->data, player->in->length);
   buf->size = player->in->length;
   gst_buffer_set_caps (buf, player->srccaps);
@@ -124,6 +125,7 @@ swfdec_codec_gst_fakesink_handoff (GstEl
     swfdec_cond_wait (player->cond, player->mutex);
   if (player->pipeline == NULL)
     return;
+  g_print ("put one\n");
   player->out = swfdec_buffer_new ();
   player->out->data = g_memdup (buf->data, buf->size);
   player->out->length = buf->size;
@@ -134,13 +136,14 @@ swfdec_codec_gst_fakesink_handoff (GstEl
 static void
 do_the_link (GstElement *src, GstPad *pad, GstElement *sink)
 {
+  g_print ("link!\n");
   if (!gst_element_link (src, sink)) {
     SWFDEC_ERROR ("no delayed link");
   }
 }
 
 static gpointer
-swfdec_codec_gst_h263_init (void)
+swfdec_codec_gst_video_init (SwfdecVideoFormat type)
 {
   SwfdecGstVideo *player;
   GstElement *fakesrc, *fakesink, *decoder, *csp;
@@ -155,7 +158,17 @@ swfdec_codec_gst_h263_init (void)
   g_assert (player->pipeline);
   player->mutex = g_mutex_new ();
   player->cond = g_cond_new ();
-  player->srccaps = gst_caps_from_string ("video/x-flash-video");
+  switch (type) {
+    case SWFDEC_VIDEO_FORMAT_H263:
+      player->srccaps = gst_caps_from_string ("video/x-flash-video");
+      break;
+    case SWFDEC_VIDEO_FORMAT_VP6:
+      player->srccaps = gst_caps_from_string ("video/x-vp6-flash");
+      break;
+    default:
+      g_assert_not_reached ();
+      break;
+  }
   g_assert (player->srccaps);
   fakesrc = gst_element_factory_make ("fakesrc", NULL);
   if (fakesrc == NULL) {
@@ -260,8 +273,8 @@ swfdec_codec_gst_video_decode (gpointer 
   return buffer;
 }
 
-const SwfdecVideoCodec swfdec_codec_gst_h263 = {
-  swfdec_codec_gst_h263_init,
+const SwfdecVideoCodec swfdec_codec_gst_video = {
+  swfdec_codec_gst_video_init,
   swfdec_codec_gst_video_get_size,
   swfdec_codec_gst_video_decode,
   swfdec_codec_gst_video_finish
diff --git a/libswfdec/swfdec_codec_mad.c b/libswfdec/swfdec_codec_mad.c
index 054de4f..8a83928 100644
--- a/libswfdec/swfdec_codec_mad.c
+++ b/libswfdec/swfdec_codec_mad.c
@@ -18,7 +18,7 @@ typedef struct {
 } MadData;
 
 static gpointer
-swfdec_codec_mad_init (gboolean width, SwfdecAudioOut format)
+swfdec_codec_mad_init (SwfdecAudioFormat type, gboolean width, SwfdecAudioOut format)
 {
   MadData *data = g_new (MadData, 1);
 
diff --git a/libswfdec/swfdec_codec_screen.c b/libswfdec/swfdec_codec_screen.c
index 259cf63..6c88696 100644
--- a/libswfdec/swfdec_codec_screen.c
+++ b/libswfdec/swfdec_codec_screen.c
@@ -38,7 +38,7 @@ struct _SwfdecCodecScreen {
 };
 
 static gpointer
-swfdec_codec_screen_init (void)
+swfdec_codec_screen_init (SwfdecVideoFormat type)
 {
   SwfdecCodecScreen *screen = g_new0 (SwfdecCodecScreen, 1);
 
diff --git a/libswfdec/swfdec_flv_decoder.c b/libswfdec/swfdec_flv_decoder.c
index 807447e..ac644e2 100644
--- a/libswfdec/swfdec_flv_decoder.c
+++ b/libswfdec/swfdec_flv_decoder.c
@@ -275,7 +275,7 @@ swfdec_flv_decoder_parse_video_tag (Swfd
 
     if (codec == NULL)
       return SWFDEC_STATUS_OK;
-    decoder = swfdec_video_codec_init (codec);
+    decoder = swfdec_video_codec_init (codec, tag->format);
     if (decoder == NULL)
       return SWFDEC_STATUS_OK;
     ignore = swfdec_video_codec_decode (codec, decoder, tag->buffer);
diff --git a/libswfdec/swfdec_net_stream.c b/libswfdec/swfdec_net_stream.c
index b0bcd4d..7e16631 100644
--- a/libswfdec/swfdec_net_stream.c
+++ b/libswfdec/swfdec_net_stream.c
@@ -89,7 +89,7 @@ swfdec_net_stream_video_goto (SwfdecNetS
       stream->format = format;
       stream->codec = swfdec_codec_get_video (format);
       if (stream->codec)
-	stream->decoder = swfdec_video_codec_init (stream->codec);
+	stream->decoder = swfdec_video_codec_init (stream->codec, format);
       else
 	stream->decoder = NULL;
     }
diff --git a/libswfdec/swfdec_sound.c b/libswfdec/swfdec_sound.c
index f823bc1..2ffa3bc 100644
--- a/libswfdec/swfdec_sound.c
+++ b/libswfdec/swfdec_sound.c
@@ -198,7 +198,7 @@ swfdec_sound_get_decoded (SwfdecSound *s
   if (codec == NULL)
     return NULL;
 
-  decoder = swfdec_audio_codec_init (codec, sound->width, sound->original_format);
+  decoder = swfdec_audio_codec_init (codec, sound->format, sound->width, sound->original_format);
   if (decoder == NULL)
     return NULL;
   sound->decoded_format = swfdec_audio_codec_get_format (codec, decoder);
diff --git a/libswfdec/swfdec_video.c b/libswfdec/swfdec_video.c
index a044606..70afa13 100644
--- a/libswfdec/swfdec_video.c
+++ b/libswfdec/swfdec_video.c
@@ -127,7 +127,7 @@ swfdec_video_input_new (SwfdecVideo *vid
     return NULL;
   input = g_new0 (SwfdecVideoInput, 1);
   if (video->codec)
-    input->decoder = swfdec_video_codec_init (video->codec);
+    input->decoder = swfdec_video_codec_init (video->codec, video->format);
   if (input->decoder == NULL) {
     g_free (input);
     return NULL;
diff-tree cfa44f89551fd40d78259a902c81875dfd8a3209 (from 868538bc67dd0644f7283da03206e8cebe484e39)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 5 17:52:46 2007 +0200

    add gross hack to avoid losing sync

diff --git a/libswfdec/swfdec_audio_flv.c b/libswfdec/swfdec_audio_flv.c
index f829fd5..6e8560a 100644
--- a/libswfdec/swfdec_audio_flv.c
+++ b/libswfdec/swfdec_audio_flv.c
@@ -85,6 +85,9 @@ next:
       /* FIXME: do sync on first frame here */
       SWFDEC_WARNING ("FIXME: didn't get requested timestamp - still loading?");
     }
+    /* FIXME FIXME FIXME: This avoids decoding the last frame forever, however it ensures sync */
+    if (soon == 0)
+      return NULL;
     flv->next_timestamp = soon;
     if (flv->in == 0) {
       /* init */
diff-tree 868538bc67dd0644f7283da03206e8cebe484e39 (from 147beaf2862750cddb57584f5f2d6ee3181f2052)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 5 17:41:12 2007 +0200

    make this work

diff --git a/libswfdec/swfdec_codec_gst.c b/libswfdec/swfdec_codec_gst.c
index c4313aa..ad8c536 100644
--- a/libswfdec/swfdec_codec_gst.c
+++ b/libswfdec/swfdec_codec_gst.c
@@ -26,11 +26,15 @@
 #include "swfdec_codec.h"
 #include "swfdec_debug.h"
 
+#if 0
 #define swfdec_cond_wait(cond, mutex) G_STMT_START { \
   g_print ("waiting at %s\n", G_STRLOC); \
   g_cond_wait (cond, mutex); \
   g_print ("   done at %s\n", G_STRLOC); \
 }G_STMT_END
+#else
+#define swfdec_cond_wait g_cond_wait
+#endif
 
 typedef struct _SwfdecGstVideo SwfdecGstVideo;
 struct _SwfdecGstVideo {
@@ -194,8 +198,13 @@ swfdec_codec_gst_h263_init (void)
   gst_bin_add (GST_BIN (player->pipeline), csp);
   g_signal_connect (decoder, "pad-added", G_CALLBACK (do_the_link), csp);
 
+#if G_BYTE_ORDER == G_BIG_ENDIAN
   sinkcaps = gst_caps_from_string ("video/x-raw-rgb, bpp=32, endianness=4321, depth=24, "
       "red_mask=16711680, green_mask=65280, blue_mask=255");
+#else
+  sinkcaps = gst_caps_from_string ("video/x-raw-rgb, bpp=32, endianness=4321, depth=24, "
+      "red_mask=65280, green_mask=16711680, blue_mask=-16777216");
+#endif
   g_assert (sinkcaps);
   if (!gst_element_link_filtered (fakesrc, decoder, player->srccaps) ||
 #if 0
@@ -241,10 +250,10 @@ swfdec_codec_gst_video_decode (gpointer 
   g_mutex_lock (player->mutex);
   g_assert (player->in == NULL);
   player->in = buffer;
+  g_cond_signal (player->cond);
   while (player->out == NULL) {
     swfdec_cond_wait (player->cond, player->mutex);
   }
-  g_print ("processing buffer\n");
   buffer = player->out;
   player->out = NULL;
   g_mutex_unlock (player->mutex);
diff-tree 147beaf2862750cddb57584f5f2d6ee3181f2052 (from 9367afafdc43e320b2689237f9f302e52d8fac0e)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 5 17:00:21 2007 +0200

    fix depth in debugging message

diff --git a/libswfdec/swfdec_sprite.c b/libswfdec/swfdec_sprite.c
index 1c6a43f..7bb3629 100644
--- a/libswfdec/swfdec_sprite.c
+++ b/libswfdec/swfdec_sprite.c
@@ -292,7 +292,7 @@ swfdec_contents_create (SwfdecSprite *sp
 
     copy = swfdec_content_find (sprite, depth);
     if (copy == NULL) {
-      SWFDEC_WARNING ("Couldn't copy depth %u in frame %u", depth, sprite->parse_frame);
+      SWFDEC_WARNING ("Couldn't copy depth %d in frame %u", (depth + 16384), sprite->parse_frame);
     } else {
       *content = *copy;
       SWFDEC_LOG ("Copying from content %p", copy);


More information about the Swfdec mailing list