comparison mplayer.c @ 2034:2f1974590f88

New aspect prescale code, parses aspect value from mpeg sequence header or commandline. Removed X11_FULLSCREEN hack from mplayer.c and moved it to libvo/vo_xv.c. Added support for nominator[:/]denominator float values in cfg-parser, thanks for the code by Steve Davies. All around thanks to Steve for helping me understanding the whole stuff :)
author atmos4
date Mon, 01 Oct 2001 17:12:04 +0000
parents dc21c5f373c4
children 029bad24d022
comparison
equal deleted inserted replaced
2033:25461be8d234 2034:2f1974590f88
42 42
43 //#ifdef USE_OSD 43 //#ifdef USE_OSD
44 #include "libvo/sub.h" 44 #include "libvo/sub.h"
45 //#endif 45 //#endif
46 46
47 #ifdef HAVE_NEW_GUI
48 #define COMPILE_GMPLAYER
49 #include "Gui/mplayer/play.h"
50 #endif
51
47 #include "libao2/audio_out.h" 52 #include "libao2/audio_out.h"
48 53
49 #include "libmpeg2/mpeg2.h" 54 #include "libmpeg2/mpeg2.h"
50 #include "libmpeg2/mpeg2_internal.h" 55 #include "libmpeg2/mpeg2_internal.h"
51 56
66 #include "linux/timer.h" 71 #include "linux/timer.h"
67 #include "linux/shmem.h" 72 #include "linux/shmem.h"
68 73
69 #ifdef HAVE_LIRC 74 #ifdef HAVE_LIRC
70 #include "lirc_mp.h" 75 #include "lirc_mp.h"
71 #endif
72
73 #ifdef HAVE_NEW_GUI
74 #include "Gui/mplayer/play.h"
75 #endif 76 #endif
76 77
77 #define DEBUG if(0) 78 #define DEBUG if(0)
78 int verbose=0; 79 int verbose=0;
79 int quiet=0; 80 int quiet=0;
260 static int softzoom=0; 261 static int softzoom=0;
261 static int flip=-1; 262 static int flip=-1;
262 static int screen_size_x=0;//SCREEN_SIZE_X; 263 static int screen_size_x=0;//SCREEN_SIZE_X;
263 static int screen_size_y=0;//SCREEN_SIZE_Y; 264 static int screen_size_y=0;//SCREEN_SIZE_Y;
264 static int screen_size_xy=0; 265 static int screen_size_xy=0;
266 static float movie_aspect=0.0;
265 267
266 // sub: 268 // sub:
267 char *font_name=NULL; 269 char *font_name=NULL;
268 float font_factor=0.75; 270 float font_factor=0.75;
269 char *sub_name=NULL; 271 char *sub_name=NULL;
993 995
994 // ========== Init display (sh_video->disp_w*sh_video->disp_h/out_fmt) ============ 996 // ========== Init display (sh_video->disp_w*sh_video->disp_h/out_fmt) ============
995 997
996 current_module="init_libvo"; 998 current_module="init_libvo";
997 999
998 #ifdef X11_FULLSCREEN 1000 #if 0 /* was X11_FULLSCREEN hack -> moved to libvo/vo_xv.c where it belongs ::atmos */
999 if(fullscreen){ 1001 if(fullscreen){
1000 if(vo_init()){ 1002 if(vo_init()){
1001 //if(verbose) printf("X11 running at %dx%d depth: %d\n",vo_screenwidth,vo_screenheight,vo_depthonscreen); 1003 //if(verbose) printf("X11 running at %dx%d depth: %d\n",vo_screenwidth,vo_screenheight,vo_depthonscreen);
1002 } 1004 }
1003 if(!screen_size_xy) screen_size_xy=vo_screenwidth; // scale with asp.ratio 1005 if(!screen_size_xy) screen_size_xy=vo_screenwidth; // scale with asp.ratio
1004 } 1006 }
1005 #endif 1007 #endif
1006 1008 // Set default VGA 1:1 aspect as fallback ::atmos
1009 if(movie_aspect) sh_video->aspect = movie_aspect;
1010 if(!sh_video->aspect) sh_video->aspect=1.0;
1011
1012 if(screen_size_xy||screen_size_x||screen_size_y){
1007 if(screen_size_xy>0){ 1013 if(screen_size_xy>0){
1008 if(screen_size_xy<=8){ 1014 if(screen_size_xy<=8){
1009 screen_size_x=screen_size_xy*sh_video->disp_w; 1015 screen_size_x=screen_size_xy*sh_video->disp_w;
1010 screen_size_y=screen_size_xy*sh_video->disp_h; 1016 screen_size_y=screen_size_xy*sh_video->disp_h;
1011 } else { 1017 } else {
1016 if(!screen_size_x) screen_size_x=SCREEN_SIZE_X; 1022 if(!screen_size_x) screen_size_x=SCREEN_SIZE_X;
1017 if(!screen_size_y) screen_size_y=SCREEN_SIZE_Y; 1023 if(!screen_size_y) screen_size_y=SCREEN_SIZE_Y;
1018 if(screen_size_x<=8) screen_size_x*=sh_video->disp_w; 1024 if(screen_size_x<=8) screen_size_x*=sh_video->disp_w;
1019 if(screen_size_y<=8) screen_size_y*=sh_video->disp_h; 1025 if(screen_size_y<=8) screen_size_y*=sh_video->disp_h;
1020 } 1026 }
1027 } else {
1028 // check source format aspect, calculate prescale ::atmos
1029 screen_size_x=sh_video->disp_w;
1030 screen_size_y=sh_video->disp_h;
1031 if(sh_video->aspect!=1.0){
1032 mp_msg(MSGT_CPLAYER,MSGL_INFO,"Movie-Aspect is %.2f:1 - prescaling to correct movie aspect.\n",
1033 sh_video->aspect);
1034 screen_size_x=(int)((float)sh_video->disp_h*sh_video->aspect);
1035 screen_size_x+=screen_size_x%2; // round
1036 if(screen_size_x<sh_video->disp_w){
1037 screen_size_x=sh_video->disp_w;
1038 screen_size_y=(int)((float)sh_video->disp_w*(1.0/sh_video->aspect));
1039 screen_size_y+=screen_size_y%2; // round
1040 }
1041 } else {
1042 mp_msg(MSGT_CPLAYER,MSGL_INFO,"Movie-Aspect is 1:1 - no prescaling applied.\n");
1043 }
1044 }
1021 1045
1022 #ifndef USE_LIBVO2 1046 #ifndef USE_LIBVO2
1023 { const vo_info_t *info = video_out->get_info(); 1047 { const vo_info_t *info = video_out->get_info();
1024 mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name, 1048 mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
1025 sh_video->disp_w,sh_video->disp_h, 1049 sh_video->disp_w,sh_video->disp_h,