gst/playback/gstdecodebin.c: Handle the case where a pad_block failed.

Original commit message from CVS:
* gst/playback/gstdecodebin.c: (gst_decode_bin_init),
(gst_decode_bin_dispose), (free_dynamics), (remove_fakesink),
(pad_blocked), (close_pad_link), (new_pad), (no_more_pads):
Handle the case where a pad_block failed.
This commit is contained in:
Wim Taymans 2005-11-03 12:32:09 +00:00
parent 1fd8c9981e
commit 6e48aa490c
2 changed files with 31 additions and 14 deletions

View file

@ -1,3 +1,10 @@
2005-11-03 Wim Taymans <wim@fluendo.com>
* gst/playback/gstdecodebin.c: (gst_decode_bin_init),
(gst_decode_bin_dispose), (free_dynamics), (remove_fakesink),
(pad_blocked), (close_pad_link), (new_pad), (no_more_pads):
Handle the case where a pad_block failed.
2005-11-02 Sebastien Cote <sebas642@yahoo.ca>
reviewed by: Zeeshan Ali <zeenix@gmail.com>

View file

@ -480,15 +480,9 @@ mimetype_is_raw (const gchar * mimetype)
}
static void
pad_unblocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin)
remove_fakesink (GstDecodeBin * decode_bin)
{
}
static void
pad_blocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin)
{
decode_bin->numwaiting--;
if (decode_bin->numwaiting == 0 && decode_bin->fakesink) {
if (decode_bin->fakesink) {
gst_object_ref (decode_bin->fakesink);
gst_bin_remove (GST_BIN (decode_bin), decode_bin->fakesink);
@ -502,8 +496,19 @@ pad_blocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin)
gst_element_post_message (GST_ELEMENT_CAST (decode_bin),
gst_message_new_state_dirty (GST_OBJECT_CAST (decode_bin)));
}
gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) pad_unblocked,
NULL);
}
static void
pad_blocked (GstPad * pad, gboolean blocked, GstDecodeBin * decode_bin)
{
if (blocked) {
decode_bin->numwaiting--;
if (decode_bin->numwaiting == 0) {
remove_fakesink (decode_bin);
}
gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) pad_blocked,
NULL);
}
}
/* given a pad and a caps from an element, find the list of elements
@ -559,14 +564,15 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
/* make a unique name for this new pad */
padname = g_strdup_printf ("src%d", decode_bin->numpads);
decode_bin->numpads++;
decode_bin->numwaiting++;
/* make it a ghostpad */
ghost = gst_ghost_pad_new (padname, pad);
gst_element_add_pad (GST_ELEMENT (decode_bin), ghost);
gst_pad_set_blocked_async (pad, TRUE, (GstPadBlockCallback) pad_blocked,
decode_bin);
if (gst_pad_set_blocked_async (pad, TRUE, (GstPadBlockCallback) pad_blocked,
decode_bin)) {
decode_bin->numwaiting++;
}
GST_LOG_OBJECT (element, "closed pad %s", padname);
@ -898,10 +904,14 @@ no_more_pads (GstElement * element, GstDynamic * dynamic)
/* if we have no more dynamic elements, we have no chance of creating
* more pads, so we fire the no_more_pads signal */
if (decode_bin->dynamics == NULL) {
if (decode_bin->numwaiting == 0) {
GST_DEBUG_OBJECT (decode_bin,
"no more dynamic elements, removing fakesink");
remove_fakesink (decode_bin);
}
GST_DEBUG_OBJECT (decode_bin,
"no more dynamic elements, signaling no_more_pads");
gst_element_no_more_pads (GST_ELEMENT (decode_bin));
} else {
GST_DEBUG_OBJECT (decode_bin, "we have more dynamic elements");
}