[FFmpeg-devel] [PATCH 03/18 v2] avformat/id3v2: allow ID3 parsing without AVFormatContext
Anssi Hannula
anssi.hannula at iki.fi
Tue Dec 31 03:58:24 CET 2013
31.12.2013 04:37, Michael Niedermayer kirjoitti:
> On Tue, Dec 31, 2013 at 03:53:35AM +0200, Anssi Hannula wrote:
>> Add ff_id3v2_read_dict() for parsing without AVFormatContext, but
>> instead with AVIOContext and AVDictionary.
>>
>> AVFormatContext is still used for logging, if available.
>>
>> Chapter parsing is the only non-logging functionality that actually
>> needs AVFormatContext, and AFAICS it should be modified to write the
>> data to ID3v2ExtraMeta first, from where it can be implanted to
>> AVFormatContext by a separate function (like it is done with
>> read_apic() and ff_id3v2_parse_apic()). That is outside the scope of
>> this patch, though.
>>
>> Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>
>> ---
>>
>> Updated to keep possibly NULL AVFormatContext around for av_logs.
>>
>>
>> libavformat/id3v2.c | 101 ++++++++++++++++++++++++++++++----------------------
>> libavformat/id3v2.h | 16 ++++++++-
>> 2 files changed, 74 insertions(+), 43 deletions(-)
>>
>> diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
>> index 54c85d1..de9e0c4 100644
>> --- a/libavformat/id3v2.c
>> +++ b/libavformat/id3v2.c
>> @@ -532,6 +532,9 @@ static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, char *tta
>> int taglen;
>> char tag[5];
>>
>> + if (!s)
>> + return;
>
> maybe add a debug av_log() here saying that it was skiped
Will add. I'll also add a short comment here saying what I have in
commit message regarding it not using ID3v2ExtraMeta instead.
>
> [...]
>> @@ -861,14 +865,15 @@ error:
>> if (reason)
>> av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n",
>> version, reason);
>> - avio_seek(s->pb, end, SEEK_SET);
>> + avio_seek(pb, end, SEEK_SET);
>> av_free(buffer);
>> av_free(uncompressed_buffer);
>> return;
>> }
>>
>> -void ff_id3v2_read(AVFormatContext *s, const char *magic,
>> - ID3v2ExtraMeta **extra_meta)
>> +static void ff_id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata,
>> + AVFormatContext *s, const char *magic,
>> + ID3v2ExtraMeta **extra_meta)
>> {
>
> static functions dont need ff_ prefixes
Right, forgot to remove that.
> patch LGTM except these
OK, will apply after these.
--
Anssi Hannula
More information about the ffmpeg-devel
mailing list