# HG changeset patch # User ib # Date 1375391894 0 # Node ID 0bd0297b073a373d5e58d3e6a426510a248b7b8b # Parent a73127c786e88480c79e29d00e7fb0c9f4efaf29 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. diff -r a73127c786e8 -r 0bd0297b073a DOCS/tech/slave.txt --- a/DOCS/tech/slave.txt Thu Aug 01 17:45:31 2013 +0000 +++ b/DOCS/tech/slave.txt Thu Aug 01 21:18:14 2013 +0000 @@ -409,7 +409,8 @@ 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) diff -r a73127c786e8 -r 0bd0297b073a command.c --- a/command.c Thu Aug 01 17:45:31 2013 +0000 +++ b/command.c Thu Aug 01 21:18:14 2013 +0000 @@ -2718,7 +2718,7 @@ 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); diff -r a73127c786e8 -r 0bd0297b073a libmpcodecs/vd.c --- a/libmpcodecs/vd.c Thu Aug 01 17:45:31 2013 +0000 +++ b/libmpcodecs/vd.c Thu Aug 01 21:18:14 2013 +0000 @@ -292,6 +292,9 @@ } // 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) diff -r a73127c786e8 -r 0bd0297b073a libmpdemux/stheader.h --- a/libmpdemux/stheader.h Thu Aug 01 17:45:31 2013 +0000 +++ b/libmpdemux/stheader.h Thu Aug 01 21:18:14 2013 +0000 @@ -102,7 +102,8 @@ // 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)