diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-09-20 19:31:24 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-09-20 19:43:38 +0200 |
commit | b8044972c4f23e2d2fdf2c5a8ba67019a5045149 (patch) | |
tree | efef28d683123a9609eb2aba36be6ad4c197da0b /libavformat/matroskadec.c | |
parent | 0da50055ebafb7852e80825abd0b8e5e72bd8b60 (diff) | |
parent | 117d8c6d1f1c187ffc6098d9618457e00534e013 (diff) | |
download | ffmpeg-b8044972c4f23e2d2fdf2c5a8ba67019a5045149.tar.gz |
Merge commit '117d8c6d1f1c187ffc6098d9618457e00534e013'
* commit '117d8c6d1f1c187ffc6098d9618457e00534e013':
matroska: implement support for ProRes
matroska: implement support for ALAC
Conflicts:
libavformat/matroskaenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 5dd8dd52fc..bc0f72863b 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -37,6 +37,7 @@ #include "isom.h" #include "rm.h" #include "matroska.h" +#include "libavcodec/bytestream.h" #include "libavcodec/mpeg4audio.h" #include "libavutil/intfloat.h" #include "libavutil/intreadwrite.h" @@ -1615,7 +1616,7 @@ static int matroska_read_header(AVFormatContext *s) Create the "atom size", "tag", and "tag version" fields the decoder expects manually. */ extradata_size = 12 + track->codec_priv.size; - extradata = av_mallocz(extradata_size); + extradata = av_mallocz(extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (extradata == NULL) return AVERROR(ENOMEM); AV_WB32(extradata, extradata_size); @@ -2117,6 +2118,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, MatroskaTrackEncoding *encodings = track->encodings.elem; uint32_t pkt_size = lace_size[n]; uint8_t *pkt_data = data; + int offset = 0; if (encodings && encodings->scope & 1) { res = matroska_decode_buffer(&pkt_data, &pkt_size, track); @@ -2124,15 +2126,24 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, break; } + if (st->codec->codec_id == AV_CODEC_ID_PRORES) + offset = 8; + pkt = av_mallocz(sizeof(AVPacket)); /* XXX: prevent data copy... */ - if (av_new_packet(pkt, pkt_size) < 0) { + if (av_new_packet(pkt, pkt_size + offset) < 0) { av_free(pkt); res = AVERROR(ENOMEM); break; } - memcpy(pkt->data, pkt_data, pkt_size); + if (st->codec->codec_id == AV_CODEC_ID_PRORES) { + uint8_t *buf = pkt->data; + bytestream_put_be32(&buf, pkt_size); + bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f')); + } + + memcpy(pkt->data + offset, pkt_data, pkt_size); if (pkt_data != data) av_free(pkt_data); |