mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 09:41:07 +00:00
hlsdemux2: Expose EXT-X-PROGRAM-DATE-TIME as tags.
This allows an application to use timestamps associated with fragments. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1417>
This commit is contained in:
parent
a2990020b2
commit
aafe07a802
2 changed files with 21 additions and 1 deletions
|
@ -192,6 +192,7 @@ gst_hls_demux_stream_init (GstHLSDemuxStream * stream)
|
|||
stream->do_typefind = TRUE;
|
||||
stream->reset_pts = TRUE;
|
||||
stream->presentation_offset = 60 * GST_SECOND;
|
||||
stream->pdt_tag_sent = FALSE;
|
||||
}
|
||||
|
||||
typedef struct _GstHLSDemux2 GstHLSDemux2;
|
||||
|
@ -1683,8 +1684,9 @@ gst_hls_demux_stream_data_received (GstAdaptiveDemux2Stream * stream,
|
|||
{
|
||||
GstHLSDemuxStream *hls_stream = GST_HLS_DEMUX_STREAM_CAST (stream);
|
||||
GstHLSDemux *hlsdemux = GST_HLS_DEMUX_CAST (stream->demux);
|
||||
GstM3U8MediaSegment *file = hls_stream->current_segment;
|
||||
|
||||
if (hls_stream->current_segment == NULL)
|
||||
if (file == NULL)
|
||||
return GST_ADAPTIVE_DEMUX_FLOW_LOST_SYNC;
|
||||
|
||||
if (hls_stream->current_offset == -1)
|
||||
|
@ -1727,6 +1729,14 @@ gst_hls_demux_stream_data_received (GstAdaptiveDemux2Stream * stream,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
if (!hls_stream->pdt_tag_sent && file != NULL && file->datetime != NULL) {
|
||||
gst_adaptive_demux2_stream_set_tags (stream,
|
||||
gst_tag_list_new (GST_TAG_DATE_TIME,
|
||||
gst_date_time_new_from_g_date_time (g_date_time_ref
|
||||
(file->datetime)), NULL));
|
||||
hls_stream->pdt_tag_sent = TRUE;
|
||||
}
|
||||
|
||||
return gst_hls_demux_stream_handle_buffer (stream, buffer, FALSE);
|
||||
}
|
||||
|
||||
|
@ -2598,6 +2608,14 @@ gst_hls_demux_reset (GstAdaptiveDemux * ademux)
|
|||
|
||||
GST_DEBUG_OBJECT (demux, "resetting");
|
||||
|
||||
if (ademux->input_period) {
|
||||
GList *walk;
|
||||
for (walk = ademux->input_period->streams; walk != NULL; walk = walk->next) {
|
||||
GstHLSDemuxStream *hls_stream = GST_HLS_DEMUX_STREAM_CAST (walk->data);
|
||||
hls_stream->pdt_tag_sent = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (demux->master) {
|
||||
gst_hls_master_playlist_unref (demux->master);
|
||||
demux->master = NULL;
|
||||
|
|
|
@ -168,6 +168,8 @@ struct _GstHLSDemuxStream
|
|||
* "output" stream times. Not enabled (i.e 0) if variant is ISOBMFF
|
||||
*/
|
||||
GstClockTime presentation_offset;
|
||||
|
||||
gboolean pdt_tag_sent;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in a new issue