mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/bmp: Analyze BGRA files alpha channel to choose pixel format
BGRA BMPs commonly do contain an all transparent alpha channel Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
319898bba2
commit
aec340c533
@ -337,6 +337,20 @@ static int bmp_decode_frame(AVCodecContext *avctx,
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
}
|
||||
if (avctx->pix_fmt == AV_PIX_FMT_BGRA) {
|
||||
for (i = 0; i < avctx->height; i++) {
|
||||
int j;
|
||||
uint8_t *ptr = p->data[0] + p->linesize[0]*i + 3;
|
||||
for (j = 0; j < avctx->width; j++) {
|
||||
if (ptr[4*j])
|
||||
break;
|
||||
}
|
||||
if (j < avctx->width)
|
||||
break;
|
||||
}
|
||||
if (i == avctx->height)
|
||||
avctx->pix_fmt = p->format = AV_PIX_FMT_BGR0;
|
||||
}
|
||||
|
||||
*got_frame = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user