[MPlayer-cvslog] r36391 - in trunk: DOCS/tech/slave.txt command.c libmpcodecs/vd.c libmpdemux/stheader.h

ib subversion at mplayerhq.hu
Thu Aug 1 23:18:14 CEST 2013


Author: ib
Date: Thu Aug  1 23:18:14 2013
New Revision: 36391

Log:
Handle special argument -1 to switch_ratio as intended.

Reset to the original aspect ratio that would have been used for
the very first rescaling rather than to the display size ratio.

This will now handle anamorphic videos correctly as well.

Modified:
   trunk/DOCS/tech/slave.txt
   trunk/command.c
   trunk/libmpcodecs/vd.c
   trunk/libmpdemux/stheader.h

Modified: trunk/DOCS/tech/slave.txt
==============================================================================
--- trunk/DOCS/tech/slave.txt	Thu Aug  1 19:45:31 2013	(r36390)
+++ trunk/DOCS/tech/slave.txt	Thu Aug  1 23:18:14 2013	(r36391)
@@ -409,7 +409,8 @@ switch_angle [value] (DVDs only)
 
 switch_ratio [value]
     Change aspect ratio at runtime. [value] is the new aspect ratio expressed
-    as a float (e.g. 1.77778 for 16/9).
+    as a float (e.g. 1.77778 for 16/9), or special value -1 to reset to
+    original aspect ratio.
     There might be problems with some video filters.
 
 switch_title [value] (DVDNAV only)

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Thu Aug  1 19:45:31 2013	(r36390)
+++ trunk/command.c	Thu Aug  1 23:18:14 2013	(r36391)
@@ -2718,7 +2718,7 @@ int run_command(MPContext *mpctx, mp_cmd
             if (!sh_video)
                 break;
             if (cmd->nargs == 0 || cmd->args[0].v.f == -1)
-                movie_aspect = (float) sh_video->disp_w / sh_video->disp_h;
+                movie_aspect = sh_video->original_aspect;
             else
                 movie_aspect = cmd->args[0].v.f;
             mpcodecs_config_vo(sh_video, sh_video->disp_w, sh_video->disp_h, 0);

Modified: trunk/libmpcodecs/vd.c
==============================================================================
--- trunk/libmpcodecs/vd.c	Thu Aug  1 19:45:31 2013	(r36390)
+++ trunk/libmpcodecs/vd.c	Thu Aug  1 23:18:14 2013	(r36391)
@@ -292,6 +292,9 @@ int mpcodecs_config_vo(sh_video_t *sh, i
     }
     // time to do aspect ratio corrections...
 
+    if (!sh->original_aspect)
+        sh->original_aspect = sh->stream_aspect != 0.0 ? sh->stream_aspect : sh->aspect;
+
     if (movie_aspect > -1.0)
         sh->aspect = movie_aspect;      // cmdline overrides autodetect
     else if (sh->stream_aspect != 0.0)

Modified: trunk/libmpdemux/stheader.h
==============================================================================
--- trunk/libmpdemux/stheader.h	Thu Aug  1 19:45:31 2013	(r36390)
+++ trunk/libmpdemux/stheader.h	Thu Aug  1 23:18:14 2013	(r36391)
@@ -102,7 +102,8 @@ typedef struct sh_video {
   // output format: (set by demuxer)
   float fps;              // frames per second (set only if constant fps)
   float frametime;        // 1/fps
-  float aspect;           // aspect ratio stored in the file (for prescaling)
+  float aspect;           // current aspect ratio (for prescaling)
+  float original_aspect;  // original aspect ratio stored in the file
   float stream_aspect;  // aspect ratio stored in the media headers (e.g. in DVD IFO files)
   int i_bps;              // == bitrate  (compressed bytes/sec)
   int disp_w,disp_h;      // display size (filled by fileformat parser)


More information about the MPlayer-cvslog mailing list