mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
playbin2: allow dynamic swtiching of subtitles
When we have the textpad configured, enable and disable the subtitles by setting the silent flag on the overlay element instead of trying to remove elements. See #576187
This commit is contained in:
parent
20d0351b76
commit
7628319688
1 changed files with 18 additions and 8 deletions
|
@ -1434,7 +1434,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
add_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
|
add_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
|
||||||
activate_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
|
activate_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
|
||||||
/* if we are not part of vis or subtitles, set the ghostpad target */
|
/* if we are not part of vis or subtitles, set the ghostpad target */
|
||||||
if (!need_vis && !need_text) {
|
if (!need_vis && !need_text && playsink->text_pad == NULL) {
|
||||||
GST_DEBUG_OBJECT (playsink, "ghosting video sinkpad");
|
GST_DEBUG_OBJECT (playsink, "ghosting video sinkpad");
|
||||||
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad),
|
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad),
|
||||||
playsink->videochain->sinkpad);
|
playsink->videochain->sinkpad);
|
||||||
|
@ -1458,8 +1458,8 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
playsink->audio_tee_vissrc = NULL;
|
playsink->audio_tee_vissrc = NULL;
|
||||||
}
|
}
|
||||||
srcpad =
|
srcpad =
|
||||||
gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->
|
gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain->
|
||||||
vischain->chain.bin), "src");
|
chain.bin), "src");
|
||||||
gst_pad_unlink (srcpad, playsink->videochain->sinkpad);
|
gst_pad_unlink (srcpad, playsink->videochain->sinkpad);
|
||||||
}
|
}
|
||||||
add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
|
add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
|
||||||
|
@ -1484,14 +1484,24 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
playsink->textchain->videosinkpad);
|
playsink->textchain->videosinkpad);
|
||||||
gst_pad_link (playsink->textchain->srcpad, playsink->videochain->sinkpad);
|
gst_pad_link (playsink->textchain->srcpad, playsink->videochain->sinkpad);
|
||||||
activate_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
|
activate_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
|
||||||
|
if (playsink->textchain->overlay)
|
||||||
|
g_object_set (playsink->textchain->overlay, "silent", FALSE, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (playsink, "no text needed");
|
GST_DEBUG_OBJECT (playsink, "no text needed");
|
||||||
/* we have no subtitles/text or we are requested to not show them */
|
/* we have no subtitles/text or we are requested to not show them */
|
||||||
if (playsink->textchain) {
|
if (playsink->textchain) {
|
||||||
GST_DEBUG_OBJECT (playsink, "removing text chain");
|
if (playsink->text_pad == NULL) {
|
||||||
add_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
|
/* no text pad, remove the chain entirely */
|
||||||
activate_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
|
GST_DEBUG_OBJECT (playsink, "removing text chain");
|
||||||
|
add_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
|
||||||
|
activate_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
|
||||||
|
} else {
|
||||||
|
/* we have a chain and a textpad, turn the subtitles off */
|
||||||
|
GST_DEBUG_OBJECT (playsink, "turning off the text");
|
||||||
|
if (playsink->textchain->overlay)
|
||||||
|
g_object_set (playsink->textchain->overlay, "silent", TRUE, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!need_video && playsink->video_pad)
|
if (!need_video && playsink->video_pad)
|
||||||
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad), NULL);
|
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->video_pad), NULL);
|
||||||
|
@ -1581,8 +1591,8 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
|
||||||
if (playsink->vischain) {
|
if (playsink->vischain) {
|
||||||
GST_DEBUG_OBJECT (playsink, "setting up vis chain");
|
GST_DEBUG_OBJECT (playsink, "setting up vis chain");
|
||||||
srcpad =
|
srcpad =
|
||||||
gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->
|
gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain->
|
||||||
vischain->chain.bin), "src");
|
chain.bin), "src");
|
||||||
add_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
|
add_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
|
||||||
activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
|
activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
|
||||||
if (playsink->audio_tee_vissrc == NULL) {
|
if (playsink->audio_tee_vissrc == NULL) {
|
||||||
|
|
Loading…
Reference in a new issue