diff options
author | wm4 <wm4@nowhere> | 2013-09-26 16:53:17 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-26 17:29:14 +0200 |
commit | 9a55c4e70cebe6da6b7c7796119f84c4c9ad2a60 (patch) | |
tree | 2b998cc92f0b0d091cc48051cb3cfebff8370837 /video/decode/vd_lavc.c | |
parent | f5bf6c0fb33fb6ff11f3250de708eb6e658772c9 (diff) | |
download | mpv-9a55c4e70cebe6da6b7c7796119f84c4c9ad2a60.tar.bz2 mpv-9a55c4e70cebe6da6b7c7796119f84c4c9ad2a60.tar.xz |
video: let sh_video->aspect always be container aspect ratio
Now writing -1 to the 'aspect' property resets the video to the auto
aspect ratio. Returning the aspect from the property becomes a bit more
complicated, because we still try to return the container aspect ratio
if no frame has been decoded yet.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r-- | video/decode/vd_lavc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 7fbf9d8401..86c1c92541 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -492,8 +492,9 @@ static void update_image_params(sh_video_t *sh, AVFrame *frame) // But set it even if the sample aspect did not change, since a // resolution change can cause an aspect change even if the // _sample_ aspect is unchanged. - if (sh->aspect == 0 || ctx->last_sample_aspect_ratio.den) - sh->aspect = aspect; + float use_aspect = sh->aspect; + if (use_aspect == 0 || ctx->last_sample_aspect_ratio.den) + use_aspect = aspect; ctx->last_sample_aspect_ratio = frame->sample_aspect_ratio; sh->disp_w = width; sh->disp_h = height; @@ -501,14 +502,15 @@ static void update_image_params(sh_video_t *sh, AVFrame *frame) ctx->pix_fmt = pix_fmt; ctx->best_csp = pixfmt2imgfmt(pix_fmt); + int d_w, d_h; + vf_set_dar(&d_w, &d_h, width, height, use_aspect); + ctx->image_params = (struct mp_image_params) { .imgfmt = ctx->best_csp, .w = width, .h = height, - // Ideally, we should also set aspect ratio, but we aren't there yet - // - so vd.c calculates display size from sh->aspect. - .d_w = width, - .d_h = height, + .d_w = d_w, + .d_h = d_h, .colorspace = avcol_spc_to_mp_csp(ctx->avctx->colorspace), .colorlevels = avcol_range_to_mp_csp_levels(ctx->avctx->color_range), .chroma_location = |