diff options
author | sfan5 <sfan5@live.de> | 2024-03-11 20:18:47 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2024-03-16 13:27:34 +0100 |
commit | 2893b7d0f51094bfee0cc27f3bebba8de0fd8018 (patch) | |
tree | 947977494ac60731500b1bc1b59d554cc81e739d | |
parent | 44f54357caed30171b3721527d5d1c8389db6ad9 (diff) | |
download | mpv-2893b7d0f51094bfee0cc27f3bebba8de0fd8018.tar.bz2 mpv-2893b7d0f51094bfee0cc27f3bebba8de0fd8018.tar.xz |
vo: move target_params into responsibility of VO
The VO generic code tries to be helpful and resets this after
each reconfig. However for the simpler VOs the target params
are constant after a reconfig or even for the entire lifetime.
So it's clearly better to let the VO decide.
This also allows the VO to use a static buffer instead.
-rw-r--r-- | video/out/vo.c | 4 | ||||
-rw-r--r-- | video/out/vo.h | 6 | ||||
-rw-r--r-- | video/out/vo_gpu_next.c | 1 |
3 files changed, 5 insertions, 6 deletions
diff --git a/video/out/vo.c b/video/out/vo.c index 319e2c07fb..db29690950 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -614,10 +614,6 @@ 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; diff --git a/video/out/vo.h b/video/out/vo.h index 3deee0d3a7..eb92d4fc5b 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -480,8 +480,10 @@ struct vo { // which are still safe to read in the play loop, but for correctness // 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 + // Configured parameters (changed in vo_reconfig) + struct mp_image_params *params; + // Target display parameters (VO is responsible for re-/setting) + struct mp_image_params *target_params; // --- The following fields can be accessed only by the VO thread, or from // anywhere _if_ the VO thread is suspended (use vo->dispatch). diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 8b6dfa2776..17fdb1a98a 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1221,6 +1221,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) return -1; resize(vo); + TA_FREEP(&vo->target_params); return 0; } |