[FFmpeg-devel] [PATCH v8 7/8] libavformat/oggparseopus.c: Parse comments from secondary chained streams header packet.

Romain Beauxis romain.beauxis at gmail.com
Tue Mar 11 18:55:12 EET 2025


---
 libavformat/oggparseopus.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
index 218e9df581..fe25ad44f3 100644
--- a/libavformat/oggparseopus.c
+++ b/libavformat/oggparseopus.c
@@ -29,6 +29,7 @@
 
 struct oggopus_private {
     int need_comments;
+    int comments_parsed;
     unsigned pre_skip;
     int64_t cur_dts;
 };
@@ -81,7 +82,17 @@ static int opus_header(AVFormatContext *avf, int idx)
     if (priv->need_comments) {
         if (os->psize < 8 || memcmp(packet, "OpusTags", 8))
             return AVERROR_INVALIDDATA;
-        ff_vorbis_stream_comment(avf, st, packet + 8, os->psize - 8);
+
+        if (!priv->comments_parsed) {
+            ff_vorbis_stream_comment(avf, st, packet + 8, os->psize - 8);
+            priv->comments_parsed = 1;
+        } else {
+            ret = ff_vorbis_update_metadata(avf, st, packet + 8, os->psize - 8);
+
+            if (ret < 0)
+                return ret;
+        }
+
         priv->need_comments--;
         return 1;
     }
-- 
2.39.5 (Apple Git-154)



More information about the ffmpeg-devel mailing list