changeset 9275:d29f03d5763c

- 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
author arpi
date Tue, 04 Feb 2003 17:50:30 +0000
parents 737c44487ebc
children 9fd44bc91631
files libmpcodecs/vd.c
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd.c	Tue Feb 04 16:14:54 2003 +0000
+++ b/libmpcodecs/vd.c	Tue Feb 04 17:50:30 2003 +0000
@@ -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) {