diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-02-25 09:53:35 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-02-29 14:16:32 +0100 |
commit | 079ea6ca5f8f108ec328d3c2c1792e676fc30b9c (patch) | |
tree | 15d38cabd66e3c5219fd66badb9410447c049683 /libavformat/utils.c | |
parent | dd2a4bcfd72eee85710142943a1c68ac02520771 (diff) | |
download | ffmpeg-079ea6ca5f8f108ec328d3c2c1792e676fc30b9c.tar.gz |
lavf: export id3v2 attached pictures as streams.
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index c8dd7f5868..e657362a38 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -520,6 +520,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma AVFormatContext *s = *ps; int i, ret = 0; AVDictionary *tmp = NULL; + ID3v2ExtraMeta *id3v2_extra_meta = NULL; if (!s && !(s = avformat_alloc_context())) return AVERROR(ENOMEM); @@ -562,12 +563,17 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma /* e.g. AVFMT_NOFILE formats will not have a AVIOContext */ if (s->pb) - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC); + ff_id3v2_read_all(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); if (s->iformat->read_header) if ((ret = s->iformat->read_header(s)) < 0) goto fail; + if (id3v2_extra_meta && + (ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) + goto fail; + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + /* queue attached pictures */ for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC) { @@ -589,6 +595,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputForma return 0; fail: + ff_id3v2_free_extra_meta(&id3v2_extra_meta); av_dict_free(&tmp); if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO)) avio_close(s->pb); |