diff options
author | Peter Ross <pross@xvid.org> | 2014-03-30 05:43:50 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-30 08:22:54 +0400 |
commit | 31ac3f306c45ed6bbc90ced2f17f06d9d809be50 (patch) | |
tree | 82bd3c53e94f0d8a7a0ac230e6395eda39b14a60 /libavformat/wtvenc.c | |
parent | 73a2d16bfab550325f6626c9843c2e019ef7331b (diff) |
avformat/wtvenc: pad judiciously when writing mpeg2 extradata
Padding rule described here http://msdn.microsoft.com/en-us/library/windows/desktop/dd390707(v=vs.85).aspx
Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wtvenc.c')
-rw-r--r-- | libavformat/wtvenc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c index b82ff0b7a2..a1286ae494 100644 --- a/libavformat/wtvenc.c +++ b/libavformat/wtvenc.c @@ -243,14 +243,15 @@ static void put_videoinfoheader2(AVIOContext *pb, AVStream *st) ff_put_bmp_header(pb, st->codec, ff_codec_bmp_tags, 0, 1); if (st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO) { + int padding = (st->codec->extradata_size & 3) ? 4 - (st->codec->extradata_size & 3) : 0; /* MPEG2VIDEOINFO */ avio_wl32(pb, 0); - avio_wl32(pb, st->codec->extradata_size); + avio_wl32(pb, st->codec->extradata_size + padding); avio_wl32(pb, -1); avio_wl32(pb, -1); avio_wl32(pb, 0); avio_write(pb, st->codec->extradata, st->codec->extradata_size); - avio_wl64(pb, 0); + ffio_fill(pb, 0, padding); } } |