avdemux: port to the new GLib thread API
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Wed, 12 Sep 2012 08:25:21 +0000 (10:25 +0200)
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Wed, 12 Sep 2012 08:25:21 +0000 (10:25 +0200)
ext/libav/gstavdemux.c
ext/libav/gstavpipe.h

index 006cb2b..bbe5d8e 100644 (file)
@@ -277,8 +277,8 @@ gst_ffmpegdemux_init (GstFFMpegDemux * demux)
   gst_segment_init (&demux->segment, GST_FORMAT_TIME);
 
   /* push based data */
-  demux->ffpipe.tlock = g_mutex_new ();
-  demux->ffpipe.cond = g_cond_new ();
+  g_mutex_init (&demux->ffpipe.tlock);
+  g_cond_init (&demux->ffpipe.cond);
   demux->ffpipe.adapter = gst_adapter_new ();
 
   /* blacklist unreliable push-based demuxers */
@@ -295,8 +295,8 @@ gst_ffmpegdemux_finalize (GObject * object)
 
   demux = (GstFFMpegDemux *) object;
 
-  g_mutex_free (demux->ffpipe.tlock);
-  g_cond_free (demux->ffpipe.cond);
+  g_mutex_clear (&demux->ffpipe.tlock);
+  g_cond_clear (&demux->ffpipe.cond);
   gst_object_unref (demux->ffpipe.adapter);
 
   gst_object_unref (demux->task);
index 1bcbc14..09ec57d 100644 (file)
@@ -29,23 +29,23 @@ G_BEGIN_DECLS
 /* pipe protocol helpers */
 #define GST_FFMPEG_PIPE_MUTEX_LOCK(m) G_STMT_START {                    \
   GST_LOG_OBJECT (m, "locking tlock from thread %p", g_thread_self ()); \
-  g_mutex_lock (m->tlock);                                              \
+  g_mutex_lock (&m->tlock);                                              \
   GST_LOG_OBJECT (m, "locked tlock from thread %p", g_thread_self ());  \
 } G_STMT_END
 
 #define GST_FFMPEG_PIPE_MUTEX_UNLOCK(m) G_STMT_START {                    \
-  GST_LOG_OBJECT (m, "unlocking tlock from thread %p", g_thread_self ()); \
-  g_mutex_unlock (m->tlock);                                              \
+  GST_LOG_OBJECT (&m, "unlocking tlock from thread %p", g_thread_self ()); \
+  g_mutex_unlock (&m->tlock);                                              \
 } G_STMT_END
 
 #define GST_FFMPEG_PIPE_WAIT(m) G_STMT_START {                          \
   GST_LOG_OBJECT (m, "thread %p waiting", g_thread_self ());            \
-  g_cond_wait (m->cond, m->tlock);                                      \
+  g_cond_wait (&m->cond, &m->tlock);                                      \
 } G_STMT_END
 
 #define GST_FFMPEG_PIPE_SIGNAL(m) G_STMT_START {                        \
   GST_LOG_OBJECT (m, "signalling from thread %p", g_thread_self ());    \
-  g_cond_signal (m->cond);                                              \
+  g_cond_signal (&m->cond);                                              \
 } G_STMT_END
 
 typedef struct _GstFFMpegPipe GstFFMpegPipe;
@@ -53,10 +53,10 @@ typedef struct _GstFFMpegPipe GstFFMpegPipe;
 struct _GstFFMpegPipe
 {
   /* lock for syncing */
-  GMutex *tlock;
+  GMutex tlock;
   /* with TLOCK */
   /* signals counterpart thread to have a look */
-  GCond *cond;
+  GCond cond;
   /* seen eos */
   gboolean eos;
   /* flowreturn obtained by src task */