summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
Diffstat (limited to 'player')
-rw-r--r--player/command.c22
-rw-r--r--player/playloop.c2
-rw-r--r--player/screenshot.c9
-rw-r--r--player/video.c7
4 files changed, 19 insertions, 21 deletions
diff --git a/player/command.c b/player/command.c
index cc30d2b21a..ecae0df1a9 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2449,8 +2449,8 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg)
if (!p.imgfmt)
return M_PROPERTY_UNAVAILABLE;
- double dar = p.d_w / (double)p.d_h;
- double sar = p.w / (double)p.h;
+ int d_w, d_h;
+ mp_image_params_get_dsize(&p, &d_w, &d_h);
struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(p.imgfmt);
int bpp = 0;
@@ -2465,10 +2465,10 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg)
.unavailable = !(desc.flags & MP_IMGFLAG_PLANAR)},
{"w", SUB_PROP_INT(p.w)},
{"h", SUB_PROP_INT(p.h)},
- {"dw", SUB_PROP_INT(p.d_w)},
- {"dh", SUB_PROP_INT(p.d_h)},
- {"aspect", SUB_PROP_FLOAT(dar)},
- {"par", SUB_PROP_FLOAT(dar / sar)},
+ {"dw", SUB_PROP_INT(d_w)},
+ {"dh", SUB_PROP_INT(d_h)},
+ {"aspect", SUB_PROP_FLOAT(d_w / (double)d_h)},
+ {"par", SUB_PROP_FLOAT(p.p_w / (double)p.p_h)},
{"colormatrix",
SUB_PROP_STR(m_opt_choice_str(mp_csp_names, p.colorspace))},
{"colorlevels",
@@ -2561,8 +2561,8 @@ static int mp_property_window_scale(void *ctx, struct m_property *prop,
return M_PROPERTY_UNAVAILABLE;
struct mp_image_params params = get_video_out_params(mpctx);
- int vid_w = params.d_w;
- int vid_h = params.d_h;
+ int vid_w, vid_h;
+ mp_image_params_get_dsize(&params, &vid_w, &vid_h);
if (vid_w < 1 || vid_h < 1)
return M_PROPERTY_UNAVAILABLE;
@@ -2781,8 +2781,10 @@ static int mp_property_aspect(void *ctx, struct m_property *prop,
struct dec_video *d_video = mpctx->d_video;
struct sh_video *sh_video = d_video->header->video;
struct mp_image_params *params = &d_video->vfilter->override_params;
- if (params && params->d_w && params->d_h) {
- aspect = (float)params->d_w / params->d_h;
+ if (params && params->p_w > 0 && params->p_h > 0) {
+ int d_w, d_h;
+ mp_image_params_get_dsize(params, &d_w, &d_h);
+ aspect = (float)d_w / d_h;
} else if (sh_video->disp_w && sh_video->disp_h) {
aspect = (float)sh_video->disp_w / sh_video->disp_h;
}
diff --git a/player/playloop.c b/player/playloop.c
index 5efb048cb2..892baf1a09 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -889,7 +889,7 @@ int handle_force_window(struct MPContext *mpctx, bool force)
struct mp_image_params p = {
.imgfmt = config_format,
.w = w, .h = h,
- .d_w = w, .d_h = h,
+ .p_w = 1, .p_h = 1,
};
if (vo_reconfig(vo, &p) < 0)
goto err;
diff --git a/player/screenshot.c b/player/screenshot.c
index 9c4f5cc84e..76c7874498 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -308,14 +308,7 @@ static char *gen_fname(screenshot_ctx *ctx, const char *file_ext)
static void add_subs(struct MPContext *mpctx, struct mp_image *image)
{
- double sar = (double)image->w / image->h;
- double dar = (double)image->params.d_w / image->params.d_h;
- struct mp_osd_res res = {
- .w = image->w,
- .h = image->h,
- .display_par = sar / dar,
- };
-
+ struct mp_osd_res res = osd_res_from_image_params(&image->params);
osd_draw_on_image(mpctx->osd, res, mpctx->video_pts,
OSD_DRAW_SUB_ONLY, image);
}
diff --git a/player/video.c b/player/video.c
index 9be4f6a9a0..1178557e24 100644
--- a/player/video.c
+++ b/player/video.c
@@ -1186,8 +1186,11 @@ void write_video(struct MPContext *mpctx, double endpts)
const struct vo_driver *info = mpctx->video_out->driver;
char extra[20] = {0};
- if (p.w != p.d_w || p.h != p.d_h)
- snprintf(extra, sizeof(extra), " => %dx%d", p.d_w, p.d_h);
+ if (p.p_w != p.p_h) {
+ int d_w, d_h;
+ mp_image_params_get_dsize(&p, &d_w, &d_h);
+ snprintf(extra, sizeof(extra), " => %dx%d", d_w, d_h);
+ }
MP_INFO(mpctx, "VO: [%s] %dx%d%s %s\n",
info->name, p.w, p.h, extra, vo_format_name(p.imgfmt));
MP_VERBOSE(mpctx, "VO: Description: %s\n", info->description);