History

vo: add video-target-params property

Kacper Michajłow committed 3 years ago

Commit da3bfc91 parent a6f661b5 files · +40 −1Browse files

Unified · Split

5 files
  1. DOCS/interface-changes.rst +1 −0
  2. DOCS/man/input.rst +5 −0
  3. player/command.c +18 −1
  4. video/out/vo.c +14 −0
  5. video/out/vo.h +2 −0
DOCS/interface-changes.rst+1−0
@@ -61,6 +61,7 @@ Interface changes · 60 unmodified lines
61 - remove `--alpha` and reintroduce `--background` option for better control61 - remove `--alpha` and reintroduce `--background` option for better control
62 over blending alpha components into specific background types62 over blending alpha components into specific background types
63 - add `--border-background` option63 - add `--border-background` option
64 - add `video-target-params` property
64 --- mpv 0.37.0 ---65 --- mpv 0.37.0 ---
65 - `--save-position-on-quit` and its associated commands now store state files66 - `--save-position-on-quit` and its associated commands now store state files
66 in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.67 in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
DOCS/man/input.rst+5−0
@@ -2647,6 +2647,11 @@ Property list · 2646 unmodified lines
2647 2647
2648 Has the same sub-properties as ``video-params``.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``video-frame-info``2655``video-frame-info``
2651 Approximate information of the current frame. Note that if any of these2656 Approximate information of the current frame. Note that if any of these
2652 are used on OSD, the information might be off by a few frames due to OSD2657 are used on OSD, the information might be off by a few frames due to OSD
player/command.c+18−1
@@ -2439,6 +2439,22 @@ static int mp_property_vo_imgparams(void *ctx, struct m_property *prop, · 2438 unmodified lines
2439 return property_imgparams(&p, action, arg);2439 return property_imgparams(&p, action, arg);
2440}2440}
2441 2441
2442static 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
2442static int mp_property_dec_imgparams(void *ctx, struct m_property *prop,2458static int mp_property_dec_imgparams(void *ctx, struct m_property *prop,
2443 int action, void *arg)2459 int action, void *arg)
2444{2460{
@@ -3965,6 +3981,7 @@ static const struct m_property mp_properties_base[] = { · 1520 unmodified lines
3965 {"current-ao", mp_property_ao},3981 {"current-ao", mp_property_ao},
3966 3982
3967 // Video3983 // Video
3984 {"video-target-params", mp_property_tgt_imgparams},
3968 {"video-out-params", mp_property_vo_imgparams},3985 {"video-out-params", mp_property_vo_imgparams},
3969 {"video-dec-params", mp_property_dec_imgparams},3986 {"video-dec-params", mp_property_dec_imgparams},
3970 {"video-params", mp_property_vd_imgparams},3987 {"video-params", mp_property_vd_imgparams},
@@ -4107,7 +4124,7 @@ static const char *const *const mp_event_property_change[] = { · 136 unmodified lines
4107 "decoder-frame-drop-count", "frame-drop-count", "video-frame-info",4124 "decoder-frame-drop-count", "frame-drop-count", "video-frame-info",
4108 "vf-metadata", "af-metadata", "sub-start", "sub-end", "secondary-sub-start",4125 "vf-metadata", "af-metadata", "sub-start", "sub-end", "secondary-sub-start",
4109 "secondary-sub-end", "video-out-params", "video-dec-params", "video-params",4126 "secondary-sub-end", "video-out-params", "video-dec-params", "video-params",
4110 "deinterlace-active"),4127 "deinterlace-active", "video-target-params"),
4111 E(MP_EVENT_DURATION_UPDATE, "duration"),4128 E(MP_EVENT_DURATION_UPDATE, "duration"),
4112 E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params",4129 E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params",
4113 "video-format", "video-codec", "video-bitrate", "dwidth", "dheight",4130 "video-format", "video-codec", "video-bitrate", "dwidth", "dheight",
video/out/vo.c+14−0
@@ -614,6 +614,10 @@ static void run_reconfig(void *p) · 613 unmodified lines
614 mp_mutex_unlock(&vo->params_mutex);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 mp_mutex_lock(&in->lock);621 mp_mutex_lock(&in->lock);
618 talloc_free(in->current_frame);622 talloc_free(in->current_frame);
619 in->current_frame = NULL;623 in->current_frame = NULL;
@@ -1480,3 +1484,13 @@ struct mp_image_params vo_get_current_params(struct vo *vo) · 860 unmodified lines
1480 mp_mutex_unlock(&vo->params_mutex);1484 mp_mutex_unlock(&vo->params_mutex);
1481 return p;1485 return p;
1482}1486}
1487
1488struct 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}
video/out/vo.h+2−0
@@ -481,6 +481,7 @@ struct vo { · 480 unmodified lines
481 // generic getter is protected by params_mutex.481 // generic getter is protected by params_mutex.
482 mp_mutex params_mutex;482 mp_mutex params_mutex;
483 struct mp_image_params *params; // Configured parameters (changed in vo_reconfig)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 // --- The following fields can be accessed only by the VO thread, or from486 // --- The following fields can be accessed only by the VO thread, or from
486 // anywhere _if_ the VO thread is suspended (use vo->dispatch).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
554struct vo_frame *vo_frame_ref(struct vo_frame *frame);555struct vo_frame *vo_frame_ref(struct vo_frame *frame);
555 556
556struct mp_image_params vo_get_current_params(struct vo *vo);557struct mp_image_params vo_get_current_params(struct vo *vo);
558struct mp_image_params vo_get_target_params(struct vo *vo);
557 559
558#endif /* MPLAYER_VIDEO_OUT_H */560#endif /* MPLAYER_VIDEO_OUT_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t