aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2008-01-11 23:21:22 +0000
committerAurelien Jacobs <aurel@gnuage.org>2008-01-11 23:21:22 +0000
commite609806ec6a79325773d8905d1d04b5442d8b5ed (patch)
treeeeb807bf2db7dfccd1c0709507086004634920c0
parent9f7458b285ae85547faeafd00b23cdbd378daef3 (diff)
downloadffmpeg-e609806ec6a79325773d8905d1d04b5442d8b5ed.tar.gz
Matroska muxer needs to format all NAL units, not only extradata.
Originally committed as revision 11510 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/matroskaenc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 09f975af42..7051d658cc 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -745,6 +745,16 @@ static int mkv_write_packet(AVFormatContext *s, AVPacket *pkt)
av_md5_update(mkv->md5_ctx, pkt->data, FFMIN(200, pkt->size));
}
+ if (codec->codec_id == CODEC_ID_H264 &&
+ codec->extradata_size > 0 && AV_RB32(codec->extradata) == 0x00000001) {
+ /* from x264 or from bytestream h264 */
+ /* nal reformating needed */
+ int ret = avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size);
+ if (ret < 0)
+ return ret;
+ assert(pkt->size);
+ }
+
if (codec->codec_type != CODEC_TYPE_SUBTITLE) {
mkv_write_block(s, MATROSKA_ID_SIMPLEBLOCK, pkt, keyframe << 7);
} else {