summaryrefslogtreecommitdiff
path: root/libavformat/avienc.c
diff options
context:
space:
mode:
authorGyan Doshi <ffmpeg@gyani.pro>2020-07-08 17:32:25 +0530
committerGyan Doshi <ffmpeg@gyani.pro>2020-07-15 20:52:01 +0530
commit1ec2b3de5a074ccce555e33d7f282bbbb6d963d7 (patch)
treee309c38bf1b3757584ad58e228aa50efb6d8d320 /libavformat/avienc.c
parenta54b367c781f7735c321e6ac08a5deebeb9796a9 (diff)
downloadffmpeg-1ec2b3de5a074ccce555e33d7f282bbbb6d963d7.tar.gz
avformat/riffenc: indicate storage of flipped RGB bitmaps
Some legacy applications such as AVI2MVE expect raw RGB bitmaps to be stored bottom-up, whereas our RIFF BITMAPINFOHEADER assumes they are always stored top-down and thus write a negative value for height. This can prevent reading of these files. Option flipped_raw_rgb added to AVI and Matroska muxers which will write positive value for height when enabled. Note that the user has to flip the bitmaps beforehand using other means such as the vflip filter.
Diffstat (limited to 'libavformat/avienc.c')
-rw-r--r--libavformat/avienc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 297d5b8964..1b2cb529b9 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -72,6 +72,7 @@ typedef struct AVIContext {
int reserve_index_space;
int master_index_max_size;
int write_channel_mask;
+ int flipped_raw_rgb;
} AVIContext;
typedef struct AVIStream {
@@ -449,7 +450,7 @@ static int avi_write_header(AVFormatContext *s)
&& par->bits_per_coded_sample == 15)
par->bits_per_coded_sample = 16;
avist->pal_offset = avio_tell(pb) + 40;
- ff_put_bmp_header(pb, par, 0, 0);
+ ff_put_bmp_header(pb, par, 0, 0, avi->flipped_raw_rgb);
pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi,
par->bits_per_coded_sample);
if ( !par->codec_tag
@@ -993,6 +994,7 @@ static void avi_deinit(AVFormatContext *s)
static const AVOption options[] = {
{ "reserve_index_space", "reserve space (in bytes) at the beginning of the file for each stream index", OFFSET(reserve_index_space), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, ENC },
{ "write_channel_mask", "write channel mask into wave format header", OFFSET(write_channel_mask), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, ENC },
+ { "flipped_raw_rgb", "Raw RGB bitmaps are stored bottom-up", OFFSET(flipped_raw_rgb), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, ENC },
{ NULL },
};