diff options
author | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-10-01 15:58:31 +0000 |
---|---|---|
committer | atmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2001-10-01 15:58:31 +0000 |
commit | 813e82a7eac31680db3ea431cc6758120579ce1c (patch) | |
tree | 89b64df8fcc634c53425ed03ef722bfce2250597 | |
parent | a47ac752e5da5b4d056ca1d8a511c660aedbae4b (diff) |
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
-rw-r--r-- | cfg-mplayer.h | 1 | ||||
-rw-r--r-- | cfgparser.c | 8 | ||||
-rw-r--r-- | dec_video.c | 20 | ||||
-rw-r--r-- | libvo/vo_xv.c | 19 | ||||
-rw-r--r-- | stheader.h | 1 |
5 files changed, 48 insertions, 1 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h index eb68e466e7..dc39bb4886 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -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}, diff --git a/cfgparser.c b/cfgparser.c index feb2b2a7d1..83e4650230 100644 --- a/cfgparser.c +++ b/cfgparser.c @@ -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; } diff --git a/dec_video.c b/dec_video.c index 012c4dafa7..ed1bf4e167 100644 --- a/dec_video.c +++ b/dec_video.c @@ -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; diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index fa1cdcd969..f2b5f7753f 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -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); diff --git a/stheader.h b/stheader.h index dbc3b2b77c..891331b032 100644 --- a/stheader.h +++ b/stheader.h @@ -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: |