diff options
author | Peter Ross <pross@xvid.org> | 2013-12-23 20:37:00 +1100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-12-24 07:39:15 +0100 |
commit | c3f9628407933fc42defc42455a3e8a5934d348e (patch) | |
tree | 750d8b27f1c21768a913a0481481112aabafde2a | |
parent | 7eec11463fca6bad344f194acdcebf9e6743cf6d (diff) | |
download | ffmpeg-c3f9628407933fc42defc42455a3e8a5934d348e.tar.gz |
riffenc: add option to ff_put_bmp_header to ignore extradata
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fcbb94712d9873a37cdc8b526e368154b5982186)
-rw-r--r-- | libavformat/asfenc.c | 2 | ||||
-rw-r--r-- | libavformat/avienc.c | 2 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 2 | ||||
-rw-r--r-- | libavformat/riff.h | 2 | ||||
-rw-r--r-- | libavformat/riffenc.c | 6 |
5 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index b4a3ffb7ef..8e343b3fe0 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -525,7 +525,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, avio_wl16(pb, 40 + enc->extradata_size); /* size */ /* BITMAPINFOHEADER header */ - ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1); + ff_put_bmp_header(pb, enc, ff_codec_bmp_tags, 1, 0); } end_header(pb, hpos); } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 3401cbc237..bd6cd02faf 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -291,7 +291,7 @@ static int avi_write_header(AVFormatContext *s) // are not (yet) supported. if (stream->codec_id != AV_CODEC_ID_XSUB) break; case AVMEDIA_TYPE_VIDEO: - ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0); + ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0, 0); break; case AVMEDIA_TYPE_AUDIO: if ((ret = ff_put_wav_header(pb, stream)) < 0) { diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index b9848b66a5..671e01ee61 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -544,7 +544,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo ret = AVERROR(EINVAL); } - ff_put_bmp_header(dyn_cp, codec, ff_codec_bmp_tags, 0); + ff_put_bmp_header(dyn_cp, codec, ff_codec_bmp_tags, 0, 0); } } else if (codec->codec_type == AVMEDIA_TYPE_AUDIO) { diff --git a/libavformat/riff.h b/libavformat/riff.h index 1bf437e06c..ce078698c2 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -45,7 +45,7 @@ void ff_end_tag(AVIOContext *pb, int64_t start); */ int ff_get_bmp_header(AVIOContext *pb, AVStream *st, unsigned *esize); -void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); +void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf, int ignore_extradata); int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc); enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps); int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size); diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index bcfe018f74..d7cf846413 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -201,10 +201,10 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) /* BITMAPINFOHEADER header */ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, - const AVCodecTag *tags, int for_asf) + const AVCodecTag *tags, int for_asf, int ignore_extradata) { /* size */ - avio_wl32(pb, 40 + enc->extradata_size); + avio_wl32(pb, 40 + (ignore_extradata ? 0 : enc->extradata_size)); avio_wl32(pb, enc->width); //We always store RGB TopDown avio_wl32(pb, enc->codec_tag ? enc->height : -enc->height); @@ -220,10 +220,12 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, avio_wl32(pb, 0); avio_wl32(pb, 0); + if (!ignore_extradata) { avio_write(pb, enc->extradata, enc->extradata_size); if (!for_asf && enc->extradata_size & 1) avio_w8(pb, 0); + } } void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, |