Commit b0ef9800 authored by Arun Raghavan's avatar Arun Raghavan Committed by Sebastian Dröge
Browse files

playbin2: Check if an element accepts requisite caps before selecting

In addition to ensuring that an element we want to select in
autoplug-select can enter the READY state, we also now check if it can
accept the caps we wish to plug it for. This is handy for sinks that
need to perform a probe to figure out whether they can actually handle a
given format.
parent b76efc7f
...@@ -3058,6 +3058,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad, ...@@ -3058,6 +3058,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
const gchar *klass; const gchar *klass;
GstPlaySinkType type; GstPlaySinkType type;
GstElement **sinkp; GstElement **sinkp;
GstPad *sinkpad;
playbin = group->playbin; playbin = group->playbin;
...@@ -3130,6 +3131,20 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad, ...@@ -3130,6 +3131,20 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
return GST_AUTOPLUG_SELECT_SKIP; return GST_AUTOPLUG_SELECT_SKIP;
} }
if ((sinkpad = gst_element_get_static_pad (element, "sink"))) {
/* Got the sink pad, now let's see if the element actually does accept the
* caps that we have */
if (!gst_pad_accept_caps (sinkpad, caps)) {
GST_DEBUG_OBJECT (playbin, "%s doesn't accept our caps",
GST_ELEMENT_NAME (element));
gst_object_unref (sinkpad);
gst_element_set_state (element, GST_STATE_NULL);
gst_object_unref (element);
return GST_AUTOPLUG_SELECT_SKIP;
}
gst_object_unref (sinkpad);
}
/* remember the sink in the group now, the element is floating, we take /* remember the sink in the group now, the element is floating, we take
* ownership now */ * ownership now */
GST_SOURCE_GROUP_LOCK (group); GST_SOURCE_GROUP_LOCK (group);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment