playback: port to new GLib thread API

This commit is contained in:
Tim-Philipp Müller 2012-09-10 01:10:24 +01:00
parent 5bb8021fc9
commit 952f347146
4 changed files with 22 additions and 29 deletions

View file

@ -500,7 +500,7 @@ gst_play_sink_convert_bin_finalize (GObject * object)
GstPlaySinkConvertBin *self = GST_PLAY_SINK_CONVERT_BIN_CAST (object);
gst_object_unref (self->sink_proxypad);
g_mutex_free (self->lock);
g_mutex_clear (&self->lock);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -616,7 +616,7 @@ gst_play_sink_convert_bin_init (GstPlaySinkConvertBin * self)
{
GstPadTemplate *templ;
self->lock = g_mutex_new ();
g_mutex_init (&self->lock);
gst_segment_init (&self->segment, GST_FORMAT_UNDEFINED);
templ = gst_static_pad_template_get (&sinktemplate);

View file

@ -41,7 +41,7 @@ G_BEGIN_DECLS
GST_LOG_OBJECT (obj, \
"locking from thread %p", \
g_thread_self ()); \
g_mutex_lock (GST_PLAY_SINK_CONVERT_BIN_CAST(obj)->lock); \
g_mutex_lock (&GST_PLAY_SINK_CONVERT_BIN_CAST(obj)->lock); \
GST_LOG_OBJECT (obj, \
"locked from thread %p", \
g_thread_self ()); \
@ -51,7 +51,7 @@ G_BEGIN_DECLS
GST_LOG_OBJECT (obj, \
"unlocking from thread %p", \
g_thread_self ()); \
g_mutex_unlock (GST_PLAY_SINK_CONVERT_BIN_CAST(obj)->lock); \
g_mutex_unlock (&GST_PLAY_SINK_CONVERT_BIN_CAST(obj)->lock); \
} G_STMT_END
typedef struct _GstPlaySinkConvertBin GstPlaySinkConvertBin;
@ -62,7 +62,7 @@ struct _GstPlaySinkConvertBin
GstBin parent;
/* < private > */
GMutex *lock;
GMutex lock;
GstPad *sinkpad, *sink_proxypad;
guint sink_proxypad_block_id;

View file

@ -162,15 +162,8 @@ gst_subtitle_overlay_finalize (GObject * object)
{
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (object);
if (self->lock) {
g_mutex_free (self->lock);
self->lock = NULL;
}
if (self->factories_lock) {
g_mutex_free (self->factories_lock);
self->factories_lock = NULL;
}
g_mutex_clear (&self->lock);
g_mutex_clear (&self->factories_lock);
if (self->factories)
gst_plugin_feature_list_free (self->factories);
@ -1181,7 +1174,7 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
self->subtitle_flush = FALSE;
/* Find our factories */
g_mutex_lock (self->factories_lock);
g_mutex_lock (&self->factories_lock);
gst_subtitle_overlay_update_factory_list (self);
if (subcaps) {
factories =
@ -1197,7 +1190,7 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
self->subtitle_error = TRUE;
}
}
g_mutex_unlock (self->factories_lock);
g_mutex_unlock (&self->factories_lock);
if (!subcaps) {
_setup_passthrough (self);
@ -1254,14 +1247,14 @@ _pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
g_assert (parser_caps != NULL);
g_mutex_lock (self->factories_lock);
g_mutex_lock (&self->factories_lock);
gst_subtitle_overlay_update_factory_list (self);
GST_DEBUG_OBJECT (self,
"Searching overlay factories for caps %" GST_PTR_FORMAT, parser_caps);
overlay_factories =
gst_subtitle_overlay_get_factories_for_caps (self->factories,
parser_caps);
g_mutex_unlock (self->factories_lock);
g_mutex_unlock (&self->factories_lock);
if (!overlay_factories) {
GST_WARNING_OBJECT (self,
@ -1427,12 +1420,12 @@ gst_subtitle_overlay_change_state (GstElement * element,
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
GST_DEBUG_OBJECT (self, "State change NULL->READY");
g_mutex_lock (self->factories_lock);
g_mutex_lock (&self->factories_lock);
if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self))) {
g_mutex_unlock (self->factories_lock);
g_mutex_unlock (&self->factories_lock);
return GST_STATE_CHANGE_FAILURE;
}
g_mutex_unlock (self->factories_lock);
g_mutex_unlock (&self->factories_lock);
GST_SUBTITLE_OVERLAY_LOCK (self);
/* Set the internal pads to blocking */
@ -1940,7 +1933,7 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad, GstCaps * filter)
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY (gst_pad_get_parent (pad));
GstCaps *ret;
g_mutex_lock (self->factories_lock);
g_mutex_lock (&self->factories_lock);
if (G_UNLIKELY (!gst_subtitle_overlay_update_factory_list (self)))
ret = gst_caps_new_empty ();
else if (filter)
@ -1949,7 +1942,7 @@ gst_subtitle_overlay_subtitle_sink_getcaps (GstPad * pad, GstCaps * filter)
GST_CAPS_INTERSECT_FIRST);
else
ret = gst_caps_ref (self->factory_caps);
g_mutex_unlock (self->factories_lock);
g_mutex_unlock (&self->factories_lock);
GST_DEBUG_OBJECT (pad, "Returning subtitle caps %" GST_PTR_FORMAT, ret);
@ -2229,8 +2222,8 @@ gst_subtitle_overlay_init (GstSubtitleOverlay * self)
GstPadTemplate *templ;
GstPad *proxypad = NULL;
self->lock = g_mutex_new ();
self->factories_lock = g_mutex_new ();
g_mutex_init (&self->lock);
g_mutex_init (&self->factories_lock);
templ = gst_static_pad_template_get (&srctemplate);
self->srcpad = gst_ghost_pad_new_no_target_from_template ("src", templ);

View file

@ -40,7 +40,7 @@ G_BEGIN_DECLS
GST_LOG_OBJECT (obj, \
"locking from thread %p", \
g_thread_self ()); \
g_mutex_lock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
g_mutex_lock (&GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
GST_LOG_OBJECT (obj, \
"locked from thread %p", \
g_thread_self ()); \
@ -50,7 +50,7 @@ G_BEGIN_DECLS
GST_LOG_OBJECT (obj, \
"unlocking from thread %p", \
g_thread_self ()); \
g_mutex_unlock (GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
g_mutex_unlock (&GST_SUBTITLE_OVERLAY_CAST(obj)->lock); \
} G_STMT_END
typedef struct _GstSubtitleOverlay GstSubtitleOverlay;
@ -85,12 +85,12 @@ struct _GstSubtitleOverlay
gboolean subtitle_flush;
gboolean subtitle_error;
GMutex *factories_lock;
GMutex factories_lock;
GList *factories;
guint32 factories_cookie;
GstCaps *factory_caps;
GMutex *lock;
GMutex lock;
GstCaps *subcaps;
GstElement *passthrough_identity;