+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):
*
* 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",
}
#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.
*/
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) {
/* 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);
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);
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
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)
*/