diff options
author | Dave Robillard <dave@drobilla.net> | 2009-05-26 19:10:44 -0400 |
---|---|---|
committer | Dave Robillard <dave@drobilla.net> | 2009-05-26 19:10:44 -0400 |
commit | b75a26657febaf86c4137b4d41c068926325e316 (patch) | |
tree | 65c161824169ac09bf8418244937aec6ab77a270 /ext/resindvd/resindvdbin.c | |
parent | 4e1d3bba9c21cb8bbfe70ffed953a8385fb7314d (diff) | |
parent | 8f70498c898a65d0938e3e104e91662ff5b693c3 (diff) | |
download | gst-plugins-bad-b75a26657febaf86c4137b4d41c068926325e316.tar.gz gst-plugins-bad-b75a26657febaf86c4137b4d41c068926325e316.tar.bz2 gst-plugins-bad-b75a26657febaf86c4137b4d41c068926325e316.zip |
Merge branch 'master' of git://anongit.freedesktop.org/gstreamer/gst-plugins-bad into fdo
Diffstat (limited to 'ext/resindvd/resindvdbin.c')
-rw-r--r-- | ext/resindvd/resindvdbin.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/ext/resindvd/resindvdbin.c b/ext/resindvd/resindvdbin.c index 310fac7f..e5f28288 100644 --- a/ext/resindvd/resindvdbin.c +++ b/ext/resindvd/resindvdbin.c @@ -44,6 +44,9 @@ GST_DEBUG_CATEGORY_EXTERN (resindvd_debug); #define DVDBIN_LOCK(d) g_mutex_lock((d)->dvd_lock) #define DVDBIN_UNLOCK(d) g_mutex_unlock((d)->dvd_lock) +#define DVDBIN_PREROLL_LOCK(d) g_mutex_lock((d)->preroll_lock) +#define DVDBIN_PREROLL_UNLOCK(d) g_mutex_unlock((d)->preroll_lock) + #define DEFAULT_DEVICE "/dev/dvd" enum { @@ -159,6 +162,7 @@ static void rsn_dvdbin_init (RsnDvdBin * dvdbin, RsnDvdBinClass * gclass) { dvdbin->dvd_lock = g_mutex_new (); + dvdbin->preroll_lock = g_mutex_new (); } static void @@ -167,6 +171,7 @@ rsn_dvdbin_finalize (GObject * object) RsnDvdBin *dvdbin = RESINDVDBIN (object); g_mutex_free (dvdbin->dvd_lock); + g_mutex_free (dvdbin->preroll_lock); g_free (dvdbin->last_uri); g_free (dvdbin->device); @@ -741,58 +746,57 @@ failed: static void dvdbin_pad_blocked_cb (GstPad * pad, gboolean blocked, RsnDvdBin * dvdbin) { - gboolean changed = FALSE; + gboolean added_last_pad = FALSE; gboolean added = FALSE; if (!blocked) return; if (pad == dvdbin->subpicture_pad) { GST_DEBUG_OBJECT (dvdbin, "Pad block -> subpicture pad"); - GST_OBJECT_LOCK (dvdbin); + DVDBIN_PREROLL_LOCK (dvdbin); added = dvdbin->subpicture_added; dvdbin->subpicture_added = TRUE; - GST_OBJECT_UNLOCK (dvdbin); if (!added) { gst_element_add_pad (GST_ELEMENT (dvdbin), dvdbin->subpicture_pad); - changed = TRUE; + added_last_pad = (dvdbin->audio_added && dvdbin->video_added); } + DVDBIN_PREROLL_UNLOCK (dvdbin); gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) dvdbin_pad_blocked_cb, dvdbin); } else if (pad == dvdbin->audio_pad) { GST_DEBUG_OBJECT (dvdbin, "Pad block -> audio pad"); - GST_OBJECT_LOCK (dvdbin); + DVDBIN_PREROLL_LOCK (dvdbin); added = dvdbin->audio_added; dvdbin->audio_added = TRUE; - GST_OBJECT_UNLOCK (dvdbin); if (!added) { gst_element_add_pad (GST_ELEMENT (dvdbin), dvdbin->audio_pad); - changed = TRUE; + added_last_pad = (dvdbin->subpicture_added && dvdbin->video_added); } + DVDBIN_PREROLL_UNLOCK (dvdbin); gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) dvdbin_pad_blocked_cb, dvdbin); } else if (pad == dvdbin->video_pad) { GST_DEBUG_OBJECT (dvdbin, "Pad block -> video pad"); - GST_OBJECT_LOCK (dvdbin); + DVDBIN_PREROLL_LOCK (dvdbin); added = dvdbin->video_added; dvdbin->video_added = TRUE; - GST_OBJECT_UNLOCK (dvdbin); if (!added) { gst_element_add_pad (GST_ELEMENT (dvdbin), dvdbin->video_pad); - changed = TRUE; + added_last_pad = (dvdbin->subpicture_added && dvdbin->audio_added); } + DVDBIN_PREROLL_UNLOCK (dvdbin); gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) dvdbin_pad_blocked_cb, dvdbin); } - if (changed && - dvdbin->video_added && dvdbin->audio_added && dvdbin->subpicture_added) { + if (added_last_pad) { GST_DEBUG_OBJECT (dvdbin, "Firing no more pads from pad-blocked cb"); gst_element_no_more_pads (GST_ELEMENT (dvdbin)); } |