diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-03-08 17:28:42 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-03-08 19:12:03 +0100 |
commit | 2653e125204569b1e9439ee2671c6ebb23a94b80 (patch) | |
tree | 4176f76bccc8cdd1c85b9d329a82867eda37d397 /libavformat/id3v2.c | |
parent | 532f31a695c9530ce67a847be00d72e6e8acfd11 (diff) | |
parent | 1afddbe59e96af75f1c07605afc95615569f388f (diff) | |
download | ffmpeg-2653e125204569b1e9439ee2671c6ebb23a94b80.tar.gz |
Merge commit '1afddbe59e96af75f1c07605afc95615569f388f'
* commit '1afddbe59e96af75f1c07605afc95615569f388f':
avpacket: use AVBuffer to allow refcounting the packets.
Conflicts:
libavcodec/avpacket.c
libavcodec/utils.c
libavdevice/v4l2.c
libavformat/avidec.c
libavformat/flacdec.c
libavformat/id3v2.c
libavformat/matroskaenc.c
libavformat/mux.c
libavformat/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/id3v2.c')
-rw-r--r-- | libavformat/id3v2.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index 2cab5ac304..3e347d1e77 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -433,7 +433,7 @@ finish: static void free_apic(void *obj) { ID3v2ExtraMetaAPIC *apic = obj; - av_freep(&apic->data); + av_buffer_unref(&apic->buf); av_freep(&apic->description); av_freep(&apic); } @@ -489,9 +489,8 @@ static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen, char *tag goto fail; } - apic->len = taglen; - apic->data = av_malloc(taglen); - if (!apic->data || !apic->len || avio_read(pb, apic->data, taglen) != taglen) + apic->buf = av_buffer_alloc(taglen); + if (!apic->buf || !taglen || avio_read(pb, apic->buf->data, taglen) != taglen) goto fail; new_extra->tag = "APIC"; @@ -846,14 +845,13 @@ int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta) av_dict_set(&st->metadata, "comment", apic->type, 0); av_init_packet(&st->attached_pic); - st->attached_pic.data = apic->data; - st->attached_pic.size = apic->len; - st->attached_pic.destruct = av_destruct_packet; + st->attached_pic.buf = apic->buf; + st->attached_pic.data = apic->buf->data; + st->attached_pic.size = apic->buf->size; st->attached_pic.stream_index = st->index; st->attached_pic.flags |= AV_PKT_FLAG_KEY; - apic->data = NULL; - apic->len = 0; + apic->buf = NULL; } return 0; |