diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-11-07 00:52:56 +0100 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-11-08 21:45:07 +0000 |
commit | 477a0f83184d18a5cd89261b5f81ee668c7f4441 (patch) | |
tree | 73f7ffb96a1799fa390394b0435a08ec92d78ca8 /player/video.c | |
parent | a96d26e63a78d6325ed0238a24d8bd4a66519d19 (diff) | |
download | mpv-477a0f83184d18a5cd89261b5f81ee668c7f4441.tar.bz2 mpv-477a0f83184d18a5cd89261b5f81ee668c7f4441.tar.xz |
vo: replace VOCTRL_HDR_METADATA with direct VO params read
Currently VOCTRL are completely unusable for frequent data query. Since
the HDR parameter addition to video-params, the parameters can change
each frame. In which case observe on those parameter would be triggered
constantly. The problem is that quering those parameters involves VOCTRL
which in turn involves whole render cycle of delay.
Instead update VO params on each draw_frame. This requires changes to VO
reconfiguration condition, but in practice it should only be triggered
when image size or data layout changes. In other cases it will be
handled internal by VO driver.
I'm not quite happy with this solution, but don't see better one without
changing observe/notify logic significantly. There is no good way
currently to handle VOCTRL that are constantly queried.
This adds unfortunate synchronization of player command with VO thread,
but there is not way around that and if too frequent queries of this
param becomes a problem we can thing of other solutions.
Changes the way to get data from VO driver added by a98c5328dc
Fixes: 84de84b
Fixes: #12825
Diffstat (limited to 'player/video.c')
-rw-r--r-- | player/video.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/player/video.c b/player/video.c index 9ec2f5333e..6d16f675ef 100644 --- a/player/video.c +++ b/player/video.c @@ -1034,6 +1034,19 @@ static void apply_video_crop(struct MPContext *mpctx, struct vo *vo) } } +static bool video_reconfig_needed(const struct mp_image_params *p1, + const struct mp_image_params *p2) +{ + return p1->imgfmt != p2->imgfmt || + p1->hw_subfmt != p2->hw_subfmt || + p1->w != p2->w || p1->h != p2->h || + p1->p_w != p2->p_w || p1->p_h != p2->p_h || + p1->force_window != p2->force_window || + p1->rotate != p2->rotate || + p1->stereo3d != p2->stereo3d || + !mp_rect_equals(&p1->crop, &p2->crop); +} + void write_video(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; @@ -1156,7 +1169,7 @@ void write_video(struct MPContext *mpctx) // Filter output is different from VO input? struct mp_image_params *p = &mpctx->next_frames[0]->params; - if (!vo->params || !mp_image_params_equal(p, vo->params)) { + if (!vo->params || video_reconfig_needed(p, vo->params)) { // Changing config deletes the current frame; wait until it's finished. if (vo_still_displaying(vo)) return; |