[FFmpeg-devel] [PATCH v5 5/7] libavformat/oggdec.{c, h}: Add new_extradata, use it to pass extradata to the next decoded packet.

Romain Beauxis romain.beauxis at gmail.com
Sat May 10 02:43:25 EEST 2025


---
 libavformat/oggdec.c | 11 +++++++++++
 libavformat/oggdec.h |  2 ++
 2 files changed, 13 insertions(+)

diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 5557eb4a14..cb77cdd994 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -77,6 +77,7 @@ static void free_stream(AVFormatContext *s, int i)
 
     av_freep(&stream->private);
     av_freep(&stream->new_metadata);
+    av_freep(&stream->new_extradata);
 }
 
 //FIXME We could avoid some structure duplication
@@ -888,6 +889,16 @@ retry:
         os->new_metadata_size = 0;
     }
 
+    if (os->new_extradata) {
+        ret = av_packet_add_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
+                                      os->new_extradata, os->new_extradata_size);
+        if (ret < 0)
+            return ret;
+
+        os->new_extradata = NULL;
+        os->new_extradata_size = 0;
+    }
+
     return psize;
 }
 
diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
index bc670d0f1e..5083de646c 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -94,6 +94,8 @@ struct ogg_stream {
     int end_trimming; ///< set the number of packets to drop from the end
     uint8_t *new_metadata;
     size_t new_metadata_size;
+    uint8_t *new_extradata;
+    size_t new_extradata_size;
     void *private;
 };
 
-- 
2.39.5 (Apple Git-154)



More information about the ffmpeg-devel mailing list