When we moved the code to use the legacy method *or* the new method,
we lost the functionality that actually initialized the memory allocated
for the entire subpicture region (including the part where captions
weren't being rendered.
This was most obvious when regression testing on OSX, where it
resulted in old captions continuing to appear on screen even
after being cleared, or garbage in the render buffer.
Add a line that effectively zeros out the buffer prior to use.
This does not support hot plug and unplug of devices.
Also, it prevented selecting a device not in the choices list due to
checks in the variables subsystem. (At least with ALSA, not all valid
devices are included in the suggestions.)
Using var_Set("device") is wrong: the "device" variable holds the
currently used output device (as set by the aout plugin), not the
intended output device (as requested through the user interface).
David Fuhrmann [Sat, 12 Jan 2013 15:29:26 +0000 (16:29 +0100)]
macosx: fix and improve window level handling
- fix behavior of video-on-top by adapting to vout windows handling changes
- set all windows to status level if one vout window has this level:
This avoids that video effects panel, audio efffects panel etc. pp. are opened behind
a vout window. Now they can be used as usual.
Please note, that due to the type of these panels they do not remain visible
when VLC gets inactive.
Don't call the legacy Freetype background renderer if the EIA-608 bg render feature is used.
If we're using the new background renderer which just renders the
background under the text (instead of the entire subpicture block),
then don't call the legacy render as well. This prevents a alpha-
transparent box from being shown when rendering EIA-608 captions
if the user has the Freetype background opacity set to a nonzero
value.
Add support for rendering EIA-608 captions with a black background
Place a black background behind caption text. We cannot use the
existing "background" feature for subdecoders because it fills the
entire subpicture block, and in the case of the EIA-608 decoder
would result in a large square (since we send all lines to
the subpicture decoder even if they are blank). This approach
allows for rendering of the background even in such cases, while
preserving proper layout of the captions.
Josh Watzman [Sun, 6 Jan 2013 20:28:57 +0000 (12:28 -0800)]
macosx: call input_changed in extensions
This is obnoxiously complicated. If anyone cares about playing_changed or
meta_changed, something similar will probably have to be done.
This is a pretty bizarre two-step system to inform the extension manager
that the input has changed, but it's necessary to avoid a series of
possible deadlocks and other issues. Here are other possible approaches
that don't work:
- Just call into the extension manager in -PlaylistItemChanged on the
main thread. This can pretty easily cause a deadlock if we call
-PlaylistItemChanged twice in quick succession. The first call will poke
the condvar the extension is waiting on, causing the extension thread to
wake up and run extension code; many parts of it -- including the dialog
code -- must be run on the main thread. The extension thread goes back to
sleep while blocking on the main thread to become available, while
holding the extension lock. Meanwhile the main thread goes into the
second call of -PlaylistItemChanged, attempts to lock the extension, and
that's a deadlock.
- Restructure the dialog manager to never block on the main thread while
holding the extension lock. This should work, but as it turns out doesn't
because the main thread will attempt to lock the same lock twice. What
happens is that -performSelectorOnMainThread works by injecting an event
into the main event loop of the main thread. For some unknown reason, as
part of its processing, when creating an NSAttributedString with HTML, it
runs the main event loop, which means we can end up executing one
-performSelectoOnMainThread as part of another. Since the dialog manager
uses attributed strings with HTML (since dialogs are HTML), we deadlock
here too. This seems strictly like a flaw in NSAttributedString and/or
in -performSelectorOnMainThread and is documented elsewhere:
http://mrrsoftware.com/blog/tag/nsattributedstring/
https://www.bluestatic.org/blog/2010/05/31/nsattributedstring-spins-a-nested-run-loop/
- Change around this bit of code to not force it to run on the main
thread. This would probably work, but, as a newcomer to VLC, I don't
quite know the implications of doing this, particularly since a lot of
code here seems to serailize on the main thread as a way of thread
safety; it would likely require some somewhat intricate restructuring
and adding of locks.
- Let the extension manager deal with listening for events the same way
that we do here. That would work, but would require duplicating a
nontrivial amount of code from here to deal with tracking the current
input.
- So, instead, we just serialized all calls to -PlaylistItemChanged (so
we make sure to process them in order, with no one trampling
p_input_changed), do most of the work on the main thread as before, and
then actually inform the extension manager out here where we don't block
the main thread. It seems likely that there are other pre-existing
deadlock possibilities here -- the main thread can't lock an extension!
-- but it at least tends to work in my testing.
Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Josh Watzman [Sun, 6 Jan 2013 07:27:18 +0000 (23:27 -0800)]
macosx: Don't re-center extensions on every dialog update
If the user has moved the extension dialog, we don't want to re-center it on every single update -- many extensions update their dialogs on every input change, and this behavior can cause the extension dialog to keep re-overlapping with the video, which is very frustrating.
Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>