changeset 2926:a6730b458d6c libavformat

Matroska muxer needs to format all NAL units, not only extradata.
author aurel
date Fri, 11 Jan 2008 23:21:22 +0000
parents 3e44e9eb92ec
children b75a49790f31
files matroskaenc.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/matroskaenc.c	Fri Jan 11 12:24:46 2008 +0000
+++ b/matroskaenc.c	Fri Jan 11 23:21:22 2008 +0000
@@ -745,6 +745,16 @@
         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 {