diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2012-09-15 00:59:05 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2012-09-19 20:34:14 +0200 |
commit | 117d8c6d1f1c187ffc6098d9618457e00534e013 (patch) | |
tree | b3f68828285cefdfd27f45a198d50a99c10e9f12 /libavformat/matroskaenc.c | |
parent | 8071dca3d595a4fc5f9b3ee9f667e2c3e4a35517 (diff) | |
download | ffmpeg-117d8c6d1f1c187ffc6098d9618457e00534e013.tar.gz |
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/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 521f6b5c1a..3e32943153 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1050,7 +1050,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, MatroskaMuxContext *mkv = s->priv_data; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; uint8_t *data = NULL; - int size = pkt->size; + int offset = 0, size = pkt->size; int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " @@ -1061,12 +1061,20 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, ff_avc_parse_nal_units_buf(pkt->data, &data, &size); else data = pkt->data; + + if (codec->codec_id == AV_CODEC_ID_PRORES) { + /* Matroska specification requires to remove the first QuickTime atom + */ + size -= 8; + offset = 8; + } + put_ebml_id(pb, blockid); put_ebml_num(pb, size+4, 0); avio_w8(pb, 0x80 | (pkt->stream_index + 1)); // this assumes stream_index is less than 126 avio_wb16(pb, ts - mkv->cluster_pts); avio_w8(pb, flags); - avio_write(pb, data, size); + avio_write(pb, data + offset, size); if (data != pkt->data) av_free(data); } |