inputselector: install an acceptcaps function

Install a custom acceptcaps function instead of using the default expensive
check. We accept whatever downstream accepts so we pass along the acceptcaps
call to the downstream peer.
This commit is contained in:
Wim Taymans 2009-10-21 15:58:11 -04:00 committed by Wim Taymans
parent 37f8957181
commit 5b72f2adf9

View file

@ -148,6 +148,7 @@ static gint64 gst_selector_pad_get_running_time (GstSelectorPad * pad);
static void gst_selector_pad_reset (GstSelectorPad * pad);
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
static gboolean gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps);
static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
static GstFlowReturn gst_selector_pad_bufferalloc (GstPad * pad,
@ -466,6 +467,21 @@ gst_selector_pad_getcaps (GstPad * pad)
return caps;
}
static gboolean
gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps)
{
GstInputSelector *sel;
gboolean res;
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
GST_DEBUG_OBJECT (sel, "Checking acceptcaps of srcpad peer");
res = gst_pad_peer_accept_caps (sel->srcpad, caps);
gst_object_unref (sel);
return res;
}
static GstFlowReturn
gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
guint size, GstCaps * caps, GstBuffer ** buf)
@ -1245,6 +1261,8 @@ gst_input_selector_request_new_pad (GstElement * element,
GST_DEBUG_FUNCPTR (gst_selector_pad_event));
gst_pad_set_getcaps_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_getcaps));
gst_pad_set_acceptcaps_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_acceptcaps));
gst_pad_set_chain_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_selector_pad_chain));
gst_pad_set_iterate_internal_links_function (sinkpad,