diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-17 13:37:41 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-02-18 21:26:50 +0100 |
commit | 9dd4dcde9cdeba21b4bf40fc664c1277bbe27110 (patch) | |
tree | e9db094d53cc426c9341508cbe2c81cceedcb8cc /libavformat/avienc.c | |
parent | 8fdee3ee8fb50877c526b79f78a754b70bf7c426 (diff) | |
download | ffmpeg-9dd4dcde9cdeba21b4bf40fc664c1277bbe27110.tar.gz |
avformat/avienc: Use avi_write_packet_internal() to store raw rgb in a more spec compliant way
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r-- | libavformat/avienc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 2d3d51fcfb..09ec63beba 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -659,6 +659,20 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) if ((ret = write_skip_frames(s, stream_index, pkt->dts)) < 0) return ret; + if (enc->codec_id == AV_CODEC_ID_RAWVIDEO && enc->codec_tag == 0) { + int64_t bpc = enc->bits_per_coded_sample != 15 ? enc->bits_per_coded_sample : 16; + int expected_stride = ((enc->width * bpc + 31) >> 5)*4; + + ret = ff_reshuffle_raw_rgb(s, &pkt, enc, expected_stride); + if (ret < 0) + return ret; + if (ret) { + ret = avi_write_packet_internal(s, pkt); + av_packet_free(&pkt); + return ret; + } + } + return avi_write_packet_internal(s, pkt); } |