[FFmpeg-devel] [PATCH v2 2/5] mpegts: Stash original PTS for SCTE-35 sections for processing later
Devin Heitmueller
devin.heitmueller at ltnglobal.com
Mon Jul 3 21:15:06 EEST 2023
We need the original PTS value in order to do subsequent processing,
so set it as packet side data.
Signed-off-by: Devin Heitmueller <dheitmueller at ltnglobal.com>
---
libavformat/mpegts.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 0b3edda..a1b2420 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1783,8 +1783,17 @@ static void scte_data_cb(MpegTSFilter *filter, const uint8_t *section,
prg = av_find_program_from_stream(ts->stream, NULL, idx);
if (prg && prg->pcr_pid != -1 && prg->discard != AVDISCARD_ALL) {
MpegTSFilter *f = ts->pids[prg->pcr_pid];
- if (f && f->last_pcr != -1)
+ if (f && f->last_pcr != -1) {
+ AVTransportTimestamp *transport_ts;
ts->pkt->pts = ts->pkt->dts = f->last_pcr/300;
+ transport_ts = (AVTransportTimestamp *) av_packet_new_side_data(ts->pkt,
+ AV_PKT_DATA_TRANSPORT_TIMESTAMP,
+ sizeof(AVTransportTimestamp));
+ if (transport_ts) {
+ transport_ts->pts = ts->pkt->pts;
+ transport_ts->time_base = av_make_q(1, 90000);
+ }
+ }
}
ts->stop_parse = 1;
--
1.8.3.1
More information about the ffmpeg-devel
mailing list