[FFmpeg-devel] [PATCH 2/5] mpegts: Stash original PTS for SCTE-35 sections for processing later
Devin Heitmueller
devin.heitmueller at ltnglobal.com
Sat Jun 17 01:12:55 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 | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 385d78b..b8f1d7d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1782,8 +1782,15 @@ 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) {
+ int64_t *orig_pts;
ts->pkt->pts = ts->pkt->dts = f->last_pcr/300;
+ orig_pts = (int64_t *) av_packet_new_side_data(ts->pkt,
+ AV_PKT_DATA_ORIG_PTS,
+ sizeof(int64_t));
+ if (orig_pts)
+ *orig_pts = ts->pkt->pts;
+ }
}
ts->stop_parse = 1;
--
1.8.3.1
More information about the ffmpeg-devel
mailing list