Commit 849a8c4c authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '0048deb8'

* commit '0048deb8':
  oggparsevorbis: export replaygain tags from Vorbis comments

Conflicts:
	libavformat/Makefile
	libavformat/oggparsevorbis.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 8e8c8607 0048deb8
...@@ -267,6 +267,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \ ...@@ -267,6 +267,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += oggdec.o \
oggparsetheora.o \ oggparsetheora.o \
oggparsevorbis.o \ oggparsevorbis.o \
oggparsevp8.o \ oggparsevp8.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 \
......
...@@ -36,6 +36,7 @@ ...@@ -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)
{ {
...@@ -348,8 +349,14 @@ static int vorbis_header(AVFormatContext *s, int idx) ...@@ -348,8 +349,14 @@ static int vorbis_header(AVFormatContext *s, int idx)
} }
} else if (os->buf[os->pstart] == 3) { } else if (os->buf[os->pstart] == 3) {
if (vorbis_update_metadata(s, idx) >= 0 && priv->len[1] > 10) { if (vorbis_update_metadata(s, idx) >= 0 && priv->len[1] > 10) {
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment