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
6161 - remove `--alpha` and reintroduce `--background` option for better control
6262 over blending alpha components into specific background types
6363 - add `--border-background` option
64+ - add `video-target-params` property
6465 --- mpv 0.37.0 ---
6566 - `--save-position-on-quit` and its associated commands now store state files
6667 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
26472647
26482648 Has the same sub-properties as ``video-params``.
26492649
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+
26502655 ``video-frame-info``
26512656 Approximate information of the current frame. Note that if any of these
26522657 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
24392439 return property_imgparams(&p, action, arg);
24402440 }
24412441
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+
24422458 static int mp_property_dec_imgparams(void *ctx, struct m_property *prop,
24432459 int action, void *arg)
24442460 {
@@ -3965,6 +3981,7 @@ static const struct m_property mp_properties_base[] = { · 1520 unmodified lines
39653981 {"current-ao", mp_property_ao},
39663982
39673983 // Video
3984+ {"video-target-params", mp_property_tgt_imgparams},
39683985 {"video-out-params", mp_property_vo_imgparams},
39693986 {"video-dec-params", mp_property_dec_imgparams},
39703987 {"video-params", mp_property_vd_imgparams},
@@ -4107,7 +4124,7 @@ static const char *const *const mp_event_property_change[] = { · 136 unmodified lines
41074124 "decoder-frame-drop-count", "frame-drop-count", "video-frame-info",
41084125 "vf-metadata", "af-metadata", "sub-start", "sub-end", "secondary-sub-start",
41094126 "secondary-sub-end", "video-out-params", "video-dec-params", "video-params",
4110− "deinterlace-active"),
4127+ "deinterlace-active", "video-target-params"),
41114128 E(MP_EVENT_DURATION_UPDATE, "duration"),
41124129 E(MPV_EVENT_VIDEO_RECONFIG, "video-out-params", "video-params",
41134130 "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
614614 mp_mutex_unlock(&vo->params_mutex);
615615 }
616616
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);
617621 mp_mutex_lock(&in->lock);
618622 talloc_free(in->current_frame);
619623 in->current_frame = NULL;
@@ -1480,3 +1484,13 @@ struct mp_image_params vo_get_current_params(struct vo *vo) · 860 unmodified lines
14801484 mp_mutex_unlock(&vo->params_mutex);
14811485 return p;
14821486 }
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+}
video/out/vo.h+2−0
@@ -481,6 +481,7 @@ struct vo { · 480 unmodified lines
481481 // generic getter is protected by params_mutex.
482482 mp_mutex params_mutex;
483483 struct mp_image_params *params; // Configured parameters (changed in vo_reconfig)
484+ struct mp_image_params *target_params; // Target display parameters
484485
485486 // --- The following fields can be accessed only by the VO thread, or from
486487 // 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
554555 struct vo_frame *vo_frame_ref(struct vo_frame *frame);
555556
556557 struct mp_image_params vo_get_current_params(struct vo *vo);
558+struct mp_image_params vo_get_target_params(struct vo *vo);
557559
558560 #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