g_ptr_array_free (group->text_channels, TRUE);
g_mutex_free (group->lock);
- if (group->audio_sink)
+ if (group->audio_sink) {
+ if (group->audio_sink != playbin->audio_sink)
+ gst_element_set_state (group->audio_sink, GST_STATE_NULL);
gst_object_unref (group->audio_sink);
+ }
group->audio_sink = NULL;
- if (group->video_sink)
+ if (group->video_sink) {
+ if (group->video_sink != playbin->video_sink)
+ gst_element_set_state (group->video_sink, GST_STATE_NULL);
gst_object_unref (group->video_sink);
+ }
group->video_sink = NULL;
g_list_free (group->stream_changed_pending);
if (playbin->source)
gst_object_unref (playbin->source);
- if (playbin->video_sink)
+ if (playbin->video_sink) {
+ gst_element_set_state (playbin->video_sink, GST_STATE_NULL);
gst_object_unref (playbin->video_sink);
- if (playbin->audio_sink)
+ }
+ if (playbin->audio_sink) {
+ gst_element_set_state (playbin->audio_sink, GST_STATE_NULL);
gst_object_unref (playbin->audio_sink);
- if (playbin->text_sink)
+ }
+ if (playbin->text_sink) {
+ gst_element_set_state (playbin->text_sink, GST_STATE_NULL);
gst_object_unref (playbin->text_sink);
+ }
if (playbin->elements)
gst_plugin_feature_list_free (playbin->elements);
if (configure) {
/* if we have custom sinks, configure them now */
GST_SOURCE_GROUP_LOCK (group);
- if (group->audio_sink) {
- GST_INFO_OBJECT (playbin, "setting custom audio sink %" GST_PTR_FORMAT,
- group->audio_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_AUDIO,
- group->audio_sink);
- } else {
- GST_INFO_OBJECT (playbin, "setting default audio sink %" GST_PTR_FORMAT,
- playbin->audio_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_AUDIO,
- playbin->audio_sink);
- }
- if (group->video_sink) {
- GST_INFO_OBJECT (playbin, "setting custom video sink %" GST_PTR_FORMAT,
- group->video_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
- group->video_sink);
- } else {
- GST_INFO_OBJECT (playbin, "setting default video sink %" GST_PTR_FORMAT,
- playbin->video_sink);
- gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
- playbin->video_sink);
- }
+
+ GST_INFO_OBJECT (playbin, "setting custom audio sink %" GST_PTR_FORMAT,
+ group->audio_sink);
+ gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_AUDIO,
+ group->audio_sink);
+
+ GST_INFO_OBJECT (playbin, "setting custom video sink %" GST_PTR_FORMAT,
+ group->video_sink);
+ gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_VIDEO,
+ group->video_sink);
+
+ GST_INFO_OBJECT (playbin, "setting custom text sink %" GST_PTR_FORMAT,
+ playbin->text_sink);
gst_play_sink_set_sink (playbin->playsink, GST_PLAY_SINK_TYPE_TEXT,
playbin->text_sink);
+
GST_SOURCE_GROUP_UNLOCK (group);
GST_LOG_OBJECT (playbin, "reconfigure sink");
if ((sink = group->playbin->text_sink))
sinkpad = gst_element_get_static_pad (sink, "sink");
if (sinkpad) {
- GstCaps *sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+ GstCaps *sinkcaps;
+ sinkcaps = gst_pad_get_caps_reffed (sinkpad);
if (!gst_caps_is_any (sinkcaps))
ret = !gst_pad_accept_caps (sinkpad, caps);
gst_caps_unref (sinkcaps);
GST_OBJECT_CAST (group->suburidecodebin)))
goto done;
- if ((sink = group->playbin->audio_sink)) {
+ if ((sink = group->audio_sink)) {
sinkpad = gst_element_get_static_pad (sink, "sink");
if (sinkpad) {
- GstCaps *sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+ GstCaps *sinkcaps;
+ sinkcaps = gst_pad_get_caps_reffed (sinkpad);
if (!gst_caps_is_any (sinkcaps))
ret = !gst_pad_accept_caps (sinkpad, caps);
gst_caps_unref (sinkcaps);
if (!ret)
goto done;
- if ((sink = group->playbin->video_sink)) {
+ if ((sink = group->video_sink)) {
sinkpad = gst_element_get_static_pad (sink, "sink");
if (sinkpad) {
- GstCaps *sinkcaps = gst_pad_get_caps_reffed (sinkpad);
+ GstCaps *sinkcaps;
+ sinkcaps = gst_pad_get_caps_reffed (sinkpad);
if (!gst_caps_is_any (sinkcaps))
ret = !gst_pad_accept_caps (sinkpad, caps);
gst_caps_unref (sinkcaps);
GST_SOURCE_GROUP_LOCK (group);
+ /* First set up the custom sources */
+ if (playbin->audio_sink)
+ group->audio_sink = gst_object_ref (playbin->audio_sink);
+ if (playbin->video_sink)
+ group->video_sink = gst_object_ref (playbin->video_sink);
+
g_list_free (group->stream_changed_pending);
group->stream_changed_pending = NULL;
if (!group->stream_changed_pending_lock)
{
GstMessage *msg;
+ /* delete any custom sinks we might have */
+ if (group->audio_sink) {
+ /* If this is a automatically created sink set it to NULL */
+ if (group->audio_sink != playbin->audio_sink)
+ gst_element_set_state (group->audio_sink, GST_STATE_NULL);
+ gst_object_unref (group->audio_sink);
+ }
+ group->audio_sink = NULL;
+ if (group->video_sink) {
+ /* If this is a automatically created sink set it to NULL */
+ if (group->video_sink != playbin->video_sink)
+ gst_element_set_state (group->video_sink, GST_STATE_NULL);
+ gst_object_unref (group->video_sink);
+ }
+ group->video_sink = NULL;
+
GST_SOURCE_GROUP_UNLOCK (group);
msg =
gst_missing_element_message_new (GST_ELEMENT_CAST (playbin),
}
uridecodebin_failure:
{
+ /* delete any custom sinks we might have */
+ if (group->audio_sink) {
+ /* If this is a automatically created sink set it to NULL */
+ if (group->audio_sink != playbin->audio_sink)
+ gst_element_set_state (group->audio_sink, GST_STATE_NULL);
+ gst_object_unref (group->audio_sink);
+ }
+ group->audio_sink = NULL;
+ if (group->video_sink) {
+ /* If this is a automatically created sink set it to NULL */
+ if (group->video_sink != playbin->video_sink)
+ gst_element_set_state (group->video_sink, GST_STATE_NULL);
+ gst_object_unref (group->video_sink);
+ }
+ group->video_sink = NULL;
+
GST_DEBUG_OBJECT (playbin, "failed state change of uridecodebin");
return FALSE;
}
}
}
/* delete any custom sinks we might have */
- if (group->audio_sink)
+ if (group->audio_sink) {
+ /* If this is a automatically created sink set it to NULL */
+ if (group->audio_sink != playbin->audio_sink)
+ gst_element_set_state (group->audio_sink, GST_STATE_NULL);
gst_object_unref (group->audio_sink);
+ }
group->audio_sink = NULL;
- if (group->video_sink)
+ if (group->video_sink) {
+ /* If this is a automatically created sink set it to NULL */
+ if (group->video_sink != playbin->video_sink)
+ gst_element_set_state (group->video_sink, GST_STATE_NULL);
gst_object_unref (group->video_sink);
+ }
group->video_sink = NULL;
if (group->uridecodebin) {
}
}
+ /* Set our sinks back to NULL, they might not be child of playbin */
+ if (playbin->audio_sink)
+ gst_element_set_state (playbin->audio_sink, GST_STATE_NULL);
+ if (playbin->video_sink)
+ gst_element_set_state (playbin->video_sink, GST_STATE_NULL);
+ if (playbin->text_sink)
+ gst_element_set_state (playbin->text_sink, GST_STATE_NULL);
+
/* make sure the groups don't perform a state change anymore until we
* enable them again */
groups_set_locked_state (playbin, TRUE);