avdemux: port to the new GLib thread API

This commit is contained in:
Mark Nauwelaerts 2012-09-12 10:25:21 +02:00
parent c489e4163a
commit c5589bb8f9
2 changed files with 11 additions and 11 deletions

View file

@ -277,8 +277,8 @@ gst_ffmpegdemux_init (GstFFMpegDemux * demux)
gst_segment_init (&demux->segment, GST_FORMAT_TIME); gst_segment_init (&demux->segment, GST_FORMAT_TIME);
/* push based data */ /* push based data */
demux->ffpipe.tlock = g_mutex_new (); g_mutex_init (&demux->ffpipe.tlock);
demux->ffpipe.cond = g_cond_new (); g_cond_init (&demux->ffpipe.cond);
demux->ffpipe.adapter = gst_adapter_new (); demux->ffpipe.adapter = gst_adapter_new ();
/* blacklist unreliable push-based demuxers */ /* blacklist unreliable push-based demuxers */
@ -295,8 +295,8 @@ gst_ffmpegdemux_finalize (GObject * object)
demux = (GstFFMpegDemux *) object; demux = (GstFFMpegDemux *) object;
g_mutex_free (demux->ffpipe.tlock); g_mutex_clear (&demux->ffpipe.tlock);
g_cond_free (demux->ffpipe.cond); g_cond_clear (&demux->ffpipe.cond);
gst_object_unref (demux->ffpipe.adapter); gst_object_unref (demux->ffpipe.adapter);
gst_object_unref (demux->task); gst_object_unref (demux->task);

View file

@ -29,23 +29,23 @@ G_BEGIN_DECLS
/* pipe protocol helpers */ /* pipe protocol helpers */
#define GST_FFMPEG_PIPE_MUTEX_LOCK(m) G_STMT_START { \ #define GST_FFMPEG_PIPE_MUTEX_LOCK(m) G_STMT_START { \
GST_LOG_OBJECT (m, "locking tlock from thread %p", g_thread_self ()); \ 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 ()); \ GST_LOG_OBJECT (m, "locked tlock from thread %p", g_thread_self ()); \
} G_STMT_END } G_STMT_END
#define GST_FFMPEG_PIPE_MUTEX_UNLOCK(m) G_STMT_START { \ #define GST_FFMPEG_PIPE_MUTEX_UNLOCK(m) G_STMT_START { \
GST_LOG_OBJECT (m, "unlocking tlock from thread %p", g_thread_self ()); \ GST_LOG_OBJECT (&m, "unlocking tlock from thread %p", g_thread_self ()); \
g_mutex_unlock (m->tlock); \ g_mutex_unlock (&m->tlock); \
} G_STMT_END } G_STMT_END
#define GST_FFMPEG_PIPE_WAIT(m) G_STMT_START { \ #define GST_FFMPEG_PIPE_WAIT(m) G_STMT_START { \
GST_LOG_OBJECT (m, "thread %p waiting", g_thread_self ()); \ 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 } G_STMT_END
#define GST_FFMPEG_PIPE_SIGNAL(m) G_STMT_START { \ #define GST_FFMPEG_PIPE_SIGNAL(m) G_STMT_START { \
GST_LOG_OBJECT (m, "signalling from thread %p", g_thread_self ()); \ GST_LOG_OBJECT (m, "signalling from thread %p", g_thread_self ()); \
g_cond_signal (m->cond); \ g_cond_signal (&m->cond); \
} G_STMT_END } G_STMT_END
typedef struct _GstFFMpegPipe GstFFMpegPipe; typedef struct _GstFFMpegPipe GstFFMpegPipe;
@ -53,10 +53,10 @@ typedef struct _GstFFMpegPipe GstFFMpegPipe;
struct _GstFFMpegPipe struct _GstFFMpegPipe
{ {
/* lock for syncing */ /* lock for syncing */
GMutex *tlock; GMutex tlock;
/* with TLOCK */ /* with TLOCK */
/* signals counterpart thread to have a look */ /* signals counterpart thread to have a look */
GCond *cond; GCond cond;
/* seen eos */ /* seen eos */
gboolean eos; gboolean eos;
/* flowreturn obtained by src task */ /* flowreturn obtained by src task */