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:
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)
{
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);