oggdemux: port to new GLib thread API
authorTim-Philipp Müller <tim@centricular.net>
Mon, 10 Sep 2012 00:08:51 +0000 (01:08 +0100)
committerTim-Philipp Müller <tim@centricular.net>
Mon, 10 Sep 2012 00:08:51 +0000 (01:08 +0100)
ext/ogg/gstoggdemux.c
ext/ogg/gstoggdemux.h

index 22f42cb..9171ab4 100644 (file)
 #define GST_FLOW_LIMIT GST_FLOW_CUSTOM_ERROR
 #define GST_FLOW_SKIP_PUSH GST_FLOW_CUSTOM_SUCCESS_1
 
-#define GST_CHAIN_LOCK(ogg)     g_mutex_lock((ogg)->chain_lock)
-#define GST_CHAIN_UNLOCK(ogg)   g_mutex_unlock((ogg)->chain_lock)
+#define GST_CHAIN_LOCK(ogg)     g_mutex_lock(&(ogg)->chain_lock)
+#define GST_CHAIN_UNLOCK(ogg)   g_mutex_unlock(&(ogg)->chain_lock)
 
 #define GST_PUSH_LOCK(ogg)                  \
   do {                                      \
     GST_TRACE_OBJECT(ogg, "Push lock");     \
-    g_mutex_lock((ogg)->push_lock);         \
+    g_mutex_lock(&(ogg)->push_lock);        \
   } while(0)
 
 #define GST_PUSH_UNLOCK(ogg)                \
   do {                                      \
     GST_TRACE_OBJECT(ogg, "Push unlock");   \
-    g_mutex_unlock((ogg)->push_lock);       \
+    g_mutex_unlock(&(ogg)->push_lock);      \
   } while(0)
 
 GST_DEBUG_CATEGORY (gst_ogg_demux_debug);
@@ -2019,8 +2019,8 @@ gst_ogg_demux_init (GstOggDemux * ogg)
       gst_ogg_demux_sink_activate_mode);
   gst_element_add_pad (GST_ELEMENT (ogg), ogg->sinkpad);
 
-  ogg->chain_lock = g_mutex_new ();
-  ogg->push_lock = g_mutex_new ();
+  g_mutex_init (&ogg->chain_lock);
+  g_mutex_init (&ogg->push_lock);
   ogg->chains = g_array_new (FALSE, TRUE, sizeof (GstOggChain *));
 
   ogg->stats_nbisections = 0;
@@ -2040,8 +2040,8 @@ gst_ogg_demux_finalize (GObject * object)
   ogg = GST_OGG_DEMUX (object);
 
   g_array_free (ogg->chains, TRUE);
-  g_mutex_free (ogg->chain_lock);
-  g_mutex_free (ogg->push_lock);
+  g_mutex_clear (&ogg->chain_lock);
+  g_mutex_clear (&ogg->push_lock);
   ogg_sync_clear (&ogg->sync);
 
   if (ogg->newsegment)
index 017c43f..6553bc6 100644 (file)
@@ -142,7 +142,7 @@ struct _GstOggDemux
   guint64 max_packet_size, max_page_size;
 
   /* state */
-  GMutex *chain_lock;           /* we need the lock to protect the chains */
+  GMutex chain_lock;           /* we need the lock to protect the chains */
   GArray *chains;               /* list of chains we know */
   GstClockTime total_time;
   gint bitrate;                 /* bitrate of the current chain */
@@ -162,7 +162,7 @@ struct _GstOggDemux
   gint64 prestime;
 
   /* push mode seeking support */
-  GMutex *push_lock; /* we need the lock to protect the push mode variables */
+  GMutex push_lock; /* we need the lock to protect the push mode variables */
   gint64 push_byte_offset; /* where were are at in the stream, in bytes */
   gint64 push_byte_length; /* length in bytes of the stream, -1 if unknown */
   GstClockTime push_time_length; /* length in time of the stream */