mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 06:26:23 +00:00
mssdemux: set timestamp and duration to fragment buffers
We can get those from the manifest and helps downstream to know the fragment start time after a seeking operation
This commit is contained in:
parent
ebd0862ac1
commit
9b3f67c5b0
3 changed files with 44 additions and 0 deletions
|
@ -646,12 +646,18 @@ gst_mss_demux_stream_loop (GstMssDemuxStream * stream)
|
|||
buffer = gst_fragment_get_buffer (fragment);
|
||||
buffer = gst_buffer_make_metadata_writable (buffer);
|
||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (stream->pad));
|
||||
GST_BUFFER_TIMESTAMP (buffer) =
|
||||
gst_mss_stream_get_fragment_gst_timestamp (stream->manifest_stream);
|
||||
GST_BUFFER_DURATION (buffer) =
|
||||
gst_mss_stream_get_fragment_gst_duration (stream->manifest_stream);
|
||||
|
||||
if (G_UNLIKELY (stream->pending_newsegment)) {
|
||||
gst_pad_push_event (stream->pad, stream->pending_newsegment);
|
||||
stream->pending_newsegment = NULL;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (mssdemux, "Pushing buffer of size %u on pad %s",
|
||||
GST_BUFFER_SIZE (buffer), GST_PAD_NAME (stream->pad));
|
||||
ret = gst_pad_push (stream->pad, buffer);
|
||||
switch (ret) {
|
||||
case GST_FLOW_UNEXPECTED:
|
||||
|
|
|
@ -562,6 +562,42 @@ gst_mss_stream_get_fragment_url (GstMssStream * stream, gchar ** url)
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
GstClockTime
|
||||
gst_mss_stream_get_fragment_gst_timestamp (GstMssStream * stream)
|
||||
{
|
||||
guint64 time;
|
||||
guint64 timescale;
|
||||
GstMssStreamFragment *fragment;
|
||||
|
||||
if (!stream->current_fragment)
|
||||
return GST_CLOCK_TIME_NONE;
|
||||
|
||||
fragment = stream->current_fragment->data;
|
||||
|
||||
time = fragment->time;
|
||||
timescale = gst_mss_stream_get_timescale (stream);
|
||||
return (GstClockTime) gst_util_uint64_scale_round (time, GST_SECOND,
|
||||
timescale);
|
||||
}
|
||||
|
||||
GstClockTime
|
||||
gst_mss_stream_get_fragment_gst_duration (GstMssStream * stream)
|
||||
{
|
||||
guint64 dur;
|
||||
guint64 timescale;
|
||||
GstMssStreamFragment *fragment;
|
||||
|
||||
if (!stream->current_fragment)
|
||||
return GST_CLOCK_TIME_NONE;
|
||||
|
||||
fragment = stream->current_fragment->data;
|
||||
|
||||
dur = fragment->duration;
|
||||
timescale = gst_mss_stream_get_timescale (stream);
|
||||
return (GstClockTime) gst_util_uint64_scale_round (dur, GST_SECOND,
|
||||
timescale);
|
||||
}
|
||||
|
||||
GstFlowReturn
|
||||
gst_mss_stream_advance_fragment (GstMssStream * stream)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,8 @@ GstMssStreamType gst_mss_stream_get_type (GstMssStream *stream);
|
|||
GstCaps * gst_mss_stream_get_caps (GstMssStream * stream);
|
||||
guint64 gst_mss_stream_get_timescale (GstMssStream * stream);
|
||||
GstFlowReturn gst_mss_stream_get_fragment_url (GstMssStream * stream, gchar ** url);
|
||||
GstClockTime gst_mss_stream_get_fragment_gst_timestamp (GstMssStream * stream);
|
||||
GstClockTime gst_mss_stream_get_fragment_gst_duration (GstMssStream * stream);
|
||||
GstFlowReturn gst_mss_stream_advance_fragment (GstMssStream * stream);
|
||||
gboolean gst_mss_stream_seek (GstMssStream * stream, guint64 time);
|
||||
|
||||
|
|
Loading…
Reference in a new issue