mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
Make switching off of subtitles work. To avoid all kind of problems with unlinking of the subtitle input, we just kee...
Original commit message from CVS: * ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init): * gst/playback/gstplaybasebin.c: (set_subtitles_visible), (set_active_source): * gst/playback/gstplaybasebin.h: * gst/playback/gstplaybin.c: (gst_play_bin_class_init), (setup_sinks), (playbin_set_subtitles_visible): Make switching off of subtitles work. To avoid all kind of problems with unlinking of the subtitle input, we just keep the subtitle inputs linked as they are and tell textoverlay not to render them. Fixes #373011. Other subtitle switching issues (esp. when there are both external and in-stream subtitles) remain. They'll be solved in playbin2.
This commit is contained in:
parent
e56165db4f
commit
85f189aee5
5 changed files with 59 additions and 0 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2007-12-20 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* ext/pango/gsttextoverlay.c: (gst_text_overlay_class_init):
|
||||
* gst/playback/gstplaybasebin.c: (set_subtitles_visible),
|
||||
(set_active_source):
|
||||
* gst/playback/gstplaybasebin.h:
|
||||
* gst/playback/gstplaybin.c: (gst_play_bin_class_init),
|
||||
(setup_sinks), (playbin_set_subtitles_visible):
|
||||
Make switching off of subtitles work. To avoid all kind of
|
||||
problems with unlinking of the subtitle input, we just keep
|
||||
the subtitle inputs linked as they are and tell textoverlay
|
||||
not to render them. Fixes #373011.
|
||||
Other subtitle switching issues (esp. when there are both
|
||||
external and in-stream subtitles) remain. They'll be solved
|
||||
in playbin2.
|
||||
|
||||
2007-12-18 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst/playback/gststreamselector.c: (gst_selector_pad_init):
|
||||
|
|
|
@ -400,6 +400,7 @@ gst_text_overlay_class_init (GstTextOverlayClass * klass)
|
|||
*
|
||||
* Since: 0.10.15
|
||||
**/
|
||||
/* FIXME 0.11: rename to "visible" or "text-visible" or "render-text" */
|
||||
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SILENT,
|
||||
g_param_spec_boolean ("silent", "silent",
|
||||
"Whether to render the text string",
|
||||
|
|
|
@ -2380,6 +2380,17 @@ muted_group_change_state (GstElement * element,
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
|
||||
{
|
||||
GstPlayBaseBinClass *klass = GST_PLAY_BASE_BIN_GET_CLASS (play_base_bin);
|
||||
|
||||
/* we use a vfunc for this since we don't have a reference to the
|
||||
* textoverlay element, but playbin does */
|
||||
if (klass != NULL && klass->set_subtitles_visible != NULL)
|
||||
klass->set_subtitles_visible (play_base_bin, visible);
|
||||
}
|
||||
|
||||
/*
|
||||
* Caller has group-lock held.
|
||||
*/
|
||||
|
@ -2403,6 +2414,17 @@ set_active_source (GstPlayBaseBin * play_base_bin,
|
|||
return;
|
||||
}
|
||||
|
||||
/* HACK: instead of unlinking the subtitle input (= lots of hassle,
|
||||
* especially if subtitles come from an external source), just tell
|
||||
* textoverlay not to render them */
|
||||
if (type == GST_STREAM_TYPE_TEXT) {
|
||||
gboolean visible = (source_num != -1);
|
||||
|
||||
set_subtitles_visible (play_base_bin, visible);
|
||||
if (!visible)
|
||||
return;
|
||||
}
|
||||
|
||||
sel = group->type[type - 1].selector;
|
||||
|
||||
for (s = group->streaminfo; s; s = s->next) {
|
||||
|
|
|
@ -110,6 +110,9 @@ struct _GstPlayBaseBinClass {
|
|||
/* virtual fuctions */
|
||||
gboolean (*setup_output_pads) (GstPlayBaseBin *play_base_bin,
|
||||
GstPlayBaseGroup *group);
|
||||
|
||||
void (*set_subtitles_visible) (GstPlayBaseBin *play_base_bin,
|
||||
gboolean visible);
|
||||
};
|
||||
|
||||
GType gst_play_base_bin_get_type (void);
|
||||
|
|
|
@ -324,6 +324,8 @@ static void gst_play_bin_dispose (GObject * object);
|
|||
static gboolean setup_sinks (GstPlayBaseBin * play_base_bin,
|
||||
GstPlayBaseGroup * group);
|
||||
static void remove_sinks (GstPlayBin * play_bin);
|
||||
static void playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin,
|
||||
gboolean visible);
|
||||
|
||||
static void gst_play_bin_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * spec);
|
||||
|
@ -428,6 +430,7 @@ gst_play_bin_class_init (GstPlayBinClass * klass)
|
|||
GST_DEBUG_FUNCPTR (gst_play_bin_handle_message);
|
||||
|
||||
playbasebin_klass->setup_output_pads = setup_sinks;
|
||||
playbasebin_klass->set_subtitles_visible = playbin_set_subtitles_visible;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1625,6 +1628,20 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
|
|||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
playbin_set_subtitles_visible (GstPlayBaseBin * play_base_bin, gboolean visible)
|
||||
{
|
||||
GstPlayBin *playbin = GST_PLAY_BIN (play_base_bin);
|
||||
|
||||
/* we're ignoring the case of someone setting the 'current-text' property
|
||||
* before textoverlay is set up (which is probably okay, since playbasebin
|
||||
* will just select the first subtitle stream as active stream regardless) */
|
||||
if (playbin->textoverlay_element != NULL) {
|
||||
GST_LOG_OBJECT (playbin, "setting subtitle visibility to %d", visible);
|
||||
g_object_set (playbin->textoverlay_element, "silent", !visible, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send an event to our sinks until one of them works; don't then send to the
|
||||
* remaining sinks (unlike GstBin)
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue