mpegvideoparser: Also initialize debug category in parse_sequence_header
authorOlivier Crête <olivier.crete@collabora.com>
Wed, 4 Dec 2013 22:31:27 +0000 (17:31 -0500)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 12 Dec 2013 23:43:57 +0000 (23:43 +0000)
Also remove the useless initialized flag, this is already done by the macro

https://bugzilla.gnome.org/show_bug.cgi?id=719657

gst-libs/gst/codecparsers/gstmpegvideoparser.c

index 2fd992f24db094ef965fdc1f093730334b35679d..db750ad850c7771c02b0518047eb38933083be78 100644 (file)
@@ -124,7 +124,10 @@ static const VLCTable mpeg2_mbaddr_vlc_table[] = {
 GST_DEBUG_CATEGORY (mpegvideo_parser_debug);
 #define GST_CAT_DEFAULT mpegvideo_parser_debug
 
-static gboolean initialized = FALSE;
+#define INITIALIZE_DEBUG_CATEGORY \
+  GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo", \
+      0, "Mpegvideo parser library");
+
 
 static inline gboolean
 find_start_code (GstBitReader * b)
@@ -256,11 +259,7 @@ gst_mpeg_video_parse (GstMpegVideoPacket * packet,
   gint off;
   GstByteReader br;
 
-  if (!initialized) {
-    GST_DEBUG_CATEGORY_INIT (mpegvideo_parser_debug, "codecparsers_mpegvideo",
-        0, "Mpegvideo parser library");
-    initialized = TRUE;
-  }
+  INITIALIZE_DEBUG_CATEGORY;
 
   if (size <= offset) {
     GST_DEBUG ("Can't parse from offset %d, buffer is to small", offset);
@@ -328,6 +327,8 @@ gst_mpeg_video_packet_parse_sequence_header (const GstMpegVideoPacket * packet,
   if (packet->size < 8)
     return FALSE;
 
+  INITIALIZE_DEBUG_CATEGORY;
+
   gst_bit_reader_init (&br, &packet->data[packet->offset], packet->size);
 
   /* Setting the height/width codes */