[FFmpeg-devel] [PATCH 03/18 v2] avformat/id3v2: allow ID3 parsing without AVFormatContext
Michael Niedermayer
michaelni at gmx.at
Tue Dec 31 03:37:43 CET 2013
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
[...]
> @@ -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
patch LGTM except these
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The educated differ from the uneducated as much as the living from the
dead. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131231/1332987b/attachment.asc>
More information about the ffmpeg-devel
mailing list