From 1692d677adc74233bf2c0ef411592a6ef5313e34 Mon Sep 17 00:00:00 2001
From: Oliver Collyer <ovcollyer@mac.com>
Date: Thu, 7 Mar 2019 20:25:58 +0000
Subject: [PATCH 1/1] mpegtsenc: added support for the write_data_type callback
 for this format, and use it to indicate sync points in the stream

---
 libavformat/mpegtsenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index fc0ea225c6..e5d1a64b4c 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1815,6 +1815,12 @@ static int mpegts_write_packet(AVFormatContext *s, AVPacket *pkt)
         mpegts_write_flush(s);
         return 1;
     } else {
+        if (s->pb && s->pb->write_data_type) {
+            AVStream *st = s->streams[pkt->stream_index];
+            avio_write_marker(s->pb,
+                av_rescale_q(pkt->dts, st->time_base, AV_TIME_BASE_Q),
+                (pkt->flags & AV_PKT_FLAG_KEY) && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? AVIO_DATA_MARKER_SYNC_POINT : AVIO_DATA_MARKER_BOUNDARY_POINT);
+        }
         return mpegts_write_packet_internal(s, pkt);
     }
 }
-- 
2.20.1.windows.1

