playbin: Improve autoplugging of decoder/sink combinations by trying to activate the sink

And if that fails don't bother autoplugging that sink. Also gives
us more accurate sink caps.
This commit is contained in:
Sebastian Dröge 2013-06-08 23:34:53 +02:00
parent ff8839d97b
commit 44352deadb

View file

@ -4202,7 +4202,7 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
* type it outputs, check that the decoder is compatible with this sink */ * type it outputs, check that the decoder is compatible with this sink */
if ((isaudiodec && group->audio_sink) || (isvideodec if ((isaudiodec && group->audio_sink) || (isvideodec
&& group->video_sink)) { && group->video_sink)) {
gboolean compatible = TRUE; gboolean compatible = FALSE;
GstPad *sinkpad; GstPad *sinkpad;
GstCaps *caps; GstCaps *caps;
GstElement *sink; GstElement *sink;
@ -4215,6 +4215,23 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
(isaudiodec) ? gst_static_caps_get (&raw_audio_caps) : (isaudiodec) ? gst_static_caps_get (&raw_audio_caps) :
gst_static_caps_get (&raw_video_caps); gst_static_caps_get (&raw_video_caps);
if (!activate_sink (playbin, sink)) {
/* If we can't activate the sink, either continue with the next possible
* sink or if we have a fixed sink, try the decoder. We will fail later
* anyway */
gst_object_unref (sinkpad);
if ((isaudiodec && group->audio_sink != playbin->audio_sink) ||
(isvideodec && group->video_sink != playbin->video_sink)) {
gst_element_set_state (*sinkp, GST_STATE_NULL);
gst_object_unref (*sinkp);
*sinkp = NULL;
continue;
} else {
g_mutex_unlock (&playbin->elements_lock);
GST_SOURCE_GROUP_UNLOCK (group);
return GST_AUTOPLUG_SELECT_TRY;
}
}
caps = gst_pad_query_caps (sinkpad, NULL); caps = gst_pad_query_caps (sinkpad, NULL);
/* If the sink supports raw audio/video, we first check /* If the sink supports raw audio/video, we first check