[MPlayer-dev-eng] [PATCH] auto-load palette

Joey Parrish joey at nicewarrior.org
Fri Jan 31 16:13:47 CET 2003


Hello,

Attached below is a patch to auto-load vf_palette if swscale fails.
The behavior should be as follows:
if cspace mismatch, try scale
if scale fails, try palette
if palette fails, try lavc

I am limited as to how much I can test this.
It works with vo_x11 and vo_sdl playing GIFs and DIVX.
I cannot test to see if lavc appending still works.
vo_ggi shows garbage because it thinks it supports BGR8 but doesn't.
I cannot test svga or vesa right now, but they also claim BGR8 support.

For testing, a small gif anim movie:
http://joey.nicewarrior.org/example.gif (372k)

Also for testing, the second patch prints a simple message to say when a
filter is unloaded in vd.c, to see what failed.

Someone please check the image and what filters load with this patch:

mplayer -vo svga example.gif
mplayer -vo svga anything.avi
mplayer -vo vesa example.gif
mplayer -vo vesa anything.avi
mplayer -vo dxr2 example.gif
mplayer -vo dxr2 anything.avi
mplayer -vo dxr3 example.gif
mplayer -vo dxr3 anything.avi

Thanks,
--Joey
-------------- next part --------------
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 31 08:39:08 2003
@@ -191,10 +191,20 @@
     }
     if(j<0){
 	// TODO: no match - we should use conversion...
-	if(strcmp(vf->info->name,"scale")){	
+	if(strcmp(vf->info->name,"scale") && strcmp(vf->info->name,"palette")){	
 	    mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_CouldNotFindColorspace);
 	    sc=vf=vf_open_filter(vf,"scale",NULL);
 	    goto csp_again;
+	} else if (strcmp(vf->info->name,"palette")) { // sws failed, try vf_palette
+	     vf_instance_t* vo, *vp = NULL, *ve;
+	     // Remove the scale filter if we added it ourself
+	     if(vf == sc) {
+	       ve = vf;
+	       vf = vf->next;
+	       vf_uninit_filter(ve);
+	     }
+	     sc=vf=vf_open_filter(vf,"palette",NULL);
+	     goto csp_again;
 	} else { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc
 	     vf_instance_t* vo, *vp = NULL, *ve;
 	     // Remove the scale filter if we added it ourself
-------------- next part --------------
--- main.dev/libmpcodecs/vd.c.orig	Fri Jan 31 09:10:45 2003
+++ main.dev/libmpcodecs/vd.c	Fri Jan 31 09:10:33 2003
@@ -202,6 +202,7 @@
 	       ve = vf;
 	       vf = vf->next;
 	       vf_uninit_filter(ve);
+	       printf("HEY!!  Removing the last filter.\n");
 	     }
 	     sc=vf=vf_open_filter(vf,"palette",NULL);
 	     goto csp_again;
@@ -212,6 +213,7 @@
 	       ve = vf;
 	       vf = vf->next;
 	       vf_uninit_filter(ve);
+	       printf("HEY!!  Removing the last filter.\n");
 	     }
 	     // Find the last filter (vf_vo)
 	     for(vo = vf ; vo->next ; vo = vo->next)


More information about the MPlayer-dev-eng mailing list