diff options
author | wm4 <wm4@nowhere> | 2013-11-23 21:40:51 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-23 21:40:51 +0100 |
commit | de68b8f23c8cfbf5967aa73b08835f75ac0f152e (patch) | |
tree | 828f8d20f24fd52ddade4e2f0020d5eefd1e9491 /video/decode/dec_video.c | |
parent | 215b3cedda95786392fd1064155f3e39d9b7c662 (diff) | |
download | mpv-de68b8f23c8cfbf5967aa73b08835f75ac0f152e.tar.bz2 mpv-de68b8f23c8cfbf5967aa73b08835f75ac0f152e.tar.xz |
video: move handling of container vs. stream AR out of vd_lavc.c
Now the actual decoder doesn't need to care about this anymore, and it's
handled in generic code instead. This simplifies vd_lavc.c, and in
particular we don't need to detect format changes in the old way
anymore.
Diffstat (limited to 'video/decode/dec_video.c')
-rw-r--r-- | video/decode/dec_video.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index 1b461a619a..34dc9bd073 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -339,13 +339,26 @@ int mpcodecs_reconfig_vo(struct dec_video *d_video, d_video->vfilter = vf; flip = false; } - // time to do aspect ratio corrections... + + float decoder_aspect = p.d_w / (float)p.d_h; + if (d_video->initial_decoder_aspect == 0) + d_video->initial_decoder_aspect = decoder_aspect; + + // We normally prefer the container aspect, unless the decoder aspect + // changes at least once. + if (d_video->initial_decoder_aspect == decoder_aspect) { + if (sh->aspect > 0) + vf_set_dar(&p.d_w, &p.d_h, p.w, p.h, sh->aspect); + } else { + // Even if the aspect switches back, don't use container aspect again. + d_video->initial_decoder_aspect = -1; + } float force_aspect = opts->movie_aspect; if (force_aspect > -1.0 && d_video->stream_aspect != 0.0) force_aspect = d_video->stream_aspect; - if (force_aspect >= 0) + if (force_aspect > 0) vf_set_dar(&p.d_w, &p.d_h, p.w, p.h, force_aspect); if (abs(p.d_w - p.w) >= 4 || abs(p.d_h - p.h) >= 4) { |