From: Gilbok Lee Date: Wed, 24 Nov 2021 00:33:17 +0000 (+0900) Subject: subparse: Send custom event for fragment_timestamp X-Git-Tag: accepted/tizen/unified/20220217.153506~2^2~10^2~9^2~16^2~1^2~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fgstreamer.git;a=commitdiff_plain;h=5b2d588fd78a32dabc0f1550bb5b8a5821e947ac subparse: Send custom event for fragment_timestamp - If there is no buffer in case of discontinuous, do not send reference timestamp. - related commit: d4e6aa89f86efbc9cc665f2ee123a33015f1449a 'subparse: Add reference timestamp meta in GstBuffer for HLS webvtt' commit Change-Id: Id98697ba6db1dc94b4ce4f753670524f6fcf506e --- diff --git a/gst/subparse/gstsubparse.c b/gst/subparse/gstsubparse.c index c807814..3668d5d 100644 --- a/gst/subparse/gstsubparse.c +++ b/gst/subparse/gstsubparse.c @@ -1140,6 +1140,24 @@ send_timestamp_map_event (GstSubParse * self) "mpegts", G_TYPE_UINT64, mpegts, NULL)); gst_pad_push_event (self->srcpad, event); } + +static void +send_fragment_timestamp_event (GstSubParse * self, GstClockTime timestamp) +{ + GstEvent *event = NULL; + + if (!GST_CLOCK_TIME_IS_VALID(timestamp)) + return; + + GST_LOG ("send fragment_timestamp %" GST_TIME_FORMAT , + GST_TIME_ARGS (timestamp)); + + event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, + gst_structure_new ("fragment_timestamp", + "timestamp", G_TYPE_UINT64, timestamp, NULL)); + + gst_pad_push_event (self->srcpad, event); +} #endif static gchar * @@ -1983,7 +2001,7 @@ handle_buffer (GstSubParse * self, GstBuffer * buf) GstMessage *m = NULL; #endif #ifdef TIZEN_FEATURE_HLS_WEBVTT - GstClockTime reference_time = GST_CLOCK_TIME_NONE; + GstClockTime fragment_timestamp = GST_CLOCK_TIME_NONE; #endif if (self->first_buffer) { @@ -1999,7 +2017,7 @@ handle_buffer (GstSubParse * self, GstBuffer * buf) #ifdef TIZEN_FEATURE_HLS_WEBVTT if (GST_BUFFER_IS_DISCONT (buf) && GST_BUFFER_PTS_IS_VALID (buf)) - reference_time = GST_BUFFER_PTS (buf); + fragment_timestamp = GST_BUFFER_PTS (buf); #endif feed_textbuf (self, buf); @@ -2051,6 +2069,10 @@ handle_buffer (GstSubParse * self, GstBuffer * buf) gst_pad_push_event (self->srcpad, gst_event_new_tag (tags)); } } +#ifdef TIZEN_FEATURE_HLS_WEBVTT + if (self->parser_type == GST_SUB_PARSE_FORMAT_VTT) + send_fragment_timestamp_event (self, fragment_timestamp); +#endif while (!self->flushing && (line = get_next_line (self))) { guint offset = 0; @@ -2109,17 +2131,6 @@ 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 0e816d1..ef82c51 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: 20 +Release: 21 License: LGPL-2.0+ Summary: GStreamer Streaming-Media Framework Plug-Ins Url: http://gstreamer.freedesktop.org/