Mercurial > mplayer.hg
comparison libmpcodecs/vd.c @ 5075:37e15b16e38d
libvo init moved to libmpcodecs
author | arpi |
---|---|
date | Thu, 14 Mar 2002 23:28:51 +0000 |
parents | ef8a43b74075 |
children | 2000ba19b606 |
comparison
equal
deleted
inserted
replaced
5074:1bf1dd918706 | 5075:37e15b16e38d |
---|---|
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <string.h> | 3 #include <string.h> |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "mp_msg.h" | 6 #include "mp_msg.h" |
7 #include "help_mp.h" | |
7 | 8 |
8 #ifdef HAVE_MALLOC_H | 9 #ifdef HAVE_MALLOC_H |
9 #include <malloc.h> | 10 #include <malloc.h> |
10 #endif | 11 #endif |
11 | 12 |
87 }; | 88 }; |
88 | 89 |
89 #include "libvo/video_out.h" | 90 #include "libvo/video_out.h" |
90 extern int vaa_use_dr; | 91 extern int vaa_use_dr; |
91 | 92 |
93 // libvo opts: | |
94 int fullscreen=0; | |
95 int vidmode=0; | |
96 int softzoom=0; | |
97 int flip=-1; | |
98 int opt_screen_size_x=0; | |
99 int opt_screen_size_y=0; | |
100 int screen_size_xy=0; | |
101 float movie_aspect=-1.0; | |
102 int vo_flags=0; | |
103 | |
104 static vo_tune_info_t vtune; | |
105 | |
92 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; | |
108 unsigned int out_fmt=0; | |
109 int screen_size_x=0;//SCREEN_SIZE_X; | |
110 int screen_size_y=0;//SCREEN_SIZE_Y; | |
111 vo_functions_t* video_out=sh->video_out; | |
112 | |
113 memset(&vtune,0,sizeof(vo_tune_info_t)); | |
114 | |
93 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"VDec: vo config request - %d x %d, %s \n", | 115 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"VDec: vo config request - %d x %d, %s \n", |
94 w,h,vo_format_name(preferred_outfmt)); | 116 w,h,vo_format_name(preferred_outfmt)); |
117 | |
118 // check if libvo and codec has common outfmt: | |
119 for(i=0;i<CODECS_MAX_OUTFMT;i++){ | |
120 out_fmt=sh->codec->outfmt[i]; | |
121 if(out_fmt==(signed int)0xFFFFFFFF) continue; | |
122 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 // TODO: check (query) if codec really support this outfmt... | |
125 if(vo_flags) break; | |
126 } | |
127 if(i>=CODECS_MAX_OUTFMT){ | |
128 // TODO: no match - we should use conversion... | |
129 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_VOincompCodec); | |
130 return 0; // failed | |
131 } | |
132 sh->outfmtidx=i; | |
133 | |
134 // autodetect flipping | |
135 if(flip==-1){ | |
136 flip=0; | |
137 if(sh->codec->outflags[i]&CODECS_FLAG_FLIP) | |
138 if(!(sh->codec->outflags[i]&CODECS_FLAG_NOFLIP)) | |
139 flip=1; | |
140 } | |
141 | |
142 // time to do aspect ratio corrections... | |
143 | |
144 if(movie_aspect>-1.0) sh->aspect = movie_aspect; // cmdline overrides autodetect | |
145 // if(!sh->aspect) sh->aspect=1.0; | |
146 screen_size_x = opt_screen_size_x; | |
147 screen_size_y = opt_screen_size_y; | |
148 if(screen_size_xy||screen_size_x||screen_size_y){ | |
149 if(screen_size_xy>0){ | |
150 if(screen_size_xy<=8){ | |
151 screen_size_x=screen_size_xy*sh->disp_w; | |
152 screen_size_y=screen_size_xy*sh->disp_h; | |
153 } else { | |
154 screen_size_x=screen_size_xy; | |
155 screen_size_y=screen_size_xy*sh->disp_h/sh->disp_w; | |
156 } | |
157 } else if(!vidmode){ | |
158 if(!screen_size_x) screen_size_x=SCREEN_SIZE_X; | |
159 if(!screen_size_y) screen_size_y=SCREEN_SIZE_Y; | |
160 if(screen_size_x<=8) screen_size_x*=sh->disp_w; | |
161 if(screen_size_y<=8) screen_size_y*=sh->disp_h; | |
162 } | |
163 } else { | |
164 // check source format aspect, calculate prescale ::atmos | |
165 screen_size_x=sh->disp_w; | |
166 screen_size_y=sh->disp_h; | |
167 if(sh->aspect>0.01){ | |
168 mp_msg(MSGT_CPLAYER,MSGL_INFO,"Movie-Aspect is %.2f:1 - prescaling to correct movie aspect.\n", | |
169 sh->aspect); | |
170 screen_size_x=(int)((float)sh->disp_h*sh->aspect); | |
171 screen_size_x+=screen_size_x%2; // round | |
172 if(screen_size_x<sh->disp_w){ | |
173 screen_size_x=sh->disp_w; | |
174 screen_size_y=(int)((float)sh->disp_w*(1.0/sh->aspect)); | |
175 screen_size_y+=screen_size_y%2; // round | |
176 } | |
177 } else { | |
178 mp_msg(MSGT_CPLAYER,MSGL_INFO,"Movie-Aspect is undefined - no prescaling applied.\n"); | |
179 } | |
180 } | |
181 | |
182 // Time to config libvo! | |
183 mp_msg(MSGT_CPLAYER,MSGL_V,"video_out->init(%dx%d->%dx%d,flags=%d,'%s',0x%X)\n", | |
184 sh->disp_w,sh->disp_h, | |
185 screen_size_x,screen_size_y, | |
186 fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), | |
187 "MPlayer",out_fmt); | |
188 | |
189 if(video_out->config(sh->disp_w,sh->disp_h, | |
190 screen_size_x,screen_size_y, | |
191 fullscreen|(vidmode<<1)|(softzoom<<2)|(flip<<3), | |
192 "MPlayer",out_fmt,&vtune)){ | |
193 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CannotInitVO); | |
194 return 0; // exit_player(MSGTR_Exit_error); | |
195 } | |
196 | |
95 return 1; | 197 return 1; |
96 } | 198 } |
97 | 199 |
98 static mp_image_t* static_images[2]; | 200 static mp_image_t* static_images[2]; |
99 static mp_image_t* temp_images[1]; | 201 static mp_image_t* temp_images[1]; |