1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 23:32:26 +00:00

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 :)


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2032 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
atmos4 2001-10-01 15:58:31 +00:00
parent a47ac752e5
commit 813e82a7ea
5 changed files with 48 additions and 1 deletions

View File

@ -210,6 +210,7 @@ struct config conf[]={
{"x", &screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096},
{"y", &screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096},
{"xy", &screen_size_xy, CONF_TYPE_INT, CONF_RANGE, 0, 4096},
{"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0},
{"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1},
{"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0},
{"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1},

View File

@ -152,8 +152,14 @@ static int read_option(char *opt, char *param)
goto err_missing_param;
tmp_float = strtod(param, &endptr);
if ((*endptr == ':') || (*endptr == '/'))
tmp_float /= strtod(endptr+1, &endptr);
if (*endptr) {
printf("parameter must be a floating point number:\n");
printf("parameter must be a floating point number"
" or a ratio (numerator[:/]denominator):\n");
ret = ERR_MISSING_PARAM;
goto out;
}

View File

@ -673,6 +673,26 @@ switch(d_video->demuxer->file_format){
return 0;
}
}
// fill aspect info:
switch(picture->aspect_ratio_information){
case 2: // PAL/NTSC SVCD/DVD 4:3
case 8: // PAL VCD 4:3
case 12: // NTSC VCD 4:3
sh_video->aspect=4.0/3.0;
break;
case 3: // PAL/NTSC Widescreen SVCD/DVD 16:9
sh_video->aspect=16.0/9.0;
break;
default:
fprintf(stderr,"Detected unknown aspect_ratio_information in mpeg sequence header.\n"
"Please report the aspect value (%i) along with the movie type (VGA,PAL,NTSC,"
"SECAM) and the movie resolution (720x576,352x240,480x480,...) to the MPlayer"
" developers, so that we can add support for it!\nAssuming 1:1 aspect for now.\n",
picture->aspect_ratio_information);
case 1: // VGA 1:1
sh_video->aspect=1.0;
break;
}
// display info:
sh_video->format=picture->mpeg1?0x10000001:0x10000002; // mpeg video
sh_video->fps=frameratecode2framerate[picture->frame_rate_code]*0.0001f;

View File

@ -158,6 +158,25 @@ static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t
{
hint.width=vo_screenwidth;
hint.height=vo_screenheight;
/* this code replaces X11_FULLSCREEN hack in mplayer.c
* with libvo2 this should be unified among vo plugins
* besides zooming should only be done with -zoom,
* but I leave the old -fs behaviour so users don't get
* irritated for now (and send lots o' mails ;) ::atmos
*/
#ifdef X11_FULLSCREEN
d_height=(int)((float)vo_screenwidth/(float)dwidth*(float)dheight);
d_height+=d_height%2; // round
d_width=vo_screenwidth;
if(dheight>vo_screenheight){
d_width=(int)((float)vo_screenheight/(float)dheight*(float)dwidth);
d_width+=d_width%2; // round
d_height=vo_screenheight;
}
dwidth=d_width; dheight=d_height;
#endif
}
hint.flags = PPosition | PSize;
XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);

View File

@ -75,6 +75,7 @@ typedef struct {
int i_bps; // == bitrate (compressed bytes/sec)
int disp_w,disp_h; // display size (filled by fileformat parser)
// int coded_w,coded_h; // coded size (filled by video codec)
float aspect;
unsigned int outfmtidx;
// unsigned int bitrate;
// buffers: