[FFmpeg-cvslog] oggparsevorbis: export replaygain tags from Vorbis comments

Alessandro Ghedini git at videolan.org
Fri Apr 4 23:24:01 CEST 2014


ffmpeg | branch: master | Alessandro Ghedini <alessandro at ghedini.me> | Fri Apr  4 11:50:46 2014 +0200| [0048deb84cb6d22ba7f4fd7c8b4ecc054fcc22d4] | committer: Anton Khirnov

oggparsevorbis: export replaygain tags from Vorbis comments

Signed-off-by: Anton Khirnov <anton at khirnov.net>

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

 libavformat/Makefile         |    1 +
 libavformat/oggparsevorbis.c |    9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8be9e2d..e3bfd3a 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -221,6 +221,7 @@ OBJS-$(CONFIG_OGG_DEMUXER)               += oggdec.o         \
                                             oggparsespeex.o  \
                                             oggparsetheora.o \
                                             oggparsevorbis.o \
+                                            replaygain.o     \
                                             vorbiscomment.o  \
                                             flac_picture.o
 OBJS-$(CONFIG_OGG_MUXER)                 += oggenc.o \
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index c19b545..3eac0ba 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -36,6 +36,7 @@
 #include "internal.h"
 #include "oggdec.h"
 #include "vorbiscomment.h"
+#include "replaygain.h"
 
 static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val)
 {
@@ -305,8 +306,14 @@ static int vorbis_header(AVFormatContext *s, int idx)
         if (os->psize > 8 &&
             ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7,
                               os->psize - 8) >= 0) {
+            unsigned new_len;
+
+            int ret = ff_replaygain_export(st, st->metadata);
+            if (ret < 0)
+                return ret;
+
             // drop all metadata we parsed and which is not required by libvorbis
-            unsigned new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1;
+            new_len = 7 + 4 + AV_RL32(priv->packet[1] + 7) + 4 + 1;
             if (new_len >= 16 && new_len < os->psize) {
                 AV_WL32(priv->packet[1] + new_len - 5, 0);
                 priv->packet[1][new_len - 1] = 1;



More information about the ffmpeg-cvslog mailing list