[Mplayer-cvslog] CVS: main/libmpdemux demux_gif.c,1.1,1.2

Arpi of Ize arpi at mplayerhq.hu
Sat Feb 8 16:49:26 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv19464

Modified Files:
	demux_gif.c 
Log Message:
1) codecs.conf changed recently and demux_gif no longer needs to spit
   out BGR8 upside-down.  the workaround for this is removed.
2) fixes a bug so that streaming gifs now works, and removes a
   workaround no longer needed. now libgif uses mplayer's stream_read
   function and thus http streaming, etc, works with demux_gif.
3) cosmetic clean-up because i no longer plan to support certain GIF
   extensions that would be more difficult to implement.
patch by Joey Parrish <joey at nicewarrior.org>


Index: demux_gif.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_gif.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- demux_gif.c	28 Jan 2003 01:02:07 -0000	1.1
+++ demux_gif.c	8 Feb 2003 15:49:03 -0000	1.2
@@ -24,10 +24,12 @@
 
 #define GIF_SIGNATURE (('G' << 16) | ('I' << 8) | 'F')
 
+int my_read_gif(GifFileType *gif, uint8_t *buf, int len) {
+  return stream_read(gif->UserData, buf, len);
+}
+  
 int gif_check_file(demuxer_t *demuxer)
 {
-  stream_reset(demuxer->stream);
-  stream_seek(demuxer->stream, 0);
   if (stream_read_int24(demuxer->stream) == GIF_SIGNATURE)
     return 1;
   return 0;
@@ -82,9 +84,6 @@
           }
 	}
 	printf("\n");
-      // FIXME  support these:
-      } else if (code == 0x01) { // plaintext extension
-      } else if (code == 0xFF) { // application extension
       }
       while (p != NULL) {
         if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
@@ -127,8 +126,7 @@
 
     for (y = 0; y < gif->Image.Height; y++) {
       unsigned char *drow = dp->buffer;
-      int x = gif->Image.Height - y - 1; // BGR8 is flipped
-      unsigned char *gbuf = buf + (x * gif->Image.Width);
+      unsigned char *gbuf = buf + (y * gif->Image.Width);
 
       drow += gif->Image.Width * (y + gif->Image.Top);
       drow += gif->Image.Left;
@@ -156,11 +154,9 @@
   demuxer->seekable = 0; // FIXME
 
   // go back to the beginning
-  stream_reset(demuxer->stream);
-  stream_seek(demuxer->stream, 0);
-  lseek(demuxer->stream->fd, 0, SEEK_SET);
+  stream_seek(stream,stream->start_pos);
 
-  gif = DGifOpenFileHandle(demuxer->stream->fd);
+  gif = DGifOpen(demuxer->stream, my_read_gif);
   if (!gif) {
     PrintGifError();
     return NULL;



More information about the MPlayer-cvslog mailing list