From 43621624c87dab8ed5ce98085fc1d3e91ea269a6 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 17 Apr 2015 15:35:43 +0200 Subject: [PATCH] mpegtsmux: Carry over GST_BUFFER_FLAG_HEADER In the same way we do it for the DELTA_UNIT flag This allows downstream elements to know whether a given mpeg-ts packet contains a corresponding HEADER elementary unit --- gst/mpegtsmux/mpegtsmux.c | 8 +++++++- gst/mpegtsmux/mpegtsmux.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 2acaf0359a..f427cc3a4d 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -1090,7 +1090,7 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data, TsMuxProgram *prog; gint64 pts = -1; guint64 dts = -1; - gboolean delta = TRUE; + gboolean delta = TRUE, header = FALSE; StreamData *stream_data; GST_DEBUG_OBJECT (mux, "Pads collected"); @@ -1189,6 +1189,7 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data, if (best->stream->is_video_stream) { delta = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); + header = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_HEADER); #if 0 GST_OBJECT_LOCK (mux); if (mux->element_index && !delta && best->element_index_writer_id != -1) { @@ -1215,6 +1216,7 @@ mpegtsmux_collected_buffer (GstCollectPads * pads, GstCollectData * data, } mux->is_delta = delta; + mux->is_header = header; while (tsmux_stream_bytes_in_buffer (best->stream) > 0) { if (!tsmux_write_stream_packet (mux->tsmux, best->stream)) { /* Failed writing data for some reason. Set appropriate error */ @@ -1344,6 +1346,10 @@ new_packet_common_init (MpegTsMux * mux, GstBuffer * buf, guint8 * data, } if (buf) { + if (mux->is_header) { + GST_LOG_OBJECT (mux, "marking as header buffer"); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER); + } if (mux->is_delta) { GST_LOG_OBJECT (mux, "marking as delta unit"); GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT); diff --git a/gst/mpegtsmux/mpegtsmux.h b/gst/mpegtsmux/mpegtsmux.h index f47707febd..eb8f935c12 100644 --- a/gst/mpegtsmux/mpegtsmux.h +++ b/gst/mpegtsmux/mpegtsmux.h @@ -152,6 +152,7 @@ struct MpegTsMux { GList *streamheader; gboolean streamheader_sent; gboolean is_delta; + gboolean is_header; GstClockTime last_ts; /* m2ts specific */