diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2012-09-15 02:59:05 +0400 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2012-09-19 22:34:14 +0400 |
commit | 117d8c6d1f1c187ffc6098d9618457e00534e013 (patch) | |
tree | b3f68828285cefdfd27f45a198d50a99c10e9f12 /libavformat/matroskadec.c | |
parent | 8071dca3d595a4fc5f9b3ee9f667e2c3e4a35517 (diff) |
matroska: implement support for ProRes
Support Matroska native formatting.
On demuxing prepend a Frame container atom (32bit big endian encoded
frame size and 'icpf' string).
On muxing remove it.
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r-- | libavformat/matroskadec.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 69a8c7f06e..c00ebaac8e 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" @@ -1966,6 +1967,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); @@ -1973,15 +1975,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); |