Mercurial > mplayer.hg
comparison libmpcodecs/vd.c @ 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 | 8f6e84a2a431 |
children | 241bba8f60e8 |
comparison
equal
deleted
inserted
replaced
9274:737c44487ebc | 9275:d29f03d5763c |
---|---|
146 unsigned int out_fmt=0; | 146 unsigned int out_fmt=0; |
147 int screen_size_x=0;//SCREEN_SIZE_X; | 147 int screen_size_x=0;//SCREEN_SIZE_X; |
148 int screen_size_y=0;//SCREEN_SIZE_Y; | 148 int screen_size_y=0;//SCREEN_SIZE_Y; |
149 // vo_functions_t* video_out=sh->video_out; | 149 // vo_functions_t* video_out=sh->video_out; |
150 vf_instance_t* vf=sh->vfilter,*sc=NULL; | 150 vf_instance_t* vf=sh->vfilter,*sc=NULL; |
151 int palette=0; | |
151 | 152 |
152 if(!sh->disp_w || !sh->disp_h) | 153 if(!sh->disp_w || !sh->disp_h) |
153 mp_msg(MSGT_DECVIDEO,MSGL_WARN, MSGTR_CodecDidNotSet); | 154 mp_msg(MSGT_DECVIDEO,MSGL_WARN, MSGTR_CodecDidNotSet); |
154 /* XXX: HACK, if sh->disp_* aren't set, | 155 /* XXX: HACK, if sh->disp_* aren't set, |
155 * but we have w and h, set them :: atmos */ | 156 * but we have w and h, set them :: atmos */ |
170 sh->vfilter=vf=vf_open_filter(vf,"pp",NULL); | 171 sh->vfilter=vf=vf_open_filter(vf,"pp",NULL); |
171 } | 172 } |
172 | 173 |
173 // check if libvo and codec has common outfmt (no conversion): | 174 // check if libvo and codec has common outfmt (no conversion): |
174 csp_again: | 175 csp_again: |
176 | |
177 if(verbose>0){ | |
178 vf_instance_t* f=vf; | |
179 mp_msg(MSGT_DECVIDEO,MSGL_V,"Trying filter chain:"); | |
180 for(f = vf ; f ; f = f->next) | |
181 mp_msg(MSGT_DECVIDEO,MSGL_V," %s",f->info->name); | |
182 mp_msg(MSGT_DECVIDEO,MSGL_V,"\n"); | |
183 } | |
184 | |
175 j=-1; | 185 j=-1; |
176 for(i=0;i<CODECS_MAX_OUTFMT;i++){ | 186 for(i=0;i<CODECS_MAX_OUTFMT;i++){ |
177 int flags; | 187 int flags; |
178 out_fmt=sh->codec->outfmt[i]; | 188 out_fmt=sh->codec->outfmt[i]; |
179 if(out_fmt==(signed int)0xFFFFFFFF) continue; | 189 if(out_fmt==(unsigned int)0xFFFFFFFF) continue; |
180 flags=vf->query_format(vf,out_fmt); | 190 flags=vf->query_format(vf,out_fmt); |
181 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X (i=%d) \n",vo_format_name(out_fmt),flags,i); | 191 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X (i=%d) \n",vo_format_name(out_fmt),flags,i); |
182 if((flags&2) || (flags && j<0)){ | 192 if((flags&2) || (flags && j<0)){ |
183 // check (query) if codec really support this outfmt... | 193 // check (query) if codec really support this outfmt... |
184 sh->outfmtidx=j; // pass index to the control() function this way | 194 sh->outfmtidx=j; // pass index to the control() function this way |
185 if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)==CONTROL_FALSE){ | 195 if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)==CONTROL_FALSE){ |
186 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: codec query_format(%s) returned FALSE\n",vo_format_name(out_fmt)); | 196 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: codec query_format(%s) returned FALSE\n",vo_format_name(out_fmt)); |
187 continue; | 197 continue; |
188 } | 198 } |
189 j=i; vo_flags=flags; if(flags&2) break; | 199 j=i; vo_flags=flags; if(flags&2) break; |
200 } else | |
201 if(!palette && !(flags&3) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){ | |
202 sh->outfmtidx=j; // pass index to the control() function this way | |
203 if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)!=CONTROL_FALSE) | |
204 palette=1; | |
190 } | 205 } |
191 } | 206 } |
192 if(j<0){ | 207 if(j<0){ |
193 // TODO: no match - we should use conversion... | 208 // TODO: no match - we should use conversion... |
194 if(strcmp(vf->info->name,"scale")){ | 209 if(strcmp(vf->info->name,"scale") && palette!=-1){ |
195 mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_CouldNotFindColorspace); | 210 mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_CouldNotFindColorspace); |
196 sc=vf=vf_open_filter(vf,"scale",NULL); | 211 sc=vf=vf_open_filter(vf,"scale",NULL); |
197 goto csp_again; | 212 goto csp_again; |
198 } else { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc | 213 } else |
214 if(palette==1){ | |
215 mp_msg(MSGT_DECVIDEO,MSGL_V,"vd: Trying -vop palette...\n"); | |
216 palette=-1; | |
217 vf=vf_open_filter(vf,"palette",NULL); | |
218 goto csp_again; | |
219 } else | |
220 { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc | |
199 vf_instance_t* vo, *vp = NULL, *ve; | 221 vf_instance_t* vo, *vp = NULL, *ve; |
200 // Remove the scale filter if we added it ourself | 222 // Remove the scale filter if we added it ourself |
201 if(vf == sc) { | 223 if(vf == sc) { |
202 ve = vf; | 224 ve = vf; |
203 vf = vf->next; | 225 vf = vf->next; |