mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 01:22:30 +00:00
vo: add video-target-params property
This commit is contained in:
parent
a6f661b5c7
commit
da3bfc96e9
@ -61,6 +61,7 @@ Interface changes
|
||||
- remove `--alpha` and reintroduce `--background` option for better control
|
||||
over blending alpha components into specific background types
|
||||
- add `--border-background` option
|
||||
- add `video-target-params` property
|
||||
--- mpv 0.37.0 ---
|
||||
- `--save-position-on-quit` and its associated commands now store state files
|
||||
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
|
||||
|
@ -2647,6 +2647,11 @@ Property list
|
||||
|
||||
Has the same sub-properties as ``video-params``.
|
||||
|
||||
``video-target-params``
|
||||
Same as ``video-params``, but with the target properties that VO outputs to.
|
||||
|
||||
Has the same sub-properties as ``video-params``.
|
||||
|
||||
``video-frame-info``
|
||||
Approximate information of the current frame. Note that if any of these
|
||||
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,
|
||||
return property_imgparams(&p, action, arg);
|
||||
}
|
||||
|
||||
static int mp_property_tgt_imgparams(void *ctx, struct m_property *prop,
|
||||
int action, void *arg)
|
||||
{
|
||||
MPContext *mpctx = ctx;
|
||||
struct vo *vo = mpctx->video_out;
|
||||
if (!mpctx->video_out)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
|
||||
int valid = m_property_read_sub_validate(ctx, prop, action, arg);
|
||||
if (valid != M_PROPERTY_VALID)
|
||||
return valid;
|
||||
|
||||
struct mp_image_params p = vo_get_target_params(vo);
|
||||
return property_imgparams(&p, action, arg);
|
||||
}
|
||||
|
||||
static int mp_property_dec_imgparams(void *ctx, struct m_property *prop,
|
||||
int action, void *arg)
|
||||
{
|
||||
@ -3965,6 +3981,7 @@ static const struct m_property mp_properties_base[] = {
|
||||
{"current-ao", mp_property_ao},
|
||||
|
||||
// Video
|
||||
{"video-target-params", mp_property_tgt_imgparams},
|
||||
{"video-out-params", mp_property_vo_imgparams},
|
||||
{"video-dec-params", mp_property_dec_imgparams},
|
||||
{"video-params", mp_property_vd_imgparams},
|
||||
@ -4107,7 +4124,7 @@ static const char *const *const mp_event_property_change[] = {
|
||||
"decoder-frame-drop-count", "frame-drop-count", "video-frame-info",
|
||||
"vf-metadata", "af-metadata", "sub-start", "sub-end", "secondary-sub-start",
|
||||
"secondary-sub-end", "video-out-params", "video-dec-params", "video-params",
|
||||
"deinterlace-active"),
|
||||
"deinterlace-active", "video-target-params"),
|
||||
E(MP_EVENT_DURATION_UPDATE, "duration"),
|
||||
E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params",
|
||||
"video-format", "video-codec", "video-bitrate", "dwidth", "dheight",
|
||||
|
@ -614,6 +614,10 @@ static void run_reconfig(void *p)
|
||||
mp_mutex_unlock(&vo->params_mutex);
|
||||
}
|
||||
|
||||
mp_mutex_lock(&vo->params_mutex);
|
||||
talloc_free(vo->target_params);
|
||||
vo->target_params = NULL;
|
||||
mp_mutex_unlock(&vo->params_mutex);
|
||||
mp_mutex_lock(&in->lock);
|
||||
talloc_free(in->current_frame);
|
||||
in->current_frame = NULL;
|
||||
@ -1480,3 +1484,13 @@ struct mp_image_params vo_get_current_params(struct vo *vo)
|
||||
mp_mutex_unlock(&vo->params_mutex);
|
||||
return p;
|
||||
}
|
||||
|
||||
struct mp_image_params vo_get_target_params(struct vo *vo)
|
||||
{
|
||||
struct mp_image_params p = {0};
|
||||
mp_mutex_lock(&vo->params_mutex);
|
||||
if (vo->target_params)
|
||||
p = *vo->target_params;
|
||||
mp_mutex_unlock(&vo->params_mutex);
|
||||
return p;
|
||||
}
|
||||
|
@ -481,6 +481,7 @@ struct vo {
|
||||
// generic getter is protected by params_mutex.
|
||||
mp_mutex params_mutex;
|
||||
struct mp_image_params *params; // Configured parameters (changed in vo_reconfig)
|
||||
struct mp_image_params *target_params; // Target display parameters
|
||||
|
||||
// --- The following fields can be accessed only by the VO thread, or from
|
||||
// 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,
|
||||
struct vo_frame *vo_frame_ref(struct vo_frame *frame);
|
||||
|
||||
struct mp_image_params vo_get_current_params(struct vo *vo);
|
||||
struct mp_image_params vo_get_target_params(struct vo *vo);
|
||||
|
||||
#endif /* MPLAYER_VIDEO_OUT_H */
|
||||
|
Loading…
Reference in New Issue
Block a user