changeset 2031:624df8ea0e0e

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 15:58:31 +0000
parents 68dbb349566e
children b47575b96fee
files cfg-mplayer.h cfgparser.c dec_video.c libvo/vo_xv.c stheader.h
diffstat 5 files changed, 48 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cfg-mplayer.h	Mon Oct 01 13:09:04 2001 +0000
+++ b/cfg-mplayer.h	Mon Oct 01 15:58:31 2001 +0000
@@ -210,6 +210,7 @@
 	{"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},
--- a/cfgparser.c	Mon Oct 01 13:09:04 2001 +0000
+++ b/cfgparser.c	Mon Oct 01 15:58:31 2001 +0000
@@ -152,8 +152,14 @@
 				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;
 			}
--- a/dec_video.c	Mon Oct 01 13:09:04 2001 +0000
+++ b/dec_video.c	Mon Oct 01 15:58:31 2001 +0000
@@ -673,6 +673,26 @@
       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;
--- a/libvo/vo_xv.c	Mon Oct 01 13:09:04 2001 +0000
+++ b/libvo/vo_xv.c	Mon Oct 01 15:58:31 2001 +0000
@@ -158,6 +158,25 @@
     {
      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);
--- a/stheader.h	Mon Oct 01 13:09:04 2001 +0000
+++ b/stheader.h	Mon Oct 01 15:58:31 2001 +0000
@@ -75,6 +75,7 @@
   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: