diff mbox series

[FFmpeg-devel,2/5] mpegts: Stash original PTS for SCTE-35 sections for processing later

Message ID 1686953578-18843-3-git-send-email-dheitmueller@ltnglobal.com
State New
Headers show
Series Add passthrough support for SCTE-35 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Devin Heitmueller June 16, 2023, 10:12 p.m. UTC
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@ltnglobal.com>
---
 libavformat/mpegts.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

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;