On 01/02/15 10:00 PM, Ben Boeckel wrote: > FLAC doesn't really support IDv3 tags, so warn if they are found at all. > If vorbis tags are found, toss out the IDv3 tags. They are kept if > vorbis tags aren't found to at least have something there. > > Fixes #3799. > > Signed-off-by: Ben Boeckel <maths...@gmail.com> > --- > libavformat/flacdec.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c > index 1a8dc19..be637e3 100644 > --- a/libavformat/flacdec.c > +++ b/libavformat/flacdec.c > @@ -33,6 +33,7 @@ static int flac_read_header(AVFormatContext *s) > int ret, metadata_last=0, metadata_type, metadata_size, > found_streaminfo=0; > uint8_t header[4]; > uint8_t *buffer=NULL; > + int has_idv3 = 0; > AVStream *st = avformat_new_stream(s, NULL); > if (!st) > return AVERROR(ENOMEM); > @@ -47,6 +48,16 @@ static int flac_read_header(AVFormatContext *s) > return 0; > } > > + if (av_dict_count(s->metadata)) { > + /* XXX: Is there a better way to parse this out? IDv3 parsing is done > + * all the way out in avformat_open_input. */ > + has_idv3 = 1; > + } > + > + if (has_idv3) { > + av_log(s, AV_LOG_WARNING, "FLAC does not support IDv3 tags.\n"); > + }
You could check for s->error_recognition & AV_EF_COMPLIANT and abort if true instead of just warning. And the message could be more verbose, mentioning the file does not follow the spec and such. > + > /* process metadata blocks */ > while (!avio_feof(s->pb) && !metadata_last) { > avio_read(s->pb, header, 4); > @@ -141,6 +152,12 @@ static int flac_read_header(AVFormatContext *s) > if (metadata_type == FLAC_METADATA_TYPE_VORBIS_COMMENT) { > AVDictionaryEntry *chmask; > > + if (has_idv3) { > + av_log(s, AV_LOG_WARNING, "FLAC found with IDv3 and OGG > tags; ignoring IDv3 tags.\n"); AV_LOG_VERBOSE is probably better here. > + > + av_dict_free(&s->metadata); > + } > + > ret = ff_vorbis_comment(s, &s->metadata, buffer, > metadata_size, 1); > if (ret < 0) { > av_log(s, AV_LOG_WARNING, "error parsing VorbisComment > metadata\n"); > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel