summaryrefslogtreecommitdiffstats
path: root/fli.c
diff options
context:
space:
mode:
authormelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-28 03:01:53 +0000
committermelanson <melanson@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-28 03:01:53 +0000
commit783c4f43e4a8024b2bb00714907fad7d67f47879 (patch)
treed2a232c99c4fa84afb24dbb63c442b42ca0617da /fli.c
parente0acf7f92c95e1c36de53a5da31391c427f40a8b (diff)
downloadmpv-783c4f43e4a8024b2bb00714907fad7d67f47879.tar.bz2
mpv-783c4f43e4a8024b2bb00714907fad7d67f47879.tar.xz
fixed another color chunk issue
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4888 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'fli.c')
-rw-r--r--fli.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fli.c b/fli.c
index 63ff87ac56..b8e906bc36 100644
--- a/fli.c
+++ b/fli.c
@@ -52,6 +52,7 @@ void decode_fli_frame(
void *context)
{
int stream_ptr = 0;
+ int stream_ptr_after_color_chunk;
int pixel_ptr;
int palette_ptr1;
int palette_ptr2;
@@ -82,7 +83,7 @@ void decode_fli_frame(
unsigned char *fli_ghost_image = (unsigned char *)context;
int ghost_pixel_ptr;
int ghost_y_ptr;
-
+
frame_size = LE_32(&encoded[stream_ptr]);
stream_ptr += 6; // skip the magic number
num_chunks = LE_16(&encoded[stream_ptr]);
@@ -101,6 +102,7 @@ void decode_fli_frame(
{
case FLI_256_COLOR:
case FLI_COLOR:
+ stream_ptr_after_color_chunk = stream_ptr + chunk_size - 6;
if (chunk_type == FLI_COLOR)
color_scale = 4;
else
@@ -130,10 +132,13 @@ void decode_fli_frame(
stream_ptr += 3;
}
}
- // it seems that a color packet has to be an even number of bytes
- // so account for a pad byte
- if (stream_ptr & 0x01)
- stream_ptr++;
+
+ // color chunks sometimes have weird 16-bit alignment issues;
+ // therefore, take the hardline approach and set the stream_ptr
+ // to the value calculate w.r.t. the size specified by the color
+ // chunk header
+ stream_ptr = stream_ptr_after_color_chunk;
+
/* Palette has changed, must update frame */
update_whole_frame = 1;
break;