diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-09-02 16:42:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-21 04:40:03 +0100 |
commit | 857eaa45ba94579cd18fec2a6fd4a4d64b9865c3 (patch) | |
tree | 766625ab299be10d7bcb5cfb9dc6232410e48127 | |
parent | 8df5b0250d109a2995238c05128d6a770c03005c (diff) | |
download | ffmpeg-857eaa45ba94579cd18fec2a6fd4a4d64b9865c3.tar.gz |
avformat/swfdec: Do not change the pixel format
This is currently not supported
Fixes part of Ticket 3539
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c2430304dfb3cc0e3a59ce6d1b59ebdcc934a0c2)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/swfdec.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index ad587ea7d5..2e3731210f 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -282,6 +282,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) const int bmp_fmt = avio_r8(pb); const int width = avio_rl16(pb); const int height = avio_rl16(pb); + int pix_fmt; len -= 2+1+2+2; @@ -360,7 +361,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) switch (bmp_fmt) { case 3: - st->codec->pix_fmt = AV_PIX_FMT_PAL8; + pix_fmt = AV_PIX_FMT_PAL8; for (i = 0; i < colormapsize; i++) if (alpha_bmp) colormap[i] = buf[3]<<24 | AV_RB24(buf + 4*i); else colormap[i] = 0xffU <<24 | AV_RB24(buf + 3*i); @@ -372,14 +373,20 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) memcpy(pal, colormap, AVPALETTE_SIZE); break; case 4: - st->codec->pix_fmt = AV_PIX_FMT_RGB555; + pix_fmt = AV_PIX_FMT_RGB555; break; case 5: - st->codec->pix_fmt = alpha_bmp ? AV_PIX_FMT_ARGB : AV_PIX_FMT_0RGB; + pix_fmt = alpha_bmp ? AV_PIX_FMT_ARGB : AV_PIX_FMT_0RGB; break; default: av_assert0(0); } + if (st->codec->pix_fmt != AV_PIX_FMT_NONE && st->codec->pix_fmt != pix_fmt) { + av_log(s, AV_LOG_ERROR, "pixel format change unsupported\n"); + res = AVERROR_PATCHWELCOME; + goto bitmap_end; + } + st->codec->pix_fmt = pix_fmt; if (linesize * height > pkt->size) { res = AVERROR_INVALIDDATA; |