comparison libmpcodecs/vd.c @ 5131:cff03e88d331

prefer outfmt with no conversion (see vo's query flags)
author arpi
date Sat, 16 Mar 2002 02:46:49 +0000
parents 2000ba19b606
children 1c250c1da93c
comparison
equal deleted inserted replaced
5130:305b1fbde890 5131:cff03e88d331
102 int vo_flags=0; 102 int vo_flags=0;
103 103
104 static vo_tune_info_t vtune; 104 static vo_tune_info_t vtune;
105 105
106 int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt){ 106 int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt){
107 int i; 107 int i,j;
108 unsigned int out_fmt=0; 108 unsigned int out_fmt=0;
109 int screen_size_x=0;//SCREEN_SIZE_X; 109 int screen_size_x=0;//SCREEN_SIZE_X;
110 int screen_size_y=0;//SCREEN_SIZE_Y; 110 int screen_size_y=0;//SCREEN_SIZE_Y;
111 vo_functions_t* video_out=sh->video_out; 111 vo_functions_t* video_out=sh->video_out;
112 112
113 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"VDec: vo config request - %d x %d, %s \n", 113 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"VDec: vo config request - %d x %d, %s \n",
114 w,h,vo_format_name(preferred_outfmt)); 114 w,h,vo_format_name(preferred_outfmt));
115 115
116 if(!video_out) return 1; // temp hack 116 if(!video_out) return 1; // temp hack
117 117
118 // check if libvo and codec has common outfmt: 118 // check if libvo and codec has common outfmt (no conversion):
119 j=-1;
119 for(i=0;i<CODECS_MAX_OUTFMT;i++){ 120 for(i=0;i<CODECS_MAX_OUTFMT;i++){
120 out_fmt=sh->codec->outfmt[i]; 121 out_fmt=sh->codec->outfmt[i];
121 if(out_fmt==(signed int)0xFFFFFFFF) continue; 122 if(out_fmt==(signed int)0xFFFFFFFF) continue;
122 vo_flags=video_out->control(VOCTRL_QUERY_FORMAT, &out_fmt); 123 vo_flags=video_out->control(VOCTRL_QUERY_FORMAT, &out_fmt);
123 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X\n",vo_format_name(out_fmt),vo_flags); 124 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X (i=%d) \n",vo_format_name(out_fmt),vo_flags,i);
124 // TODO: check (query) if codec really support this outfmt... 125 // TODO: check (query) if codec really support this outfmt...
125 if(vo_flags) break; 126 if(vo_flags&2){j=i; break;}
126 } 127 if(vo_flags && j<0) j=i;
127 if(i>=CODECS_MAX_OUTFMT){ 128 }
129 if(j<0){
128 // TODO: no match - we should use conversion... 130 // TODO: no match - we should use conversion...
129 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_VOincompCodec); 131 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_VOincompCodec);
130 return 0; // failed 132 return 0; // failed
131 } 133 }
132 sh->outfmtidx=i; 134 out_fmt=sh->codec->outfmt[j];
135 sh->outfmtidx=j;
133 136
134 // autodetect flipping 137 // autodetect flipping
135 if(flip==-1){ 138 if(flip==-1){
136 flip=0; 139 flip=0;
137 if(sh->codec->outflags[i]&CODECS_FLAG_FLIP) 140 if(sh->codec->outflags[j]&CODECS_FLAG_FLIP)
138 if(!(sh->codec->outflags[i]&CODECS_FLAG_NOFLIP)) 141 if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP))
139 flip=1; 142 flip=1;
140 } 143 }
141 144
142 // time to do aspect ratio corrections... 145 // time to do aspect ratio corrections...
143 146