[FFmpeg-devel] [PATCH v2 1/3] libavformat/oggdec: Allow first parameter in ff_vorbis_comment to be a generic AVClass struct

Romain Beauxis romain.beauxis at gmail.com
Tue Feb 4 13:15:19 EET 2025


Firt argument in these function is only used to pass to av_log. This
makes it possible to re-use them with any type of AVClass struct.

---
 libavformat/oggdec.h         | 5 ++++-
 libavformat/oggparsevorbis.c | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavformat/oggdec.h b/libavformat/oggdec.h
index 43df23f4cb..6177254fd2 100644
--- a/libavformat/oggdec.h
+++ b/libavformat/oggdec.h
@@ -136,8 +136,11 @@ extern const struct ogg_codec ff_vp8_codec;
  *        so it needs to be writable. Furthermore it must be padded
  *        by a single byte (not counted in size).
  *        All changes will have been reverted upon return.
+ *
+ * @param avcl A pointer to an arbitrary struct of which the first field is a
+ *        pointer to an AVClass struct.
  */
-int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m,
+int ff_vorbis_comment(void *avcl, AVDictionary **m,
                       const uint8_t *buf, int size, int parse_picture);
 
 /**
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index 9f50ab9ffc..62eb8bbf70 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -88,7 +88,7 @@ int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st,
  * and reverts its changes before return. The input buffer needs to have
  * at least one byte of padding.
  */
-static int vorbis_parse_single_comment(AVFormatContext *as, AVDictionary **m,
+static int vorbis_parse_single_comment(void *as, AVDictionary **m,
                                        const uint8_t *buf, uint32_t size,
                                        int *updates, int parse_picture)
 {
@@ -146,7 +146,7 @@ end:
     return 0;
 }
 
-int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
+int ff_vorbis_comment(void *as, AVDictionary **m,
                       const uint8_t *buf, int size,
                       int parse_picture)
 {
-- 
2.39.5 (Apple Git-154)



More information about the ffmpeg-devel mailing list