Unified · Split
| @@ -61,6 +61,7 @@ Interface changes · 60 unmodified lines | ||
| 61 | 61 | - remove `--alpha` and reintroduce `--background` option for better control |
| 62 | 62 | over blending alpha components into specific background types |
| 63 | 63 | - add `--border-background` option |
| 64 | + - add `video-target-params` property | |
| 64 | 65 | --- mpv 0.37.0 --- |
| 65 | 66 | - `--save-position-on-quit` and its associated commands now store state files |
| 66 | 67 | in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows. |
| @@ -2647,6 +2647,11 @@ Property list · 2646 unmodified lines | ||
| 2647 | 2647 | |
| 2648 | 2648 | Has the same sub-properties as ``video-params``. |
| 2649 | 2649 | |
| 2650 | +``video-target-params`` | |
| 2651 | + Same as ``video-params``, but with the target properties that VO outputs to. | |
| 2652 | + | |
| 2653 | + Has the same sub-properties as ``video-params``. | |
| 2654 | + | |
| 2650 | 2655 | ``video-frame-info`` |
| 2651 | 2656 | Approximate information of the current frame. Note that if any of these |
| 2652 | 2657 | are used on OSD, the information might be off by a few frames due to OSD |
| @@ -2439,6 +2439,22 @@ static int mp_property_vo_imgparams(void *ctx, struct m_property *prop, · 2438 unmodified lines | ||
| 2439 | 2439 | return property_imgparams(&p, action, arg); |
| 2440 | 2440 | } |
| 2441 | 2441 | |
| 2442 | +static int mp_property_tgt_imgparams(void *ctx, struct m_property *prop, | |
| 2443 | + int action, void *arg) | |
| 2444 | +{ | |
| 2445 | + MPContext *mpctx = ctx; | |
| 2446 | + struct vo *vo = mpctx->video_out; | |
| 2447 | + if (!mpctx->video_out) | |
| 2448 | + return M_PROPERTY_UNAVAILABLE; | |
| 2449 | + | |
| 2450 | + int valid = m_property_read_sub_validate(ctx, prop, action, arg); | |
| 2451 | + if (valid != M_PROPERTY_VALID) | |
| 2452 | + return valid; | |
| 2453 | + | |
| 2454 | + struct mp_image_params p = vo_get_target_params(vo); | |
| 2455 | + return property_imgparams(&p, action, arg); | |
| 2456 | +} | |
| 2457 | + | |
| 2442 | 2458 | static int mp_property_dec_imgparams(void *ctx, struct m_property *prop, |
| 2443 | 2459 | int action, void *arg) |
| 2444 | 2460 | { |
| @@ -3965,6 +3981,7 @@ static const struct m_property mp_properties_base[] = { · 1520 unmodified lines | ||
| 3965 | 3981 | {"current-ao", mp_property_ao}, |
| 3966 | 3982 | |
| 3967 | 3983 | // Video |
| 3984 | + {"video-target-params", mp_property_tgt_imgparams}, | |
| 3968 | 3985 | {"video-out-params", mp_property_vo_imgparams}, |
| 3969 | 3986 | {"video-dec-params", mp_property_dec_imgparams}, |
| 3970 | 3987 | {"video-params", mp_property_vd_imgparams}, |
| @@ -4107,7 +4124,7 @@ static const char *const *const mp_event_property_change[] = { · 136 unmodified lines | ||
| 4107 | 4124 | "decoder-frame-drop-count", "frame-drop-count", "video-frame-info", |
| 4108 | 4125 | "vf-metadata", "af-metadata", "sub-start", "sub-end", "secondary-sub-start", |
| 4109 | 4126 | "secondary-sub-end", "video-out-params", "video-dec-params", "video-params", |
| 4110 | − "deinterlace-active"), | |
| 4127 | + "deinterlace-active", "video-target-params"), | |
| 4111 | 4128 | E(MP_EVENT_DURATION_UPDATE, "duration"), |
| 4112 | 4129 | E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params", |
| 4113 | 4130 | "video-format", "video-codec", "video-bitrate", "dwidth", "dheight", |
| @@ -614,6 +614,10 @@ static void run_reconfig(void *p) · 613 unmodified lines | ||
| 614 | 614 | mp_mutex_unlock(&vo->params_mutex); |
| 615 | 615 | } |
| 616 | 616 | |
| 617 | + mp_mutex_lock(&vo->params_mutex); | |
| 618 | + talloc_free(vo->target_params); | |
| 619 | + vo->target_params = NULL; | |
| 620 | + mp_mutex_unlock(&vo->params_mutex); | |
| 617 | 621 | mp_mutex_lock(&in->lock); |
| 618 | 622 | talloc_free(in->current_frame); |
| 619 | 623 | in->current_frame = NULL; |
| @@ -1480,3 +1484,13 @@ struct mp_image_params vo_get_current_params(struct vo *vo) · 860 unmodified lines | ||
| 1480 | 1484 | mp_mutex_unlock(&vo->params_mutex); |
| 1481 | 1485 | return p; |
| 1482 | 1486 | } |
| 1487 | + | |
| 1488 | +struct mp_image_params vo_get_target_params(struct vo *vo) | |
| 1489 | +{ | |
| 1490 | + struct mp_image_params p = {0}; | |
| 1491 | + mp_mutex_lock(&vo->params_mutex); | |
| 1492 | + if (vo->target_params) | |
| 1493 | + p = *vo->target_params; | |
| 1494 | + mp_mutex_unlock(&vo->params_mutex); | |
| 1495 | + return p; | |
| 1496 | +} | |
| @@ -481,6 +481,7 @@ struct vo { · 480 unmodified lines | ||
| 481 | 481 | // generic getter is protected by params_mutex. |
| 482 | 482 | mp_mutex params_mutex; |
| 483 | 483 | struct mp_image_params *params; // Configured parameters (changed in vo_reconfig) |
| 484 | + struct mp_image_params *target_params; // Target display parameters | |
| 484 | 485 | |
| 485 | 486 | // --- The following fields can be accessed only by the VO thread, or from |
| 486 | 487 | // anywhere _if_ the VO thread is suspended (use vo->dispatch). |
| @@ -554,5 +555,6 @@ void vo_get_src_dst_rects(struct vo *vo, struct mp_rect *out_src, · 67 unmodified lines | ||
| 554 | 555 | struct vo_frame *vo_frame_ref(struct vo_frame *frame); |
| 555 | 556 | |
| 556 | 557 | struct mp_image_params vo_get_current_params(struct vo *vo); |
| 558 | +struct mp_image_params vo_get_target_params(struct vo *vo); | |
| 557 | 559 | |
| 558 | 560 | #endif /* MPLAYER_VIDEO_OUT_H */ |