From d4e6aa89f86efbc9cc665f2ee123a33015f1449a Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Sat, 20 Nov 2021 15:39:08 +0900 Subject: [PATCH] subparse: Add reference timestamp meta in GstBuffer for HLS webvtt - When discontinuous buffer come in during HLS, send the input buffer pts to the reference timestamp meta data - The reference timetamp meta data is added with the input buffer pts to synchronize with the mpeg ts stream Change-Id: I5ff5b9523b44323f1d6aa37133e5341505d4ce55 --- gst/subparse/gstsubparse.c | 19 +++++++++++++++++++ packaging/gst-plugins-base.spec | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index 0b698f5..c807814 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -1982,6 +1982,9 @@ handle_buffer (GstSubParse * self, GstBuffer * buf) #ifdef TIZEN_FEATURE_SUBPARSE_MODIFICATION GstMessage *m = NULL; #endif +#ifdef TIZEN_FEATURE_HLS_WEBVTT + GstClockTime reference_time = GST_CLOCK_TIME_NONE; +#endif if (self->first_buffer) { GstMapInfo map; @@ -1994,6 +1997,11 @@ handle_buffer (GstSubParse * self, GstBuffer * buf) self->state.fps_d = self->fps_d; } +#ifdef TIZEN_FEATURE_HLS_WEBVTT + if (GST_BUFFER_IS_DISCONT (buf) && GST_BUFFER_PTS_IS_VALID (buf)) + reference_time = GST_BUFFER_PTS (buf); +#endif + feed_textbuf (self, buf); /* make sure we know the format */ @@ -2101,6 +2109,17 @@ handle_buffer (GstSubParse * self, GstBuffer * buf) GST_BUFFER_TIMESTAMP (buf) = self->state.start_time; GST_BUFFER_DURATION (buf) = self->state.duration; +#ifdef TIZEN_FEATURE_HLS_WEBVTT + if ((self->parser_type == GST_SUB_PARSE_FORMAT_VTT) + && GST_CLOCK_TIME_IS_VALID (reference_time)) { + GstCaps *sink_caps = gst_pad_get_current_caps (self->sinkpad); + if (sink_caps) { + gst_buffer_add_reference_timestamp_meta (buf, sink_caps, + reference_time, GST_CLOCK_TIME_NONE); + gst_caps_unref (sink_caps); + } + } +#endif /* in some cases (e.g. tmplayer) we can only determine the duration * of a text chunk from the timestamp of the next text chunk; in those * cases, we probably want to limit the duration to something diff --git a/packaging/gst-plugins-base.spec b/packaging/gst-plugins-base.spec index 71b292f..0e816d1 100644 --- a/packaging/gst-plugins-base.spec +++ b/packaging/gst-plugins-base.spec @@ -5,7 +5,7 @@ Name: gst-plugins-base Version: 1.16.2 -Release: 19 +Release: 20 License: LGPL-2.0+ Summary: GStreamer Streaming-Media Framework Plug-Ins Url: http://gstreamer.freedesktop.org/ -- 2.7.4