[Swfdec] configure.ac libswfdec-gtk/swfdec_gtk_widget.c libswfdec-gtk/swfdec_playback_alsa.c libswfdec/swfdec_as_date.c libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_types.c libswfdec/swfdec_audio_flv.c libswfdec/swfdec_audio_flv.h libswfdec/swfdec_codec_adpcm.c libswfdec/swfdec_codec_audio.c libswfdec/swfdec_codec_audio.h libswfdec/swfdec_codec_ffmpeg.c libswfdec/swfdec_codec_gst.c libswfdec/swfdec_codec_mad.c libswfdec/swfdec_codec_screen.c libswfdec/swfdec_codec_video.c libswfdec/swfdec_codec_video.h libswfdec/swfdec_codec_vp6_alpha.c libswfdec/swfdec_flash_security.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_flv_decoder.h libswfdec/swfdec_internal.h libswfdec/swfdec_movie.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_net_stream.h libswfdec/swfdec_pattern.c libswfdec/swfdec_sound.c libswfdec/swfdec_sound.h libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_text_field_movie.c libswfdec/swfdec_video.h test/dump.c vivified/core vivified/ui
Pekka Lampila
medar at kemper.freedesktop.org
Thu Nov 8 02:12:08 PST 2007
configure.ac | 2 +-
libswfdec-gtk/swfdec_gtk_widget.c | 11 ++++-------
libswfdec-gtk/swfdec_playback_alsa.c | 8 +++++++-
libswfdec/swfdec_as_date.c | 18 ++++++++++--------
libswfdec/swfdec_as_interpret.c | 2 ++
libswfdec/swfdec_as_types.c | 5 +++++
libswfdec/swfdec_audio_flv.c | 2 +-
libswfdec/swfdec_audio_flv.h | 2 +-
libswfdec/swfdec_codec_adpcm.c | 2 +-
libswfdec/swfdec_codec_audio.c | 8 ++++----
libswfdec/swfdec_codec_audio.h | 22 ++++++++++------------
libswfdec/swfdec_codec_ffmpeg.c | 10 +++++-----
libswfdec/swfdec_codec_gst.c | 12 +++++++-----
libswfdec/swfdec_codec_mad.c | 2 +-
libswfdec/swfdec_codec_screen.c | 2 +-
libswfdec/swfdec_codec_video.c | 14 +++++++++-----
libswfdec/swfdec_codec_video.h | 22 ++++++++++------------
libswfdec/swfdec_codec_vp6_alpha.c | 2 +-
libswfdec/swfdec_flash_security.c | 4 ++--
libswfdec/swfdec_flv_decoder.c | 8 ++++----
libswfdec/swfdec_flv_decoder.h | 4 ++--
libswfdec/swfdec_internal.h | 16 ++++++++--------
libswfdec/swfdec_movie.c | 20 +++++++++++++++++++-
libswfdec/swfdec_net_stream.c | 2 +-
libswfdec/swfdec_net_stream.h | 2 +-
libswfdec/swfdec_pattern.c | 4 ++++
libswfdec/swfdec_sound.c | 12 +++++++-----
libswfdec/swfdec_sound.h | 2 +-
libswfdec/swfdec_swf_decoder.c | 2 ++
libswfdec/swfdec_text_field_movie.c | 5 ++++-
libswfdec/swfdec_video.h | 2 +-
test/dump.c | 3 ++-
vivified/core/vivi_wrap.c | 1 +
vivified/ui/vivi_widget.c | 3 ++-
34 files changed, 141 insertions(+), 95 deletions(-)
New commits:
commit 00ff0677e32eda7c9cd22d807c2ab71b7d92ebb6
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date: Thu Nov 8 12:09:18 2007 +0200
Add warnings flags: -Wswitch-enum -Wswitch-default
Remove SwfdecAudioCodec and SwfdecVideoCodec enums and use guint with defines
instead
diff --git a/configure.ac b/configure.ac
index fc48f5c..882a129 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ 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, 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")
+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 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")
diff --git a/libswfdec-gtk/swfdec_gtk_widget.c b/libswfdec-gtk/swfdec_gtk_widget.c
index 8d617fd..eb92313 100644
--- a/libswfdec-gtk/swfdec_gtk_widget.c
+++ b/libswfdec-gtk/swfdec_gtk_widget.c
@@ -193,14 +193,11 @@ swfdec_gtk_widget_key_release (GtkWidget *gtkwidget, GdkEventKey *event)
static cairo_surface_t *
swfdec_gtk_widget_create_renderer (cairo_surface_type_t type, int width, int height)
{
- switch (type) {
- case CAIRO_SURFACE_TYPE_IMAGE:
- return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
- default:
- break;
+ if (type == CAIRO_SURFACE_TYPE_IMAGE) {
+ return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+ } else {
+ return NULL;
}
-
- return NULL;
}
static gboolean
diff --git a/libswfdec-gtk/swfdec_playback_alsa.c b/libswfdec-gtk/swfdec_playback_alsa.c
index 0b7be3d..dd539c5 100644
--- a/libswfdec-gtk/swfdec_playback_alsa.c
+++ b/libswfdec-gtk/swfdec_playback_alsa.c
@@ -189,8 +189,14 @@ swfdec_stream_start (Stream *stream)
swfdec_stream_install_handlers (stream);
}
break;
+ case SND_PCM_STATE_OPEN:
+ case SND_PCM_STATE_SETUP:
+ case SND_PCM_STATE_RUNNING:
+ case SND_PCM_STATE_DRAINING:
+ case SND_PCM_STATE_PAUSED:
+ case SND_PCM_STATE_DISCONNECTED:
default:
- break;
+ g_assert_not_reached ();
}
}
diff --git a/libswfdec/swfdec_as_date.c b/libswfdec/swfdec_as_date.c
index 079093f..cb10e26 100644
--- a/libswfdec/swfdec_as_date.c
+++ b/libswfdec/swfdec_as_date.c
@@ -482,12 +482,19 @@ swfdec_as_date_set_field (SwfdecAsContext *cx, SwfdecAsObject *object,
set = FALSE;
}
break;
- default:
+ case FIELD_MILLISECONDS:
+ case FIELD_SECONDS:
+ case FIELD_MINUTES:
+ case FIELD_HOURS:
+ case FIELD_WEEK_DAYS:
+ case FIELD_MONTH_DAYS:
if (!isfinite (d)) {
swfdec_as_date_set_invalid (date);
set = FALSE;
}
break;
+ default:
+ g_assert_not_reached ();
}
if (set) {
@@ -523,13 +530,8 @@ swfdec_as_date_get_field (SwfdecAsContext *cx, SwfdecAsObject *object,
number = swfdec_as_date_get_brokentime_value (date, utc,
field_offsets[field]);
- switch (field) {
- case FIELD_FULL_YEAR:
- number += 1900;
- break;
- default:
- break;
- }
+ if (field == FIELD_FULL_YEAR)
+ number += 1900;
SWFDEC_AS_VALUE_SET_INT (ret, number);
}
diff --git a/libswfdec/swfdec_as_interpret.c b/libswfdec/swfdec_as_interpret.c
index 6641d72..2cac041 100644
--- a/libswfdec/swfdec_as_interpret.c
+++ b/libswfdec/swfdec_as_interpret.c
@@ -1543,6 +1543,7 @@ swfdec_action_strict_equals (SwfdecAsContext *cx, guint action, const guint8 *da
case SWFDEC_AS_TYPE_OBJECT:
cond = SWFDEC_AS_VALUE_GET_OBJECT (rval) == SWFDEC_AS_VALUE_GET_OBJECT (lval);
break;
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
cond = FALSE;
@@ -2132,6 +2133,7 @@ swfdec_action_type_of (SwfdecAsContext *cx, guint action, const guint8 *data, gu
}
}
break;
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
type = SWFDEC_AS_STR_EMPTY;
diff --git a/libswfdec/swfdec_as_types.c b/libswfdec/swfdec_as_types.c
index cfc58a8..6445e60 100644
--- a/libswfdec/swfdec_as_types.c
+++ b/libswfdec/swfdec_as_types.c
@@ -387,6 +387,7 @@ swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
return SWFDEC_AS_STR__type_Object_;
}
}
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
return SWFDEC_AS_STR_EMPTY;
@@ -420,6 +421,7 @@ swfdec_as_value_to_debug (const SwfdecAsValue *value)
return g_strdup_printf ("%g", SWFDEC_AS_VALUE_GET_NUMBER (value));
case SWFDEC_AS_TYPE_OBJECT:
return swfdec_as_object_get_debug (SWFDEC_AS_VALUE_GET_OBJECT (value));
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
return NULL;
@@ -474,6 +476,7 @@ swfdec_as_value_to_number (SwfdecAsContext *context, const SwfdecAsValue *value)
}
case SWFDEC_AS_TYPE_OBJECT:
return NAN;
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
return NAN;
@@ -545,6 +548,7 @@ swfdec_as_value_to_object (SwfdecAsContext *context, const SwfdecAsValue *value)
break;
case SWFDEC_AS_TYPE_OBJECT:
return SWFDEC_AS_VALUE_GET_OBJECT (value);
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
return NULL;
@@ -601,6 +605,7 @@ swfdec_as_value_to_boolean (SwfdecAsContext *context, const SwfdecAsValue *value
}
case SWFDEC_AS_TYPE_OBJECT:
return TRUE;
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
return FALSE;
diff --git a/libswfdec/swfdec_audio_flv.c b/libswfdec/swfdec_audio_flv.c
index d611066..59de5c5 100644
--- a/libswfdec/swfdec_audio_flv.c
+++ b/libswfdec/swfdec_audio_flv.c
@@ -49,7 +49,7 @@ static SwfdecBuffer *
swfdec_audio_flv_decode_one (SwfdecAudioFlv *flv)
{
SwfdecBuffer *buffer;
- SwfdecAudioCodec format;
+ guint format;
SwfdecAudioFormat in;
guint now, soon;
diff --git a/libswfdec/swfdec_audio_flv.h b/libswfdec/swfdec_audio_flv.h
index e67294d..52ac2a5 100644
--- a/libswfdec/swfdec_audio_flv.h
+++ b/libswfdec/swfdec_audio_flv.h
@@ -40,7 +40,7 @@ struct _SwfdecAudioFlv
SwfdecAudio audio;
SwfdecFlvDecoder * flvdecoder; /* decoder we play back */
- SwfdecAudioCodec format; /* codec format of audio */
+ guint format; /* codec format of audio */
gboolean width; /* width of audio */
SwfdecAudioFormat in; /* input format of data */
SwfdecAudioDecoder * decoder; /* decoder used for playback */
diff --git a/libswfdec/swfdec_codec_adpcm.c b/libswfdec/swfdec_codec_adpcm.c
index a87065a..1fc17ee 100644
--- a/libswfdec/swfdec_codec_adpcm.c
+++ b/libswfdec/swfdec_codec_adpcm.c
@@ -167,7 +167,7 @@ swfdec_audio_decoder_adpcm_free (SwfdecAudioDecoder *dec)
}
SwfdecAudioDecoder *
-swfdec_audio_decoder_adpcm_new (SwfdecAudioCodec type, SwfdecAudioFormat format)
+swfdec_audio_decoder_adpcm_new (guint type, SwfdecAudioFormat format)
{
SwfdecAudioDecoderAdpcm *adpcm;
diff --git a/libswfdec/swfdec_codec_audio.c b/libswfdec/swfdec_codec_audio.c
index 77ae76b..46e6d47 100644
--- a/libswfdec/swfdec_codec_audio.c
+++ b/libswfdec/swfdec_codec_audio.c
@@ -84,7 +84,7 @@ swfdec_audio_decoder_uncompressed_free (SwfdecAudioDecoder *decoder)
}
static SwfdecAudioDecoder *
-swfdec_audio_decoder_uncompressed_new (SwfdecAudioCodec type, SwfdecAudioFormat format)
+swfdec_audio_decoder_uncompressed_new (guint type, SwfdecAudioFormat format)
{
SwfdecAudioDecoderUncompressed *dec;
@@ -110,7 +110,7 @@ swfdec_audio_decoder_uncompressed_new (SwfdecAudioCodec type, SwfdecAudioFormat
/*** PUBLIC API ***/
static SwfdecAudioDecoder *
-swfdec_audio_decoder_builtin_new (SwfdecAudioCodec codec, SwfdecAudioFormat format)
+swfdec_audio_decoder_builtin_new (guint codec, SwfdecAudioFormat format)
{
SwfdecAudioDecoder *ret;
@@ -123,7 +123,7 @@ swfdec_audio_decoder_builtin_new (SwfdecAudioCodec codec, SwfdecAudioFormat form
struct {
const char * name;
- SwfdecAudioDecoder * (* func) (SwfdecAudioCodec, SwfdecAudioFormat);
+ SwfdecAudioDecoder * (* func) (guint, SwfdecAudioFormat);
} audio_codecs[] = {
{ "builtin", swfdec_audio_decoder_builtin_new },
#ifdef HAVE_GST
@@ -148,7 +148,7 @@ struct {
* Returns: a new decoder or %NULL
**/
SwfdecAudioDecoder *
-swfdec_audio_decoder_new (SwfdecAudioCodec codec, SwfdecAudioFormat format)
+swfdec_audio_decoder_new (guint codec, SwfdecAudioFormat format)
{
SwfdecAudioDecoder *ret;
const char *list;
diff --git a/libswfdec/swfdec_codec_audio.h b/libswfdec/swfdec_codec_audio.h
index 8a0f4f1..48eb139 100644
--- a/libswfdec/swfdec_codec_audio.h
+++ b/libswfdec/swfdec_codec_audio.h
@@ -26,19 +26,17 @@
typedef struct _SwfdecAudioDecoder SwfdecAudioDecoder;
-typedef enum {
- SWFDEC_AUDIO_CODEC_UNDEFINED = 0,
- SWFDEC_AUDIO_CODEC_ADPCM = 1,
- SWFDEC_AUDIO_CODEC_MP3 = 2,
- SWFDEC_AUDIO_CODEC_UNCOMPRESSED = 3,
- SWFDEC_AUDIO_CODEC_NELLYMOSER_8KHZ = 5,
- SWFDEC_AUDIO_CODEC_NELLYMOSER = 6
-} SwfdecAudioCodec;
-
-typedef SwfdecAudioDecoder * (SwfdecAudioDecoderNewFunc) (SwfdecAudioCodec type, gboolean width,
+#define SWFDEC_AUDIO_CODEC_UNDEFINED 0
+#define SWFDEC_AUDIO_CODEC_ADPCM 1
+#define SWFDEC_AUDIO_CODEC_MP3 2
+#define SWFDEC_AUDIO_CODEC_UNCOMPRESSED 3
+#define SWFDEC_AUDIO_CODEC_NELLYMOSER_8KHZ 5
+#define SWFDEC_AUDIO_CODEC_NELLYMOSER 6
+
+typedef SwfdecAudioDecoder * (SwfdecAudioDecoderNewFunc) (guint type, gboolean width,
SwfdecAudioFormat format);
struct _SwfdecAudioDecoder {
- SwfdecAudioCodec codec;
+ guint codec;
SwfdecAudioFormat format;
void (* push) (SwfdecAudioDecoder * decoder,
SwfdecBuffer * buffer);
@@ -46,7 +44,7 @@ struct _SwfdecAudioDecoder {
void (* free) (SwfdecAudioDecoder * decoder);
};
-SwfdecAudioDecoder * swfdec_audio_decoder_new (SwfdecAudioCodec codec,
+SwfdecAudioDecoder * swfdec_audio_decoder_new (guint codec,
SwfdecAudioFormat format);
void swfdec_audio_decoder_free (SwfdecAudioDecoder * decoder);
SwfdecAudioFormat swfdec_audio_decoder_get_format (SwfdecAudioDecoder * decoder);
diff --git a/libswfdec/swfdec_codec_ffmpeg.c b/libswfdec/swfdec_codec_ffmpeg.c
index d817281..9e159d3 100644
--- a/libswfdec/swfdec_codec_ffmpeg.c
+++ b/libswfdec/swfdec_codec_ffmpeg.c
@@ -170,7 +170,7 @@ swfdec_audio_decoder_ffmpeg_free (SwfdecAudioDecoder *dec)
}
SwfdecAudioDecoder *
-swfdec_audio_decoder_ffmpeg_new (SwfdecAudioCodec type, SwfdecAudioFormat format)
+swfdec_audio_decoder_ffmpeg_new (guint type, SwfdecAudioFormat format)
{
SwfdecAudioDecoderFFMpeg *ffmpeg;
AVCodecContext *ctx;
@@ -212,16 +212,16 @@ typedef struct {
} SwfdecVideoDecoderFFMpeg;
static enum PixelFormat
-swfdec_video_decoder_ffmpeg_get_format (SwfdecVideoCodec codec)
+swfdec_video_decoder_ffmpeg_get_format (guint codec)
{
switch (swfdec_video_codec_get_format (codec)) {
case SWFDEC_VIDEO_FORMAT_RGBA:
return PIX_FMT_RGB32;
case SWFDEC_VIDEO_FORMAT_I420:
return PIX_FMT_YUV420P;
+ default:
+ g_return_val_if_reached (PIX_FMT_RGB32);
}
- g_assert_not_reached ();
- return PIX_FMT_RGB32;
}
#define ALIGNMENT 31
@@ -282,7 +282,7 @@ swfdec_video_decoder_ffmpeg_free (SwfdecVideoDecoder *dec)
}
SwfdecVideoDecoder *
-swfdec_video_decoder_ffmpeg_new (SwfdecVideoCodec type)
+swfdec_video_decoder_ffmpeg_new (guint type)
{
SwfdecVideoDecoderFFMpeg *codec;
AVCodecContext *ctx;
diff --git a/libswfdec/swfdec_codec_gst.c b/libswfdec/swfdec_codec_gst.c
index a16d700..22c5638 100644
--- a/libswfdec/swfdec_codec_gst.c
+++ b/libswfdec/swfdec_codec_gst.c
@@ -406,7 +406,7 @@ swfdec_audio_decoder_set_caps (GstPad *pad, GstCaps *caps)
}
SwfdecAudioDecoder *
-swfdec_audio_decoder_gst_new (SwfdecAudioCodec type, SwfdecAudioFormat format)
+swfdec_audio_decoder_gst_new (guint type, SwfdecAudioFormat format)
{
SwfdecGstAudio *player;
GstCaps *srccaps, *sinkcaps;
@@ -549,12 +549,14 @@ swfdec_video_decoder_gst_decode (SwfdecVideoDecoder *dec, SwfdecBuffer *buffer,
image->rowstride[2] = image->rowstride[1];
g_assert (image->plane[2] + image->rowstride[2] * ALIGN (image->height, 2) / 2 == image->plane[0] + buf->size);
break;
+ default:
+ g_return_val_if_reached (FALSE);
}
return TRUE;
}
static GstCaps *
-swfdec_video_decoder_get_sink_caps (SwfdecVideoCodec codec)
+swfdec_video_decoder_get_sink_caps (guint codec)
{
switch (swfdec_video_codec_get_format (codec)) {
case SWFDEC_VIDEO_FORMAT_RGBA:
@@ -567,13 +569,13 @@ swfdec_video_decoder_get_sink_caps (SwfdecVideoCodec codec)
#endif
case SWFDEC_VIDEO_FORMAT_I420:
return gst_caps_from_string ("video/x-raw-yuv, format=(fourcc)I420");
+ default:
+ g_return_val_if_reached (NULL);
}
- g_assert_not_reached ();
- return NULL;
}
SwfdecVideoDecoder *
-swfdec_video_decoder_gst_new (SwfdecVideoCodec codec)
+swfdec_video_decoder_gst_new (guint codec)
{
SwfdecGstVideo *player;
GstCaps *srccaps, *sinkcaps;
diff --git a/libswfdec/swfdec_codec_mad.c b/libswfdec/swfdec_codec_mad.c
index a980488..ec15231 100644
--- a/libswfdec/swfdec_codec_mad.c
+++ b/libswfdec/swfdec_codec_mad.c
@@ -212,7 +212,7 @@ swfdec_audio_decoder_mad_pull (SwfdecAudioDecoder *dec)
}
SwfdecAudioDecoder *
-swfdec_audio_decoder_mad_new (SwfdecAudioCodec type, SwfdecAudioFormat format)
+swfdec_audio_decoder_mad_new (guint type, SwfdecAudioFormat format)
{
MadData *data;
diff --git a/libswfdec/swfdec_codec_screen.c b/libswfdec/swfdec_codec_screen.c
index 233af0d..5dbdfce 100644
--- a/libswfdec/swfdec_codec_screen.c
+++ b/libswfdec/swfdec_codec_screen.c
@@ -118,7 +118,7 @@ swfdec_video_decoder_screen_free (SwfdecVideoDecoder *dec)
}
SwfdecVideoDecoder *
-swfdec_video_decoder_screen_new (SwfdecVideoCodec type)
+swfdec_video_decoder_screen_new (guint type)
{
SwfdecCodecScreen *screen;
diff --git a/libswfdec/swfdec_codec_video.c b/libswfdec/swfdec_codec_video.c
index bfde110..dcd03ce 100644
--- a/libswfdec/swfdec_codec_video.c
+++ b/libswfdec/swfdec_codec_video.c
@@ -28,7 +28,7 @@
#include "swfdec_internal.h"
static SwfdecVideoDecoder *
-swfdec_video_decoder_builtin_new (SwfdecVideoCodec codec)
+swfdec_video_decoder_builtin_new (guint codec)
{
SwfdecVideoDecoder *ret;
@@ -41,7 +41,7 @@ swfdec_video_decoder_builtin_new (SwfdecVideoCodec codec)
struct {
const char * name;
- SwfdecVideoDecoder * (* func) (SwfdecVideoCodec);
+ SwfdecVideoDecoder * (* func) (guint);
} video_codecs[] = {
{ "builtin", swfdec_video_decoder_builtin_new },
#ifdef HAVE_GST
@@ -63,7 +63,7 @@ struct {
* Returns:
**/
SwfdecVideoDecoder *
-swfdec_video_decoder_new (SwfdecVideoCodec codec)
+swfdec_video_decoder_new (guint codec)
{
SwfdecVideoDecoder *ret;
const char *list;
@@ -302,15 +302,19 @@ swfdec_video_decoder_decode (SwfdecVideoDecoder *decoder, SwfdecBuffer *buffer)
* Returns: the output format to use for this format
**/
SwfdecVideoFormat
-swfdec_video_codec_get_format (SwfdecVideoCodec codec)
+swfdec_video_codec_get_format (guint codec)
{
switch (codec) {
case SWFDEC_VIDEO_CODEC_H263:
case SWFDEC_VIDEO_CODEC_VP6:
case SWFDEC_VIDEO_CODEC_VP6_ALPHA:
return SWFDEC_VIDEO_FORMAT_I420;
- default:
+ case SWFDEC_VIDEO_CODEC_UNDEFINED:
+ case SWFDEC_VIDEO_CODEC_SCREEN:
+ case SWFDEC_VIDEO_CODEC_SCREEN2:
return SWFDEC_VIDEO_FORMAT_RGBA;
+ default:
+ g_return_val_if_reached (SWFDEC_VIDEO_FORMAT_RGBA);
}
}
diff --git a/libswfdec/swfdec_codec_video.h b/libswfdec/swfdec_codec_video.h
index c5606c1..a7c968a 100644
--- a/libswfdec/swfdec_codec_video.h
+++ b/libswfdec/swfdec_codec_video.h
@@ -24,14 +24,12 @@
#include <cairo.h>
#include <libswfdec/swfdec_buffer.h>
-typedef enum {
- SWFDEC_VIDEO_CODEC_UNDEFINED = 0,
- SWFDEC_VIDEO_CODEC_H263 = 2,
- SWFDEC_VIDEO_CODEC_SCREEN = 3,
- SWFDEC_VIDEO_CODEC_VP6 = 4,
- SWFDEC_VIDEO_CODEC_VP6_ALPHA = 5,
- SWFDEC_VIDEO_CODEC_SCREEN2 = 6
-} SwfdecVideoCodec;
+#define SWFDEC_VIDEO_CODEC_UNDEFINED 0
+#define SWFDEC_VIDEO_CODEC_H263 2
+#define SWFDEC_VIDEO_CODEC_SCREEN 3
+#define SWFDEC_VIDEO_CODEC_VP6 4
+#define SWFDEC_VIDEO_CODEC_VP6_ALPHA 5
+#define SWFDEC_VIDEO_CODEC_SCREEN2 6
typedef enum {
SWFDEC_VIDEO_FORMAT_RGBA,
@@ -48,7 +46,7 @@ typedef struct {
} SwfdecVideoImage;
typedef struct _SwfdecVideoDecoder SwfdecVideoDecoder;
-typedef SwfdecVideoDecoder * (SwfdecVideoDecoderNewFunc) (SwfdecVideoCodec format);
+typedef SwfdecVideoDecoder * (SwfdecVideoDecoderNewFunc) (guint format);
/* notes about the decode function:
* - the data must be in the format specified by swfdec_video_codec_get_format()
@@ -57,16 +55,16 @@ typedef SwfdecVideoDecoder * (SwfdecVideoDecoderNewFunc) (SwfdecVideoCodec forma
* - you need to explicitly set mask to %NULL.
*/
struct _SwfdecVideoDecoder {
- SwfdecVideoCodec codec;
+ guint codec;
gboolean (* decode) (SwfdecVideoDecoder * decoder,
SwfdecBuffer * buffer,
SwfdecVideoImage * result);
void (* free) (SwfdecVideoDecoder * decoder);
};
-SwfdecVideoFormat swfdec_video_codec_get_format (SwfdecVideoCodec codec);
+SwfdecVideoFormat swfdec_video_codec_get_format (guint codec);
-SwfdecVideoDecoder * swfdec_video_decoder_new (SwfdecVideoCodec codec);
+SwfdecVideoDecoder * swfdec_video_decoder_new (guint codec);
void swfdec_video_decoder_free (SwfdecVideoDecoder * decoder);
cairo_surface_t * swfdec_video_decoder_decode (SwfdecVideoDecoder * decoder,
diff --git a/libswfdec/swfdec_codec_vp6_alpha.c b/libswfdec/swfdec_codec_vp6_alpha.c
index 2d6ca9d..672d3d7 100644
--- a/libswfdec/swfdec_codec_vp6_alpha.c
+++ b/libswfdec/swfdec_codec_vp6_alpha.c
@@ -89,7 +89,7 @@ swfdec_video_decoder_vp6_alpha_free (SwfdecVideoDecoder *dec)
}
SwfdecVideoDecoder *
-swfdec_video_decoder_vp6_alpha_new (SwfdecVideoCodec type)
+swfdec_video_decoder_vp6_alpha_new (guint type)
{
SwfdecCodecVp6Alpha *vp6;
diff --git a/libswfdec/swfdec_flash_security.c b/libswfdec/swfdec_flash_security.c
index 70cb7cf..432976a 100644
--- a/libswfdec/swfdec_flash_security.c
+++ b/libswfdec/swfdec_flash_security.c
@@ -70,9 +70,9 @@ swfdec_flash_security_allow_url (SwfdecSecurity *guard, const SwfdecURL *url)
return !swfdec_url_is_local (url);
case SWFDEC_SANDBOX_LOCAL_TRUSTED:
return TRUE;
+ default:
+ g_return_val_if_reached (FALSE);
}
- g_assert_not_reached ();
- return FALSE;
}
static void
diff --git a/libswfdec/swfdec_flv_decoder.c b/libswfdec/swfdec_flv_decoder.c
index 81e7e36..465852d 100644
--- a/libswfdec/swfdec_flv_decoder.c
+++ b/libswfdec/swfdec_flv_decoder.c
@@ -39,14 +39,14 @@ typedef struct _SwfdecFlvDataTag SwfdecFlvDataTag;
struct _SwfdecFlvVideoTag {
guint timestamp; /* milliseconds */
- SwfdecVideoCodec format; /* format in use */
+ guint format; /* format in use */
int frame_type; /* 0: undefined, 1: keyframe, 2: iframe, 3: H263 disposable iframe */
SwfdecBuffer * buffer; /* buffer for this data */
};
struct _SwfdecFlvAudioTag {
guint timestamp; /* milliseconds */
- SwfdecAudioCodec format; /* format in use */
+ guint format; /* format in use */
SwfdecAudioFormat original_format; /* channel/rate information */
SwfdecBuffer * buffer; /* buffer for this data */
};
@@ -453,7 +453,7 @@ swfdec_flv_decoder_init (SwfdecFlvDecoder *flv)
SwfdecBuffer *
swfdec_flv_decoder_get_video (SwfdecFlvDecoder *flv, guint timestamp,
- gboolean keyframe, SwfdecVideoCodec *format, guint *real_timestamp, guint *next_timestamp)
+ gboolean keyframe, guint *format, guint *real_timestamp, guint *next_timestamp)
{
guint id, offset;
SwfdecFlvVideoTag *tag;
@@ -518,7 +518,7 @@ swfdec_flv_decoder_get_video_info (SwfdecFlvDecoder *flv,
SwfdecBuffer *
swfdec_flv_decoder_get_audio (SwfdecFlvDecoder *flv, guint timestamp,
- SwfdecAudioCodec *codec, SwfdecAudioFormat *format,
+ guint *codec, SwfdecAudioFormat *format,
guint *real_timestamp, guint *next_timestamp)
{
guint id, offset;
diff --git a/libswfdec/swfdec_flv_decoder.h b/libswfdec/swfdec_flv_decoder.h
index 423050f..5ad5114 100644
--- a/libswfdec/swfdec_flv_decoder.h
+++ b/libswfdec/swfdec_flv_decoder.h
@@ -61,7 +61,7 @@ void swfdec_flv_decoder_eof (SwfdecFlvDecoder * flv);
SwfdecBuffer * swfdec_flv_decoder_get_video (SwfdecFlvDecoder * flv,
guint timestamp,
gboolean keyframe,
- SwfdecVideoCodec * format,
+ guint * format,
guint * real_timestamp,
guint * next_timestamp);
gboolean swfdec_flv_decoder_get_video_info (SwfdecFlvDecoder * flv,
@@ -69,7 +69,7 @@ gboolean swfdec_flv_decoder_get_video_info (SwfdecFlvDecoder * flv,
guint * last_timestamp);
SwfdecBuffer * swfdec_flv_decoder_get_audio (SwfdecFlvDecoder * flv,
guint timestamp,
- SwfdecAudioCodec * codec,
+ guint * codec,
SwfdecAudioFormat * format,
guint * real_timestamp,
guint * next_timestamp);
diff --git a/libswfdec/swfdec_internal.h b/libswfdec/swfdec_internal.h
index 630a905..c2f810d 100644
--- a/libswfdec/swfdec_internal.h
+++ b/libswfdec/swfdec_internal.h
@@ -31,30 +31,30 @@ G_BEGIN_DECLS
/* audio codecs */
-SwfdecAudioDecoder * swfdec_audio_decoder_adpcm_new (SwfdecAudioCodec type,
+SwfdecAudioDecoder * swfdec_audio_decoder_adpcm_new (guint type,
SwfdecAudioFormat format);
#ifdef HAVE_MAD
-SwfdecAudioDecoder * swfdec_audio_decoder_mad_new (SwfdecAudioCodec type,
+SwfdecAudioDecoder * swfdec_audio_decoder_mad_new (guint type,
SwfdecAudioFormat format);
#endif
#ifdef HAVE_FFMPEG
-SwfdecAudioDecoder * swfdec_audio_decoder_ffmpeg_new (SwfdecAudioCodec type,
+SwfdecAudioDecoder * swfdec_audio_decoder_ffmpeg_new (guint type,
SwfdecAudioFormat format);
#endif
#ifdef HAVE_GST
-SwfdecAudioDecoder * swfdec_audio_decoder_gst_new (SwfdecAudioCodec type,
+SwfdecAudioDecoder * swfdec_audio_decoder_gst_new (guint type,
SwfdecAudioFormat format);
#endif
/* video codecs */
-SwfdecVideoDecoder * swfdec_video_decoder_screen_new (SwfdecVideoCodec format);
-SwfdecVideoDecoder * swfdec_video_decoder_vp6_alpha_new (SwfdecVideoCodec format);
+SwfdecVideoDecoder * swfdec_video_decoder_screen_new (guint format);
+SwfdecVideoDecoder * swfdec_video_decoder_vp6_alpha_new (guint format);
#ifdef HAVE_FFMPEG
-SwfdecVideoDecoder * swfdec_video_decoder_ffmpeg_new (SwfdecVideoCodec format);
+SwfdecVideoDecoder * swfdec_video_decoder_ffmpeg_new (guint format);
#endif
#ifdef HAVE_GST
-SwfdecVideoDecoder * swfdec_video_decoder_gst_new (SwfdecVideoCodec format);
+SwfdecVideoDecoder * swfdec_video_decoder_gst_new (guint format);
#endif
/* AS engine setup code */
diff --git a/libswfdec/swfdec_movie.c b/libswfdec/swfdec_movie.c
index 9c028a1..1859971 100644
--- a/libswfdec/swfdec_movie.c
+++ b/libswfdec/swfdec_movie.c
@@ -418,9 +418,27 @@ swfdec_movie_queue_script (SwfdecMovie *movie, SwfdecEventType condition)
case SWFDEC_EVENT_CONSTRUCT:
importance = 1;
break;
- default:
+ case SWFDEC_EVENT_LOAD:
+ case SWFDEC_EVENT_ENTER:
+ case SWFDEC_EVENT_UNLOAD:
+ case SWFDEC_EVENT_MOUSE_MOVE:
+ case SWFDEC_EVENT_MOUSE_DOWN:
+ case SWFDEC_EVENT_MOUSE_UP:
+ case SWFDEC_EVENT_KEY_UP:
+ case SWFDEC_EVENT_KEY_DOWN:
+ case SWFDEC_EVENT_DATA:
+ case SWFDEC_EVENT_PRESS:
+ case SWFDEC_EVENT_RELEASE:
+ case SWFDEC_EVENT_RELEASE_OUTSIDE:
+ case SWFDEC_EVENT_ROLL_OVER:
+ case SWFDEC_EVENT_ROLL_OUT:
+ case SWFDEC_EVENT_DRAG_OVER:
+ case SWFDEC_EVENT_DRAG_OUT:
+ case SWFDEC_EVENT_KEY_PRESS:
importance = 2;
break;
+ default:
+ g_return_val_if_reached (FALSE);
}
if (movie->events &&
diff --git a/libswfdec/swfdec_net_stream.c b/libswfdec/swfdec_net_stream.c
index 0d719f0..255bb34 100644
--- a/libswfdec/swfdec_net_stream.c
+++ b/libswfdec/swfdec_net_stream.c
@@ -89,7 +89,7 @@ static void
swfdec_net_stream_video_goto (SwfdecNetStream *stream, guint timestamp)
{
SwfdecBuffer *buffer;
- SwfdecVideoCodec format;
+ guint format;
cairo_surface_t *old;
gboolean process_events;
guint process_events_from;
diff --git a/libswfdec/swfdec_net_stream.h b/libswfdec/swfdec_net_stream.h
index 4af94ca..253f8ce 100644
--- a/libswfdec/swfdec_net_stream.h
+++ b/libswfdec/swfdec_net_stream.h
@@ -57,7 +57,7 @@ struct _SwfdecNetStream
/* video decoding */
guint current_time; /* current playback timestamp */
guint next_time; /* next video image at this timestamp */
- SwfdecVideoCodec format; /* current format */
+ guint format; /* current format */
SwfdecVideoDecoder * decoder; /* decoder used for decoding */
cairo_surface_t * surface; /* current image */
SwfdecTimeout timeout; /* timeout to advance to */
diff --git a/libswfdec/swfdec_pattern.c b/libswfdec/swfdec_pattern.c
index a9427bc..d5aaaaa 100644
--- a/libswfdec/swfdec_pattern.c
+++ b/libswfdec/swfdec_pattern.c
@@ -397,6 +397,8 @@ swfdec_pattern_do_parse (SwfdecBits *bits, SwfdecSwfDecoder *dec, gboolean rgba)
SWFDEC_ERROR ("spread mode 3 is undefined for gradients");
gradient->extend = CAIRO_EXTEND_PAD;
break;
+ default:
+ g_assert_not_reached ();
}
interpolation = swfdec_bits_getbits (bits, 2);
if (interpolation) {
@@ -542,6 +544,8 @@ swfdec_pattern_parse_morph (SwfdecBits *bits, SwfdecSwfDecoder *dec)
SWFDEC_ERROR ("spread mode 3 is undefined for gradients");
gradient->extend = CAIRO_EXTEND_PAD;
break;
+ default:
+ g_assert_not_reached ();
}
interpolation = swfdec_bits_getbits (bits, 2);
if (interpolation) {
diff --git a/libswfdec/swfdec_sound.c b/libswfdec/swfdec_sound.c
index 06022bc..0d795e7 100644
--- a/libswfdec/swfdec_sound.c
+++ b/libswfdec/swfdec_sound.c
@@ -265,23 +265,25 @@ tag_func_sound_stream_head (SwfdecSwfDecoder * s, guint tag)
s->parse_sprite->frames[s->parse_sprite->parse_frame].sound_head = sound;
switch (sound->codec) {
- case 0:
+ case SWFDEC_AUDIO_CODEC_UNDEFINED:
if (swfdec_audio_format_is_16bit (sound->format)) {
SWFDEC_WARNING ("undefined endianness for s16 sound");
/* just assume LE and hope it works (FIXME: want a switch for this?) */
sound->codec = SWFDEC_AUDIO_CODEC_UNCOMPRESSED;
}
break;
- case 2:
+ case SWFDEC_AUDIO_CODEC_MP3:
/* latency seek */
latency = swfdec_bits_get_s16 (b);
break;
- case 1:
- case 3:
- case 6:
+ case SWFDEC_AUDIO_CODEC_ADPCM:
+ case SWFDEC_AUDIO_CODEC_UNCOMPRESSED:
+ case SWFDEC_AUDIO_CODEC_NELLYMOSER_8KHZ:
+ case SWFDEC_AUDIO_CODEC_NELLYMOSER:
break;
default:
SWFDEC_WARNING ("unknown codec %d", sound->codec);
+ sound->codec = SWFDEC_AUDIO_CODEC_UNDEFINED;
}
return SWFDEC_STATUS_OK;
diff --git a/libswfdec/swfdec_sound.h b/libswfdec/swfdec_sound.h
index abcf5ad..75e917e 100644
--- a/libswfdec/swfdec_sound.h
+++ b/libswfdec/swfdec_sound.h
@@ -63,7 +63,7 @@ struct _SwfdecSound
{
SwfdecCached cached;
- SwfdecAudioCodec codec; /* codec in use */
+ guint codec; /* codec in use */
SwfdecAudioFormat format; /* channel/rate/width information for codec */
guint n_samples; /* total number of samples when decoded to 44100kHz */
guint skip; /* samples to skip at start */
diff --git a/libswfdec/swfdec_swf_decoder.c b/libswfdec/swfdec_swf_decoder.c
index ee18f9a..4a9b069 100644
--- a/libswfdec/swfdec_swf_decoder.c
+++ b/libswfdec/swfdec_swf_decoder.c
@@ -364,6 +364,8 @@ swfdec_swf_decoder_parse_one (SwfdecSwfDecoder *s)
SWFDEC_WARNING ("%u bytes after EOF", SWFDEC_DECODER (s)->bytes_loaded - s->bytes_parsed);
}
return SWFDEC_STATUS_EOF;
+ default:
+ g_assert_not_reached ();
}
/* copy state */
diff --git a/libswfdec/swfdec_text_field_movie.c b/libswfdec/swfdec_text_field_movie.c
index 043efec..74b4262 100644
--- a/libswfdec/swfdec_text_field_movie.c
+++ b/libswfdec/swfdec_text_field_movie.c
@@ -102,6 +102,8 @@ swfdec_text_paragraph_add_block (SwfdecParagraph *paragraph, int index_,
block->align = PANGO_ALIGN_LEFT;
block->justify = TRUE;
break;
+ default:
+ g_assert_not_reached ();
}
block->leading = format->leading * 20 * PANGO_SCALE;
block->block_indent = format->block_indent * 20;
@@ -1007,8 +1009,9 @@ swfdec_text_field_movie_auto_size (SwfdecTextFieldMovie *text)
graphic->extents.x0 += floor (diff / 2.0);
graphic->extents.x1 = graphic->extents.x0 + width;
break;
+ case SWFDEC_AUTO_SIZE_NONE:
default:
- g_assert_not_reached ();
+ g_return_val_if_reached (FALSE);
}
}
diff --git a/libswfdec/swfdec_video.h b/libswfdec/swfdec_video.h
index 706f2d3..585c726 100644
--- a/libswfdec/swfdec_video.h
+++ b/libswfdec/swfdec_video.h
@@ -42,7 +42,7 @@ struct _SwfdecVideo {
guint n_frames; /* length of movie */
GArray * images; /* actual images of the movie */
- SwfdecVideoCodec format; /* format in use */
+ guint format; /* format in use */
};
struct _SwfdecVideoClass {
diff --git a/test/dump.c b/test/dump.c
index 38aee7e..254a19c 100644
--- a/test/dump.c
+++ b/test/dump.c
@@ -48,7 +48,7 @@
static gboolean verbose = FALSE;
static const char *
-get_audio_format_name (SwfdecAudioCodec codec)
+get_audio_format_name (guint codec)
{
switch (codec) {
case SWFDEC_AUDIO_CODEC_ADPCM:
@@ -316,6 +316,7 @@ get_image_type_name (SwfdecImageType type)
return "lossless";
case SWFDEC_IMAGE_TYPE_LOSSLESS2:
return "lossless with alpha";
+ case SWFDEC_IMAGE_TYPE_UNKNOWN:
default:
g_assert_not_reached ();
return "Unknown";
diff --git a/vivified/core/vivi_wrap.c b/vivified/core/vivi_wrap.c
index 4be1e76..da86446 100644
--- a/vivified/core/vivi_wrap.c
+++ b/vivified/core/vivi_wrap.c
@@ -105,6 +105,7 @@ vivi_wrap_value (ViviApplication *app, SwfdecAsValue *dest, const SwfdecAsValue
SWFDEC_AS_VALUE_SET_OBJECT (dest,
vivi_wrap_object (app, SWFDEC_AS_VALUE_GET_OBJECT (src)));
break;
+ case SWFDEC_AS_TYPE_INT:
default:
g_assert_not_reached ();
break;
diff --git a/vivified/ui/vivi_widget.c b/vivified/ui/vivi_widget.c
index fa9c2ac..e0ca455 100644
--- a/vivified/ui/vivi_widget.c
+++ b/vivified/ui/vivi_widget.c
@@ -96,7 +96,8 @@ vivi_widget_button_press (GtkWidget *gtkwidget, GdkEventButton *event)
if (event->button == 1 && swfdec_gtk_widget_get_interactive (widget)) {
SwfdecPlayer *player = swfdec_gtk_widget_get_player (widget);
- switch (event->type) {
+ // cast to int to get rid of unhandled enum warnings...
+ switch ((int)event->type) {
case GDK_BUTTON_PRESS:
vivi_widget_invalidate_click_area (debug);
debug->x = event->x;
More information about the Swfdec
mailing list