[FFmpeg-devel] [PATCH] frmdec: tag 5 is AV_PIX_FMT_BGRA with reversed alpha (0=solid/opaque..255=transparent)
Peter Ross
pross at xvid.org
Mon Jan 7 12:12:20 CET 2013
---
Paul suggested performing the alpha channel fixup in the demuxer,
and I tend to agree.
libavformat/frmdec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/frmdec.c b/libavformat/frmdec.c
index 914bab5..9c29842 100644
--- a/libavformat/frmdec.c
+++ b/libavformat/frmdec.c
@@ -33,7 +33,7 @@ static const AVCodecTag frm_pix_fmt_tags[] = {
{ AV_PIX_FMT_RGB0, 2 },
{ AV_PIX_FMT_RGB24, 3 },
{ AV_PIX_FMT_BGR0, 4 },
- { AV_PIX_FMT_BGR0, 5 },
+ { AV_PIX_FMT_BGRA, 5 },
{ AV_PIX_FMT_NONE, 0 },
};
@@ -88,6 +88,12 @@ static int frm_read_packet(AVFormatContext *avctx, AVPacket *pkt)
if (ret < 0)
return ret;
+ if (stc->pix_fmt == AV_PIX_FMT_BGRA) {
+ int i;
+ for (i = 3; i + 1 <= pkt->size; i += 4)
+ pkt->data[i] = 0xFF - pkt->data[i];
+ }
+
pkt->stream_index = 0;
s->count++;
--
1.8.0
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130107/27890e53/attachment.asc>
More information about the ffmpeg-devel
mailing list