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.
This commit is contained in:
sfan5 2024-03-11 20:18:47 +01:00
parent 44f54357ca
commit 2893b7d0f5
3 changed files with 5 additions and 6 deletions

View File

@ -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;

View File

@ -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).

View File

@ -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;
}