summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-04 18:04:48 +0200
committerwm4 <wm4@nowhere>2015-08-04 18:04:48 +0200
commit3ab6155d211c0891fca57bc504c3401d59e8424f (patch)
tree6440b6f9d989265cea329e6acce73de3d4f2f41b
parentae2f8fd0bea14796dd53f50bdc43924c047d2266 (diff)
downloadmpv-3ab6155d211c0891fca57bc504c3401d59e8424f.tar.bz2
mpv-3ab6155d211c0891fca57bc504c3401d59e8424f.tar.xz
command: always make video-aspect property accessible
Now it can always be read. Normally returns the value of the video- aspect option. Writing it sets the option. If the aspect is not forced, it will attempt to return whatever is the current video aspect.
-rw-r--r--player/command.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/player/command.c b/player/command.c
index ec723efabf..e4e1f2ea7b 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2640,27 +2640,27 @@ static int mp_property_aspect(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
- if (!mpctx->d_video)
- return M_PROPERTY_UNAVAILABLE;
- struct dec_video *d_video = mpctx->d_video;
- struct sh_video *sh_video = d_video->header->video;
switch (action) {
case M_PROPERTY_SET: {
mpctx->opts->movie_aspect = *(float *)arg;
- reinit_video_filters(mpctx);
- mp_force_video_refresh(mpctx);
+ if (mpctx->d_video) {
+ reinit_video_filters(mpctx);
+ mp_force_video_refresh(mpctx);
+ }
return M_PROPERTY_OK;
}
case M_PROPERTY_GET: {
- float aspect = -1;
- 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;
- } else if (sh_video->disp_w && sh_video->disp_h) {
- aspect = (float)sh_video->disp_w / sh_video->disp_h;
+ float aspect = mpctx->opts->movie_aspect;
+ if (mpctx->d_video && aspect <= 0) {
+ 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;
+ } else if (sh_video->disp_w && sh_video->disp_h) {
+ aspect = (float)sh_video->disp_w / sh_video->disp_h;
+ }
}
- if (aspect <= 0)
- return M_PROPERTY_UNAVAILABLE;
*(float *)arg = aspect;
return M_PROPERTY_OK;
}