diff options
author | wm4 <wm4@nowhere> | 2017-08-22 15:50:33 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-08-22 15:50:33 +0200 |
commit | d2bdb72b69536370c3046107fc593896e74803c3 (patch) | |
tree | 09d5913f981ee5f5e0d43fbfd24b06f67eb8dd5e /audio/out/ao.c | |
parent | 5361c0b5d897ec7c969d2a75bb2dde345d62a59c (diff) | |
download | mpv-d2bdb72b69536370c3046107fc593896e74803c3.tar.bz2 mpv-d2bdb72b69536370c3046107fc593896e74803c3.tar.xz |
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.
Diffstat (limited to 'audio/out/ao.c')
0 files changed, 0 insertions, 0 deletions