mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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 bya98c5328dcFixes:84de84bFixes: #12825
This commit is contained in:
committed by
Dudemanguy
parent
a96d26e63a
commit
477a0f8318
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user