[FFmpeg-cvslog] avcodec/trace_headers_bsf: also parse extradata in packet side data

James Almer git at videolan.org
Sun Aug 15 05:08:41 EEST 2021


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Thu Aug  5 12:04:14 2021 -0300| [acd079843b7cdf18a1d6c84a5fe48555f7554e92] | committer: James Almer

avcodec/trace_headers_bsf: also parse extradata in packet side data

Certain mov/mp4 files have parameter sets out of band, and when required for a
sample it may be propagated within the relevant packet's side data.
This fixes parsing said files if the SPS and/or PPS in the side data is
different than the one in extradata.

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=acd079843b7cdf18a1d6c84a5fe48555f7554e92
---

 libavcodec/trace_headers_bsf.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c
index b891730bac..a9b0247412 100644
--- a/libavcodec/trace_headers_bsf.c
+++ b/libavcodec/trace_headers_bsf.c
@@ -95,6 +95,19 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
 
     av_log(bsf, AV_LOG_INFO, "Packet: %d bytes%s.\n", pkt->size, tmp);
 
+    if (av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, NULL)) {
+        av_log(bsf, AV_LOG_INFO, "Side data:\n");
+
+        err = ff_cbs_read_packet_side_data(ctx->cbc, frag, pkt);
+        ff_cbs_fragment_reset(frag);
+
+        if (err < 0) {
+            av_packet_unref(pkt);
+            return err;
+        }
+        av_log(bsf, AV_LOG_INFO, "Payload:\n");
+    }
+
     err = ff_cbs_read_packet(ctx->cbc, frag, pkt);
 
     ff_cbs_fragment_reset(frag);



More information about the ffmpeg-cvslog mailing list