[Mplayer-cvslog] CVS: main fli.c,1.9,1.10

Mike Melanson melanson at mplayer.dev.hu
Thu Feb 28 04:01:56 CET 2002


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv12617

Modified Files:
	fli.c 
Log Message:
fixed another color chunk issue


Index: fli.c
===================================================================
RCS file: /cvsroot/mplayer/main/fli.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- fli.c	16 Feb 2002 01:30:11 -0000	1.9
+++ fli.c	28 Feb 2002 03:01:53 -0000	1.10
@@ -52,6 +52,7 @@
   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 @@
   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 @@
     {
     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 @@
           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;




More information about the MPlayer-cvslog mailing list