[MPlayer-dev-eng] [PATCH] GIF support, release quality?

Joey Parrish joey at nicewarrior.org
Mon Jan 27 21:15:09 CET 2003


Hello!

Attached below are GIF support patches in three parts.

The first patch is the bare minimum needed for GIF support.
It adds a libgif/libungif based demuxer to libmpdemux, and
changes the Makefile to put the GIF library in $(CODEC_LIBS)
rather than $(VO_LIBS).  Without this change to the Makefile,
mencoder would fail to link with GIF support.
Also in the first patch is a typo fix in codecs.conf to correct
the fourcc of raw formats.  This is needed for MPlayer to find
the right decoder.

The second patch contains all the DOCS updates to reflect the
GIF support in the first patch as well as GIF related cosmetic
changes for configure.

The third patch allows for the automatic loading of vop palette
when using raw paletted formats.  Currently (AFAIK, and I have
briefly RTFS) vf_palette is needed to handle raw paletted formats.

Without applying the third patch, you can view GIF animations
(or stills) so long as you type -vop palette manually.

Comments & criticism are welcome, and I don't mind if it's
delayed till after the release.

Thanks,
--Joey
-------------- next part --------------
diff -Nur main.cvs/Makefile main.dev/Makefile
--- main.cvs/Makefile	Wed Jan 22 10:33:54 2003
+++ main.dev/Makefile	Fri Jan 24 10:19:57 2003
@@ -33,9 +33,9 @@
 OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
 
-VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) $(GIF_LIB) 
+VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB)
 AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
-CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(XVID_LIB) $(DECORE_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB)
+CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(XVID_LIB) $(DECORE_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(GIF_LIB) 
 COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a $(PP_LIB) postproc/libswscale.a linux/libosdep.a $(CSS_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(STREAMING_LIB) $(WIN32_LIB)
 
 CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader -Ilibvo $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) # -Wall
diff -Nur main.cvs/libmpdemux/Makefile main.dev/libmpdemux/Makefile
--- main.cvs/libmpdemux/Makefile	Thu Jan 23 10:37:51 2003
+++ main.dev/libmpdemux/Makefile	Fri Jan 24 10:19:57 2003
@@ -3,7 +3,7 @@
 
 include ../config.mak
 
-SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c
+SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c muxer.c muxer_avi.c muxer_mpeg.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c demux_rawvideo.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c cue_read.c extension.c demux_gif.c
 ifeq ($(XMMS_PLUGINS),yes)
 SRCS += demux_xmms.c
 endif 
diff -Nur main.cvs/libmpdemux/demux_gif.c main.dev/libmpdemux/demux_gif.c
--- main.cvs/libmpdemux/demux_gif.c	Wed Dec 31 18:00:00 1969
+++ main.dev/libmpdemux/demux_gif.c	Fri Jan 24 10:19:57 2003
@@ -0,0 +1,212 @@
+/*
+	GIF file parser for MPlayer
+	by Joey Parrish
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "config.h"
+#include "mp_msg.h"
+#include "help_mp.h"
+
+#include "stream.h"
+#include "demuxer.h"
+#include "stheader.h"
+
+#ifdef HAVE_GIF
+
+#include <gif_lib.h>
+static int current_pts = 0;
+static unsigned char *pallete = NULL;
+
+#define GIF_SIGNATURE (('G' << 16) | ('I' << 8) | 'F')
+
+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;
+}
+
+int demux_gif_fill_buffer(demuxer_t *demuxer)
+{
+  GifFileType *gif = (GifFileType *)demuxer->priv;
+  sh_video_t *sh_video = (sh_video_t *)demuxer->video->sh;
+  GifRecordType type = UNDEFINED_RECORD_TYPE;
+  int len = 0;
+  demux_packet_t *dp = NULL;
+  ColorMapObject *effective_map = NULL;
+  char *buf = NULL;
+
+  while (type != IMAGE_DESC_RECORD_TYPE) {
+    if (DGifGetRecordType(gif, &type) == GIF_ERROR) {
+      PrintGifError();
+      return 0; // oops
+    }
+    if (type == TERMINATE_RECORD_TYPE)
+      return 0; // eof
+    if (type == SCREEN_DESC_RECORD_TYPE) {
+      if (DGifGetScreenDesc(gif) == GIF_ERROR) {
+        PrintGifError();
+        return 0; // oops
+      }
+    }
+    if (type == EXTENSION_RECORD_TYPE) {
+      int code;
+      unsigned char *p = NULL;
+      if (DGifGetExtension(gif, &code, &p) == GIF_ERROR) {
+        PrintGifError();
+        return 0; // oops
+      }
+      if (code == 0xF9) {
+        int frametime = 0;
+        if (p[0] == 4) // is the length correct?
+          frametime = (p[1] << 8) | p[2]; // set the time, centiseconds
+        current_pts += frametime;
+      } else if ((code == 0xFE) && (verbose)) { // comment extension
+	// print iff verbose
+	printf("GIF comment: ");
+        while (p != NULL) {
+          int length = p[0];
+	  char *comments = p + 1;
+	  comments[length] = 0;
+	  printf("%s", comments);
+          if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
+            PrintGifError();
+            return 0; // oops
+          }
+	}
+	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) {
+          PrintGifError();
+          return 0; // oops
+        }
+      }
+    }
+  }
+  
+  if (DGifGetImageDesc(gif) == GIF_ERROR) {
+    PrintGifError();
+    return 0; // oops
+  }
+
+  len = gif->Image.Width * gif->Image.Height;
+  dp = new_demux_packet(len);
+  buf = malloc(len);
+  memset(buf, 0, len);
+  memset(dp->buffer, 0, len);
+  
+  if (DGifGetLine(gif, buf, len) == GIF_ERROR) {
+    PrintGifError();
+    return 0; // oops
+  }
+
+  effective_map = gif->Image.ColorMap;
+  if (effective_map == NULL) effective_map = gif->SColorMap;
+
+  {
+    int y;
+
+    // copy the pallete
+    for (y = 0; y < 256; y++) {
+	pallete[(y * 4) + 0] = effective_map->Colors[y].Blue;
+	pallete[(y * 4) + 1] = effective_map->Colors[y].Green;
+	pallete[(y * 4) + 2] = effective_map->Colors[y].Red;
+	pallete[(y * 4) + 3] = 0;
+    }
+
+    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);
+
+      drow += gif->Image.Width * (y + gif->Image.Top);
+      drow += gif->Image.Left;
+
+      memcpy(drow, gbuf, gif->Image.Width);
+    }
+  }
+
+  free(buf);
+
+  demuxer->video->dpos++;
+  dp->pts = ((float)current_pts) / 100;
+  dp->pos = stream_tell(demuxer->stream);
+  ds_add_packet(demuxer->video, dp);
+
+  return 1;
+}
+
+demuxer_t* demux_open_gif(demuxer_t* demuxer)
+{
+  sh_video_t *sh_video = NULL;
+  GifFileType *gif = NULL;
+
+  current_pts = 0;
+  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);
+
+  gif = DGifOpenFileHandle(demuxer->stream->fd);
+  if (!gif) {
+    PrintGifError();
+    return NULL;
+  }
+
+  // create a new video stream header
+  sh_video = new_sh_video(demuxer, 0);
+
+  // make sure the demuxer knows about the new video stream header
+  // (even though new_sh_video() ought to take care of it)
+  demuxer->video->sh = sh_video;
+
+  // make sure that the video demuxer stream header knows about its
+  // parent video demuxer stream (this is getting wacky), or else
+  // video_read_properties() will choke
+  sh_video->ds = demuxer->video;
+
+  sh_video->disp_w = gif->SWidth;
+  sh_video->disp_h = gif->SHeight;
+
+  sh_video->format = mmioFOURCC(8, 'R', 'G', 'B');
+  
+  sh_video->fps = 5.0f;
+  sh_video->frametime = 1.0f / sh_video->fps;
+  
+  sh_video->bih = malloc(sizeof(BITMAPINFOHEADER) + (256 * 4));
+  sh_video->bih->biCompression = sh_video->format;
+  sh_video->bih->biBitCount = 8;
+  sh_video->bih->biPlanes = 2;
+  pallete = (unsigned char *)(sh_video->bih + 1);
+  
+  demuxer->priv = gif;
+
+  return demuxer;
+}
+
+void demux_close_gif(demuxer_t* demuxer)
+{
+  GifFileType *gif = (GifFileType *)demuxer->priv;
+
+  if(!gif)
+    return;
+
+  if (DGifCloseFile(gif) == GIF_ERROR)
+    PrintGifError();
+  
+  demuxer->stream->fd = 0;
+  demuxer->priv = NULL;
+}
+#endif /* HAVE_GIF */
diff -Nur main.cvs/libmpdemux/demuxer.c main.dev/libmpdemux/demuxer.c
--- main.cvs/libmpdemux/demuxer.c	Thu Jan 23 10:37:51 2003
+++ main.dev/libmpdemux/demuxer.c	Fri Jan 24 10:19:57 2003
@@ -133,6 +133,7 @@
 extern void demux_close_pva(demuxer_t* demuxer);
 extern void demux_close_smjpeg(demuxer_t* demuxer);
 extern void demux_close_xmms(demuxer_t* demuxer);
+extern void demux_close_gif(demuxer_t* demuxer);
 
 #ifdef USE_TV
 #include "tv.h"
@@ -199,6 +200,10 @@
     case DEMUXER_TYPE_XMMS:
       demux_close_xmms(demuxer); break;
 #endif
+#ifdef HAVE_GIF
+    case DEMUXER_TYPE_GIF:
+      demux_close_gif(demuxer); break;
+#endif
 
     }
     // free streams:
@@ -276,6 +281,7 @@
 int demux_audio_fill_buffer(demux_stream_t *ds);
 int demux_pva_fill_buffer(demuxer_t *demux);
 int demux_xmms_fill_buffer(demuxer_t *demux,demux_stream_t *ds);
+int demux_gif_fill_buffer(demuxer_t *demux);
 
 extern int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds);
 extern int demux_ogg_fill_buffer(demuxer_t *d);
@@ -325,6 +331,9 @@
     case DEMUXER_TYPE_RTP: return demux_rtp_fill_buffer(demux, ds);
 #endif
     case DEMUXER_TYPE_SMJPEG: return demux_smjpeg_fill_buffer(demux);
+#ifdef HAVE_GIF
+    case DEMUXER_TYPE_GIF: return demux_gif_fill_buffer(demux);
+#endif
   }
   return 0;
 }
@@ -549,6 +558,8 @@
 extern int demux_open_smjpeg(demuxer_t* demuxer);
 extern int bmp_check_file(demuxer_t *demuxer);
 extern int demux_xmms_open(demuxer_t* demuxer);
+extern int gif_check_file(demuxer_t *demuxer);
+extern int demux_open_gif(demuxer_t* demuxer);
 
 extern demuxer_t* init_avi_with_ogg(demuxer_t* demuxer);
 
@@ -758,6 +769,19 @@
       demuxer = NULL;
   }
 }
+#ifdef HAVE_GIF
+//=============== Try to open as GIF file: =================
+if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_GIF){
+  demuxer=new_demuxer(stream,DEMUXER_TYPE_GIF,audio_id,video_id,dvdsub_id);
+  if(gif_check_file(demuxer)){
+      mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_Detected_XXX_FileFormat,"GIF");
+      file_format=DEMUXER_TYPE_GIF;
+  } else {
+      free_demuxer(demuxer);
+      demuxer = NULL;
+  }
+}
+#endif
 //=============== Try to open as BMP file: =================
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_BMP){
   demuxer=new_demuxer(stream,DEMUXER_TYPE_BMP,audio_id,video_id,dvdsub_id);
@@ -958,6 +982,12 @@
   if (!demux_open_film(demuxer)) return NULL;
   break;
  }
+#ifdef HAVE_GIF
+ case DEMUXER_TYPE_GIF: {
+  if (!demux_open_gif(demuxer)) return NULL;
+  break;
+ }
+#endif
  case DEMUXER_TYPE_BMP: {
   if (!demux_open_bmp(demuxer)) return NULL;
   break;
diff -Nur main.cvs/libmpdemux/demuxer.h main.dev/libmpdemux/demuxer.h
--- main.cvs/libmpdemux/demuxer.h	Thu Jan 23 10:37:51 2003
+++ main.dev/libmpdemux/demuxer.h	Fri Jan 24 10:19:57 2003
@@ -36,11 +36,12 @@
 #define DEMUXER_TYPE_XMMS 25
 #define DEMUXER_TYPE_RAWVIDEO 26
 #define DEMUXER_TYPE_MPEG4_ES 27
+#define DEMUXER_TYPE_GIF 28
 
 // This should always match the higest demuxer type number.
 // Unless you want to disallow users to force the demuxer to some types
 #define DEMUXER_TYPE_MIN 0
-#define DEMUXER_TYPE_MAX 27
+#define DEMUXER_TYPE_MAX 28
 
 #define DEMUXER_TYPE_DEMUXERS (1<<16)
 // A virtual demuxer type for the network code
diff -Nur main.cvs/libmpdemux/video.c main.dev/libmpdemux/video.c
--- main.cvs/libmpdemux/video.c	Thu Jan 23 10:37:51 2003
+++ main.dev/libmpdemux/video.c	Fri Jan 24 10:19:57 2003
@@ -412,6 +412,9 @@
           // frame_time = 1/25.0;
         }
       }
+      case DEMUXER_TYPE_GIF:
+	  frame_time=d_video->pts-pts1;
+        break;
     }
     
     if(demuxer->file_format==DEMUXER_TYPE_MPEG_PS ||
diff -Nur main.cvs/etc/codecs.conf main.dev/etc/codecs.conf
--- main.cvs/etc/codecs.conf	Thu Jan 23 10:37:51 2003
+++ main.dev/etc/codecs.conf	Fri Jan 24 10:19:46 2003
@@ -1284,7 +1284,7 @@
   driver raw
   format 0x0
   format 0x20776172
-  format 0x4247520F
+  format 0x42475208
   out BGR8 flip
 
 videocodec rawbgr1
@@ -1293,7 +1293,7 @@
   driver raw
   format 0x0
   format 0x20776172
-  format 0x4247520F
+  format 0x42475201
   out BGR1 flip
 
 videocodec rawyuy2
-------------- next part --------------
diff -Nur main.cvs/AUTHORS main.dev/AUTHORS
--- main.cvs/AUTHORS	Tue Dec 31 12:03:25 2002
+++ main.dev/AUTHORS	Fri Jan 24 10:19:57 2003
@@ -346,9 +346,10 @@
     * skip-deinterlace video filter
     * MUXER layer, and new MPEG-PS muxer
 
-Joey Parrish <joey at yunamusic.com>
+Joey Parrish <joey at nicewarrior.org>
     * various fixes
-    * -vo gif89 author
+    * -vo gif89a author
+    * gif demuxer author
 
 Juergen Hammelmann <juergen.hammelmann at gmx.de>
     * TOOLS/menvcd author
diff -Nur main.cvs/DOCS/documentation.html main.dev/DOCS/documentation.html
--- main.cvs/DOCS/documentation.html	Wed Jan 22 10:33:56 2003
+++ main.dev/DOCS/documentation.html	Fri Jan 24 10:19:57 2003
@@ -65,6 +65,7 @@
               <LI><A HREF="formats.html#ogg">2.1.1.12 OGG/OGM files</A></LI>
               <LI><A HREF="formats.html#sdp">2.1.1.13 SDP files</A></LI>
               <LI><A HREF="formats.html#pva">2.1.1.14 PVA files</A></LI>
+              <LI><A HREF="formats.html#gif">2.1.1.15 GIF files</A></LI>
             </UL>
           </LI>
           <LI><A HREF="formats.html#audio_formats">2.1.2 Audio formats</A>
diff -Nur main.cvs/DOCS/formats.html main.dev/DOCS/formats.html
--- main.cvs/DOCS/formats.html	Tue Jan  7 16:42:12 2003
+++ main.dev/DOCS/formats.html	Fri Jan 24 10:19:57 2003
@@ -233,6 +233,34 @@
   <A HREF="http://www.technotrend.de/download/av_format_v1.pdf">http://www.technotrend.de/download/av_format_v1.pdf</A></P>
 
 
+<H4><A NAME="gif">2.1.1.15 GIF files</A></H4>
+
+<P>The <B>GIF</B> format is a common format for web graphics.  There are two
+  versions of the GIF spec, GIF87a and GIF89a.  The main difference is that
+  GIF89a allows for animation.  MPlayer supports both formats through use
+  of libungif or another libgif-compatible library.  Non-animated GIFs will
+  be displayed as single frame videos.  (Use the <CODE>-loop</CODE> and
+  <CODE>-fixed-vo</CODE> options to display these longer.)</P>
+
+<P>MPlayer currently does not support seeking in GIF files.  GIF files do
+  not necessarily have a fixed frame size, nor a fixed framerate.  Rather,
+  each frame is of independant size and is supposed to be positioned in a
+  certain place on a field of fixed-size.  The framerate is controlled by
+  an optional block before each frame that specifies a next frame's delay
+  in centiseconds.</P>
+
+<P>Standard GIF files contain 24-bit RGB frames with at most an 8-bit
+  indexed pallete.  These frames are usually LZW-compressed, although
+  some GIF encoders produce uncompressed frames to avoid patent issues
+  with LZW compression.</P>
+  
+<P>Though many common Linux distributions come with libungif, you can
+  download a copy from the following address:
+  <A HREF="http://prtr-13.ucsc.edu/~badger/software/libungif/index.shtml">http://prtr-13.ucsc.edu/~badger/software/libungif/index.shtml</A></P>
+
+<P>The GIF specification can be downloaded from the following address:
+  <A HREF="http://www.w3.org/Graphics/GIF/spec-gif89a.txt">http://www.w3.org/Graphics/GIF/spec-gif89a.txt</A></P>
+
 <H3><A NAME="audio_formats">2.1.2 Audio formats</A></H3>
 
 <P>MPlayer is a <B>Movie</B> and not a <B>Media</B> player, although
diff -Nur main.cvs/DOCS/tech/formats.txt main.dev/DOCS/tech/formats.txt
--- main.cvs/DOCS/tech/formats.txt	Mon Oct 21 20:06:32 2002
+++ main.dev/DOCS/tech/formats.txt	Fri Jan 24 10:19:57 2003
@@ -152,3 +152,9 @@
     
     Note, that similarity of real and asf has some background - they worked
     together on the (never finished/used) ASF v2 spec for some time.
+
+  - GIF files:
+    The GIF format is a common format for web graphics that supports
+    animation.  These are read through libungif or compatible library.
+    Variable frame delays are supported, but seeking is not supported.
+    Seeking will be supported once an index of gif frames can be built.
diff -Nur main.cvs/configure main.dev/configure
--- main.cvs/configure	Thu Jan 23 10:37:51 2003
+++ main.dev/configure	Fri Jan 24 10:19:57 2003
@@ -167,7 +167,7 @@
   --disable-sortsub      Disable subtitles sorting [enabled]
 
 Codecs:
-  --enable-gif		 enable gif89a output support [autodetect]
+  --enable-gif		 enable gif support [autodetect]
   --enable-png		 enable png input/output support [autodetect]
   --enable-jpeg		 enable jpeg input/output support [autodetect]
   --enable-liblzo	 enable external liblzo support [autodetect]
@@ -2888,7 +2888,7 @@
 fi
 
 
-echocheck "GIF89a support"
+echocheck "GIF support"
 if test "$_gif" = auto ; then
   _gif=no
 cat > $TMPC << EOF
@@ -2915,9 +2915,10 @@
 if test "$_gif" = yes ; then
   _def_gif='#define HAVE_GIF 1'
   _vosrc="$_vosrc vo_gif89a.c"
+  _codecmodules="gif $_codecmodules"
   _vomodules="gif89a $_vomodules"
   _mkf_gif="yes"
-  _gif="yes (old version, some functions disabled)"
+  _gif="yes (old version, some encoding functions disabled)"
   _def_gif_4='#undef HAVE_GIF_4'
 
   cat > $TMPC << EOF
@@ -2939,6 +2940,7 @@
   _def_gif='#undef HAVE_GIF'
   _def_gif_4='#undef HAVE_GIF_4'
   _novomodules="gif89a $_novomodules"
+  _nocodecmodules="gif $_codecmodules"
   _mkf_gif="no"
 fi
 echores "$_gif"
-------------- next part --------------
diff -Nur main.cvs/codec-cfg.h main.dev/codec-cfg.h
--- main.cvs/codec-cfg.h	Wed Jan 22 10:33:54 2003
+++ main.dev/codec-cfg.h	Fri Jan 24 10:19:57 2003
@@ -18,6 +18,7 @@
 #define CODECS_FLAG_YUVHACK	(1<<2)
 #define CODECS_FLAG_QUERY	(1<<3)
 #define CODECS_FLAG_STATIC	(1<<4)
+#define CODECS_FLAG_PALETTE	(1<<5)
 
 #define CODECS_STATUS__MIN		0
 #define CODECS_STATUS_NOT_WORKING	-1
diff -Nur main.cvs/libmpcodecs/vd.c main.dev/libmpcodecs/vd.c
--- main.cvs/libmpcodecs/vd.c	Fri Dec 27 11:31:52 2002
+++ main.dev/libmpcodecs/vd.c	Fri Jan 24 10:19:57 2003
@@ -165,6 +165,9 @@
 
 //    if(!vf) return 1; // temp hack
     
+    if(sh->codec->flags & CODECS_FLAG_PALETTE){
+        sh->vfilter=vf=vf_open_filter(vf,"palette",NULL);
+    } else
     if(get_video_quality_max(sh)<=0 && divx_quality){
 	// user wants postprocess but no pp filter yet:
 	sh->vfilter=vf=vf_open_filter(vf,"pp",NULL);
diff -Nur main.cvs/libmpcodecs/vd_raw.c main.dev/libmpcodecs/vd_raw.c
--- main.cvs/libmpcodecs/vd_raw.c	Thu Oct 17 16:32:35 2002
+++ main.dev/libmpcodecs/vd_raw.c	Fri Jan 24 10:19:57 2003
@@ -43,6 +43,7 @@
 	    mp_msg(MSGT_DECVIDEO,MSGL_WARN,"RAW: depth %d not supported\n",sh->bih->biBitCount);
 	}
     }
+    if (sh->bih && sh->bih->biPlanes>1) sh->codec->flags |= CODECS_FLAG_PALETTE;
     return mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,sh->bih ? sh->bih->biCompression : sh->format);
 }
 


More information about the MPlayer-dev-eng mailing list