[Mplayer-cvslog] CVS: main/libmpcodecs vd.c,1.64,1.65

Arpi of Ize arpi at mplayerhq.hu
Tue Feb 4 18:50:52 CET 2003


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

Modified Files:
	vd.c 
Log Message:
- append the 'palette' filter if the codec supports RGB8/BGR8 and no csp
  match even with the scale filter.
- print the current filter chain, in verbose mode


Index: vd.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- vd.c	27 Dec 2002 17:31:52 -0000	1.64
+++ vd.c	4 Feb 2003 17:50:30 -0000	1.65
@@ -148,6 +148,7 @@
     int screen_size_y=0;//SCREEN_SIZE_Y;
 //    vo_functions_t* video_out=sh->video_out;
     vf_instance_t* vf=sh->vfilter,*sc=NULL;
+    int palette=0;
 
     if(!sh->disp_w || !sh->disp_h)
         mp_msg(MSGT_DECVIDEO,MSGL_WARN, MSGTR_CodecDidNotSet);
@@ -172,11 +173,20 @@
 
     // check if libvo and codec has common outfmt (no conversion):
 csp_again:
+
+    if(verbose>0){
+	vf_instance_t* f=vf;
+	mp_msg(MSGT_DECVIDEO,MSGL_V,"Trying filter chain:");
+	for(f = vf ; f ; f = f->next)
+	    mp_msg(MSGT_DECVIDEO,MSGL_V," %s",f->info->name);
+	mp_msg(MSGT_DECVIDEO,MSGL_V,"\n");
+    }
+
     j=-1;
     for(i=0;i<CODECS_MAX_OUTFMT;i++){
 	int flags;
 	out_fmt=sh->codec->outfmt[i];
-	if(out_fmt==(signed int)0xFFFFFFFF) continue;
+	if(out_fmt==(unsigned int)0xFFFFFFFF) continue;
 	flags=vf->query_format(vf,out_fmt);
 	mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X (i=%d) \n",vo_format_name(out_fmt),flags,i);
 	if((flags&2) || (flags && j<0)){
@@ -187,15 +197,27 @@
 		continue;
 	    }
 	    j=i; vo_flags=flags; if(flags&2) break;
+	} else
+	if(!palette && !(flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){
+	    sh->outfmtidx=j; // pass index to the control() function this way
+	    if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)!=CONTROL_FALSE)
+		palette=1;
 	}
     }
     if(j<0){
 	// TODO: no match - we should use conversion...
-	if(strcmp(vf->info->name,"scale")){	
+	if(strcmp(vf->info->name,"scale") && palette!=-1){
 	    mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_CouldNotFindColorspace);
 	    sc=vf=vf_open_filter(vf,"scale",NULL);
 	    goto csp_again;
-	} else { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc
+	} else
+	if(palette==1){
+	    mp_msg(MSGT_DECVIDEO,MSGL_V,"vd: Trying -vop palette...\n");
+	    palette=-1;
+	    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
 	     if(vf == sc) {



More information about the MPlayer-cvslog mailing list