1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 21:06:00 +00:00
mpv/misc
wm4 d2bdb72b69 options: add a thread-safe way to notify option updates
So far, we had a thread-safe way to read options, but no option update
notification mechanism. Everything was funneled though the main thread's
central mp_option_change_callback() function. For example, if the
panscan options were changed, the function called vo_control() with
VOCTRL_SET_PANSCAN to manually notify the VO thread of updates. This
worked, but's pretty inconvenient. Most of these problems come from the
fact that MPlayer was written as a single-threaded program.

This commit works towards a more flexible mechanism. It adds an update
callback to m_config_cache (the thing that is already used for
thread-safe access of global options).

This alone would still be rather inconvenient, at least in context of
VOs. Add another mechanism on top of it that uses mp_dispatch_queue, and
takes care of some annoying synchronization issues. We extend
mp_dispatch_queue itself to make this easier and slightly more
efficient.

As a first application, use this to reimplement certain VO scaling and
renderer options. The update_opts() function translates these to the
"old" VOCTRLs, though.

An annoyingly subtle issue is that m_config_cache's destructor now
releases pending notifications, and must be released before the
associated dispatch queue. Otherwise, it could happen that option
updates during e.g. VO destruction queue or run stale entries, which is
not expected.

Rather untested. The singly-linked list code in dispatch.c is probably
buggy, and I bet some aspects about synchronization are not entirely
sane.
2017-08-22 15:50:33 +02:00
..
bstr.c vo_opengl: support loading custom user textures 2017-07-27 23:51:05 +02:00
bstr.h bstr: short-circuit bstr_equals on pointer equality 2017-08-03 21:48:25 +02:00
charset_conv.c osx: consistent normalisation when searching for external files 2017-02-02 16:21:04 +01:00
charset_conv.h osx: consistent normalisation when searching for external files 2017-02-02 16:21:04 +01:00
ctype.h
dispatch.c options: add a thread-safe way to notify option updates 2017-08-22 15:50:33 +02:00
dispatch.h options: add a thread-safe way to notify option updates 2017-08-22 15:50:33 +02:00
json.c misc/json: avoid redundant condition 2017-07-01 15:09:21 +01:00
json.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
node.c misc: add some annoying mpv_node helpers 2016-08-28 19:39:05 +02:00
node.h misc: add some annoying mpv_node helpers 2016-08-28 19:39:05 +02:00
rendezvous.c
rendezvous.h
ring.c misc/ring: fix comment typo 2017-07-09 13:46:13 -07:00
ring.h Relicense some non-MPlayer source files to LGPL 2.1 or later 2016-01-19 18:36:06 +01:00
thread_pool.c misc: add a thread pool 2017-04-01 20:32:01 +02:00
thread_pool.h misc: add a thread pool 2017-04-01 20:32:01 +02:00