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.
This commit is contained in:
Tim-Philipp Müller 2008-12-10 15:42:21 +00:00
parent 67d36a32ff
commit 8c6bcd6771
3 changed files with 20 additions and 13 deletions

View file

@ -1,3 +1,16 @@
2008-12-10 Tim-Philipp Müller <tim.muller at collabora co uk>
* 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 <sebastian.droege@collabora.co.uk>
* configure.ac:

View file

@ -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,

View file

@ -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__ */