summaryrefslogtreecommitdiff
path: root/libavcodec/flicvideo.c
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2007-09-04 17:31:25 +0000
committerMike Melanson <mike@multimedia.cx>2007-09-04 17:31:25 +0000
commitf55f27ba987749c3d99b10874ed62c0360d74556 (patch)
treef5218eb9f4d3790be2f6bc285b58c5e8202608ac /libavcodec/flicvideo.c
parent5d3de5ad2241dff4f9fe2f5a3c7f3e6684aa4077 (diff)
Fix issue 123 (Support Magic-carpet fli version,
https://roundup.mplayerhq.hu/roundup/ffmpeg/issue123 ) by rearranging the bit depth Originally committed as revision 10290 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flicvideo.c')
-rw-r--r--libavcodec/flicvideo.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index e57688fe41..6d65f6583e 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -85,18 +85,21 @@ static int flic_decode_init(AVCodecContext *avctx)
s->avctx = avctx;
s->fli_type = AV_RL16(&fli_header[4]); /* Might be overridden if a Magic Carpet FLC */
- depth = AV_RL16(&fli_header[12]);
-
- if (depth == 0) {
- depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */
- }
+ depth = 0;
if (s->avctx->extradata_size == 12) {
/* special case for magic carpet FLIs */
s->fli_type = FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE;
+ depth = 8;
} else if (s->avctx->extradata_size != 128) {
av_log(avctx, AV_LOG_ERROR, "Expected extradata of 12 or 128 bytes\n");
return -1;
+ } else {
+ depth = AV_RL16(&fli_header[12]);
+ }
+
+ if (depth == 0) {
+ depth = 8; /* Some FLC generators set depth to zero, when they mean 8Bpp. Fix up here */
}
if ((s->fli_type == FLC_FLX_TYPE_CODE) && (depth == 16)) {