[MPlayer-dev-eng] 0.90-rc4 tomorrow? patches?

Joey Parrish joey at nicewarrior.org
Sat Feb 8 00:23:04 CET 2003


On Fri, Feb 07, 2003 at 05:19:45PM -0600, Joey Parrish wrote:
> On Fri, Feb 07, 2003 at 10:29:29PM +0100, Arpi wrote:
> > any patches i lost?
> 
> Not lost, but a new one.  This patch is for demux_gif and fixes a couple
> of small issues.

Damn!  Do I have to drink cola for mail mistakes?  :)
Attached to _this one_ is the patch.

> 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.  see notes below.
> 3) cosmetic clean-up because i no longer plan to support certain GIF
>    extensions that would be more difficult to implement.
> 
> Notes on #2:
> Streaming GIFs did not work because mplayer makes good use of a cache
> and libgif family try to read from fd directly.  The workaround for this
> is that I had an lseek line in demux_gif to seek the file back.  Now I
> realize the source of the trouble, so I dug through libgif source and
> found an undocumented function to allow you to specify your own read
> function for libgif to use.  Now, the lseek hack is gone.  The other
> advantage is that now libgif uses mplayer's stream_read function and
> thus http streaming, etc, works with demux_gif.
> 
> Thanks,
> --Joey
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng
> 
-------------- next part --------------
--- libmpdemux/demux_gif.c	Fri Feb  7 16:47:46 2003
+++ libmpdemux/demux_gif.c	Fri Feb  7 16:47:19 2003
@@ -24,6 +24,10 @@
 
 #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);
@@ -82,9 +86,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 +128,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;
@@ -158,9 +158,8 @@
   // go back to the beginning
   stream_reset(demuxer->stream);
   stream_seek(demuxer->stream, 0);
-  lseek(demuxer->stream->fd, 0, SEEK_SET);
 
-  gif = DGifOpenFileHandle(demuxer->stream->fd);
+  gif = DGifOpen(demuxer->stream, my_read_gif);
   if (!gif) {
     PrintGifError();
     return NULL;


More information about the MPlayer-dev-eng mailing list