summaryrefslogtreecommitdiffstats
path: root/video/out/vo.h
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-09 03:18:48 +0100
committersfan5 <sfan5@live.de>2023-11-22 11:51:46 +0100
commit5220725ca506bc40f1f0c3f0507fa337605f1dba (patch)
treef952b607224626fa878c6bd4b43492277d16db5e /video/out/vo.h
parent67deebc5b5cf9f00f43e0126213fcae05335dd48 (diff)
downloadmpv-5220725ca506bc40f1f0c3f0507fa337605f1dba.tar.bz2
mpv-5220725ca506bc40f1f0c3f0507fa337605f1dba.tar.xz
vo: add params mutex
This mostly is added to resolve player command synchronization with VO thread discussed in 477a0f83. The current uses does not necessarily need this as they are all managed by playloop. But for future use with other params that will be handy. Those params are mostly to observe current state of VO and does not necessarly need to be locked along with frame drawing, that changes the params once at the end.
Diffstat (limited to 'video/out/vo.h')
-rw-r--r--video/out/vo.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/video/out/vo.h b/video/out/vo.h
index e38dcf8010..40c5746992 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -29,6 +29,7 @@
#include "video/img_format.h"
#include "common/common.h"
#include "options/options.h"
+#include "osdep/threads.h"
enum {
// VO needs to redraw
@@ -470,7 +471,14 @@ struct vo {
// be accessed unsynchronized (read-only).
int config_ok; // Last config call was successful?
- struct mp_image_params *params; // Configured parameters (as in vo_reconfig)
+
+ // --- The following fields are synchronized by params_mutex, most of
+ // the params are set only in the vo_reconfig and safe to read
+ // unsynchronized. Some of the parameters are updated in draw_frame,
+ // 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)
// --- The following fields can be accessed only by the VO thread, or from
// anywhere _if_ the VO thread is suspended (use vo->dispatch).