Implement source activation/deactivation

Now sources will be properly activated and deactivated when they are in
use or not in use.

Had to figure out a way to handle child sources, and children of
children, just ended up implementing simple functions that parents use
to signal adding/removal to help with hierarchial activation and
deactivation of child sources.

To prevent the source activate/deactivate callbacks from being called
more than once, added an activation reference counter.  The first
increment will call the activate callback, and the last decrement will
call the deactivate callback.

Added "source-activate" and "source-deactivate" signals to the main obs
signal handler, and "activate" and "deactivate" to individual source
signal handlers.

Also, fixed the main window so it properly selects a source when the
current active scene has been changed.
This commit is contained in:
jp9000
2014-02-20 22:04:14 -07:00
parent 14c95ac421
commit d4f1eacc1f
8 changed files with 141 additions and 24 deletions

View File

@@ -678,10 +678,15 @@ void obs_set_output_source(uint32_t channel, obs_source_t source)
view->channels[channel] = source;
if (source)
if (source) {
obs_source_addref(source);
if (prev_source)
obs_source_activate(source);
}
if (prev_source) {
obs_source_deactivate(prev_source);
obs_source_release(prev_source);
}
pthread_mutex_unlock(&view->channels_mutex);
}