From 8c6bcd677196ce3c995bc9c5b73c074d4d629fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 10 Dec 2008 15:42:21 +0000 Subject: [PATCH] gst/mpegaudioparse/gstmpegaudioparse.*: Do an initial class_ref on an internal enum type from within the class_init f... Original commit message from CVS: * gst/mpegaudioparse/gstmpegaudioparse.c: (channel_mode_class), (GST_TYPE_MP3_CHANNEL_MODE), (mp3_type_frame_length_from_header), (gst_mp3parse_emit_frame), (mp3parse_get_query_types): * gst/mpegaudioparse/gstmpegaudioparse.h: Do an initial class_ref on an internal enum type from within the class_init function so that there aren't any issues when multiple mp3parse elements are started in separate threads at the same time. (Why we use an enum type here if the tag is registered as a string type, I don't know). Also remove custom UNUSED macro and use GLib's instead. --- ChangeLog | 13 +++++++++++++ gst/mpegaudioparse/gstmpegaudioparse.c | 14 +++++++------- gst/mpegaudioparse/gstmpegaudioparse.h | 6 ------ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf51285575..4b153729e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-12-10 Tim-Philipp Müller + + * gst/mpegaudioparse/gstmpegaudioparse.c: (channel_mode_class), + (GST_TYPE_MP3_CHANNEL_MODE), (mp3_type_frame_length_from_header), + (gst_mp3parse_emit_frame), (mp3parse_get_query_types): + * gst/mpegaudioparse/gstmpegaudioparse.h: + Do an initial class_ref on an internal enum type from within the + class_init function so that there aren't any issues when multiple + mp3parse elements are started in separate threads at the same + time. (Why we use an enum type here if the tag is registered as + a string type, I don't know). Also remove custom UNUSED macro + and use GLib's instead. + 2008-12-04 Sebastian Dröge * configure.ac: diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index 8e40b5d360..ca5d112aaa 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -136,12 +136,10 @@ mp3parse_total_bytes (GstMPEGAudioParse * mp3parse, gint64 * total); static gboolean mp3parse_total_time (GstMPEGAudioParse * mp3parse, GstClockTime * total); -/* static guint gst_mp3parse_signals[LAST_SIGNAL] = { 0 }; */ - GST_BOILERPLATE (GstMPEGAudioParse, gst_mp3parse, GstElement, GST_TYPE_ELEMENT); #define GST_TYPE_MP3_CHANNEL_MODE (gst_mp3_channel_mode_get_type()) -G_GNUC_UNUSED static GType +static GType gst_mp3_channel_mode_get_type (void) { static GType mp3_channel_mode_type = 0; @@ -234,7 +232,7 @@ mp3_type_frame_length_from_header (GstMPEGAudioParse * mp3parse, guint32 header, } mode_enum = - g_enum_get_value (g_type_class_ref (GST_TYPE_MP3_CHANNEL_MODE), mode); + g_enum_get_value (g_type_class_peek (GST_TYPE_MP3_CHANNEL_MODE), mode); GST_DEBUG_OBJECT (mp3parse, "Calculated mp3 frame length of %u bytes", length); @@ -328,6 +326,8 @@ gst_mp3parse_class_init (GstMPEGAudioParseClass * klass) "has crc", "Using CRC", NULL); gst_tag_register (GST_TAG_MODE, GST_TAG_FLAG_ENCODED, G_TYPE_STRING, "channel mode", "MPEG audio channel mode", NULL); + + g_type_class_ref (GST_TYPE_MP3_CHANNEL_MODE); } static void @@ -766,8 +766,8 @@ gst_mp3parse_emit_frame (GstMPEGAudioParse * mp3parse, guint size, } mp3parse->last_posted_channel_mode = mode; - mode_enum = g_enum_get_value (g_type_class_ref (GST_TYPE_MP3_CHANNEL_MODE), - mp3parse->last_posted_channel_mode); + mode_enum = + g_enum_get_value (g_type_class_peek (GST_TYPE_MP3_CHANNEL_MODE), mode); gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_MODE, mode_enum->value_nick, NULL); @@ -1968,7 +1968,7 @@ out: } static const GstQueryType * -mp3parse_get_query_types (GstPad * pad ATTR_UNUSED) +mp3parse_get_query_types (GstPad * pad G_GNUC_UNUSED) { static const GstQueryType query_types[] = { GST_QUERY_POSITION, diff --git a/gst/mpegaudioparse/gstmpegaudioparse.h b/gst/mpegaudioparse/gstmpegaudioparse.h index 8be1951c8e..b95436b059 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.h +++ b/gst/mpegaudioparse/gstmpegaudioparse.h @@ -131,12 +131,6 @@ struct _GstMPEGAudioParseClass { GType gst_mp3parse_get_type(void); -#ifdef __GCC__ -#define ATTR_UNUSED __attribute__ ((unused) -#else -#define ATTR_UNUSED -#endif - G_END_DECLS #endif /* __MP3PARSE_H__ */