# HG changeset patch # User ib # Date 1375647598 0 # Node ID d8a13d907c617731e94d5c2fd8220b62ea380230 # Parent 6f0ab9dd1429f5a009fb507a6cf292c26beb9e42 Enable switch_ratio -1 with videos with aspect changes. The original aspect ratio may change during playback, so sh->original_aspect must be set accordingly. This is missing in r36391. diff -r 6f0ab9dd1429 -r d8a13d907c61 libmpcodecs/vd.c --- a/libmpcodecs/vd.c Sun Aug 04 18:12:24 2013 +0000 +++ b/libmpcodecs/vd.c Sun Aug 04 20:19:58 2013 +0000 @@ -158,6 +158,7 @@ vf_instance_t *vf = sh->vfilter, *sc = NULL; int palette = 0; int vocfg_flags = 0; + static float last_movie_aspect; if (w) sh->disp_w = w; @@ -290,17 +291,26 @@ vf_add_before_vo(&vf, "flip", NULL); sh->vfilter = vf; } - // time to do aspect ratio corrections... + // time to do aspect ratio corrections (after saving the original aspect ratio)... - if (sh->original_aspect == -1.0) + if (sh->original_aspect == -1.0) { sh->original_aspect = sh->stream_aspect != 0.0 ? sh->stream_aspect : sh->aspect; + last_movie_aspect = -1.0; + } - if (movie_aspect > -1.0) + if (movie_aspect > -1.0) { + if (sh->aspect != movie_aspect && movie_aspect == last_movie_aspect) + sh->original_aspect = sh->stream_aspect != 0.0 ? sh->stream_aspect : sh->aspect; sh->aspect = movie_aspect; // cmdline overrides autodetect + } else if (sh->stream_aspect != 0.0) - sh->aspect = sh->stream_aspect; + sh->original_aspect = sh->aspect = sh->stream_aspect; + else + sh->original_aspect = sh->aspect; // if(!sh->aspect) sh->aspect=1.0; + last_movie_aspect = movie_aspect; + if (opt_screen_size_x || opt_screen_size_y) { screen_size_x = opt_screen_size_x; screen_size_y = opt_screen_size_y;