Browse code

mp3dec: export replaygain tags from ID3v2

Anton Khirnov authored on 2014/02/20 05:02:12
Showing 3 changed files
... ...
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.
4 4
 version <next>:
5 5
 - libx265 encoder
6 6
 - shuffleplanes filter
7
+- replaygain data export
7 8
 
8 9
 
9 10
 version 10:
... ...
@@ -182,7 +182,7 @@ OBJS-$(CONFIG_MOV_DEMUXER)               += mov.o isom.o mov_chan.o
182 182
 OBJS-$(CONFIG_MOV_MUXER)                 += movenc.o isom.o avc.o hevc.o \
183 183
                                             movenchint.o mov_chan.o
184 184
 OBJS-$(CONFIG_MP2_MUXER)                 += mp3enc.o rawenc.o id3v2enc.o
185
-OBJS-$(CONFIG_MP3_DEMUXER)               += mp3dec.o
185
+OBJS-$(CONFIG_MP3_DEMUXER)               += mp3dec.o replaygain.o
186 186
 OBJS-$(CONFIG_MP3_MUXER)                 += mp3enc.o rawenc.o id3v2enc.o
187 187
 OBJS-$(CONFIG_MPC_DEMUXER)               += mpc.o apetag.o img2.o
188 188
 OBJS-$(CONFIG_MPC8_DEMUXER)              += mpc8.o apetag.o img2.o
... ...
@@ -27,6 +27,8 @@
27 27
 #include "internal.h"
28 28
 #include "id3v2.h"
29 29
 #include "id3v1.h"
30
+#include "replaygain.h"
31
+
30 32
 #include "libavcodec/mpegaudiodecheader.h"
31 33
 
32 34
 #define XING_FLAG_FRAMES 0x01
... ...
@@ -194,6 +196,7 @@ static int mp3_read_header(AVFormatContext *s)
194 194
 {
195 195
     AVStream *st;
196 196
     int64_t off;
197
+    int ret;
197 198
 
198 199
     st = avformat_new_stream(s, NULL);
199 200
     if (!st)
... ...
@@ -215,6 +218,10 @@ static int mp3_read_header(AVFormatContext *s)
215 215
     if (mp3_parse_vbr_tags(s, st, off) < 0)
216 216
         avio_seek(s->pb, off, SEEK_SET);
217 217
 
218
+    ret = ff_replaygain_export(st, s->metadata);
219
+    if (ret < 0)
220
+        return ret;
221
+
218 222
     /* the parameters will be extracted from the compressed bitstream */
219 223
     return 0;
220 224
 }