From dc5006fa250b12e95a6530697985d001856a2637 Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Sun, 28 Oct 2018 14:43:01 +0000 Subject: [PATCH] playbin: New text-offset property This new property controls the synchronisation offset between the text and video streams. Positive values make the text ahead of the video and negative values make the text go behind the video. https://bugzilla.gnome.org/show_bug.cgi?id=797134 --- gst/playback/gstplaybin2.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index a2e9ed4..1f3d9fa 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -553,6 +553,7 @@ enum PROP_BUFFER_SIZE, PROP_BUFFER_DURATION, PROP_AV_OFFSET, + PROP_TEXT_OFFSET, PROP_RING_BUFFER_MAX_SIZE, PROP_FORCE_ASPECT_RATIO, PROP_AUDIO_FILTER, @@ -956,6 +957,19 @@ gst_play_bin_class_init (GstPlayBinClass * klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** + * GstPlayBin:text-offset: + * + * Control the synchronisation offset between the text and video streams. + * Positive values make the text ahead of the video and negative values make + * the text go behind the video. + */ + g_object_class_install_property (gobject_klass, PROP_TEXT_OFFSET, + g_param_spec_int64 ("text-offset", "Text Offset", + "The synchronisation offset between text and video in nanoseconds", + G_MININT64, G_MAXINT64, 0, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** * GstPlayBin:ring-buffer-max-size * * The maximum size of the ring buffer in bytes. If set to 0, the ring @@ -2465,6 +2479,10 @@ gst_play_bin_set_property (GObject * object, guint prop_id, gst_play_sink_set_av_offset (playbin->playsink, g_value_get_int64 (value)); break; + case PROP_TEXT_OFFSET: + gst_play_sink_set_text_offset (playbin->playsink, + g_value_get_int64 (value)); + break; case PROP_RING_BUFFER_MAX_SIZE: playbin->ring_buffer_max_size = g_value_get_uint64 (value); if (playbin->curr_group) { @@ -2723,6 +2741,10 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value, g_value_set_int64 (value, gst_play_sink_get_av_offset (playbin->playsink)); break; + case PROP_TEXT_OFFSET: + g_value_set_int64 (value, + gst_play_sink_get_text_offset (playbin->playsink)); + break; case PROP_RING_BUFFER_MAX_SIZE: g_value_set_uint64 (value, playbin->ring_buffer_max_size); break; -- 2.7.4