1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

oggparsevorbis: export replaygain tags from Vorbis comments

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Alessandro Ghedini 2014-04-04 11:50:46 +02:00 committed by Anton Khirnov
parent 1d55f8d5f6
commit 0048deb84c
2 changed files with 9 additions and 1 deletions

View File

@ -221,6 +221,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
oggparsespeex.o \ oggparsespeex.o \
oggparsetheora.o \ oggparsetheora.o \
oggparsevorbis.o \ oggparsevorbis.o \
replaygain.o \
vorbiscomment.o \ vorbiscomment.o \
flac_picture.o flac_picture.o
OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \ OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \

View File

@ -36,6 +36,7 @@
#include "internal.h" #include "internal.h"
#include "oggdec.h" #include "oggdec.h"
#include "vorbiscomment.h" #include "vorbiscomment.h"
#include "replaygain.h"
static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val) 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 && if (os->psize > 8 &&
ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7, ff_vorbis_comment(s, &st->metadata, os->buf + os->pstart + 7,
os->psize - 8) >= 0) { 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 // 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) { if (new_len >= 16 && new_len < os->psize) {
AV_WL32(priv->packet[1] + new_len - 5, 0); AV_WL32(priv->packet[1] + new_len - 5, 0);
priv->packet[1][new_len - 1] = 1; priv->packet[1][new_len - 1] = 1;