libobs: Remove "presentation volume" and "base volume" (skip)

(Note: This commit breaks libobs compilation.  Skip if bisecting)

These variables are considered obsolete and will no longer be needed.
master
jp9000 2015-12-20 02:06:01 -08:00
parent 73ec5906b7
commit a5c9350be5
5 changed files with 0 additions and 143 deletions

View File

@ -268,7 +268,6 @@ struct obs_core_audio {
audio_t *audio;
float user_volume;
float present_volume;
};
/* user sources, output channels, and displays */
@ -512,9 +511,7 @@ struct obs_source {
struct obs_audio_data audio_data;
size_t audio_storage_size;
uint32_t audio_mixers;
float base_volume;
float user_volume;
float present_volume;
int64_t sync_offset;
/* async video data */

View File

@ -139,8 +139,6 @@ bool obs_source_init(struct obs_source *source,
pthread_mutexattr_t attr;
source->user_volume = 1.0f;
source->present_volume = 1.0f;
source->base_volume = 0.0f;
source->sync_offset = 0;
pthread_mutex_init_value(&source->filter_mutex);
pthread_mutex_init_value(&source->async_mutex);
@ -2629,33 +2627,12 @@ void obs_source_set_volume(obs_source_t *source, float volume)
}
}
static void set_tree_preset_vol(obs_source_t *parent, obs_source_t *child,
void *param)
{
float *vol = param;
child->present_volume = *vol;
UNUSED_PARAMETER(parent);
}
void obs_source_set_present_volume(obs_source_t *source, float volume)
{
if (obs_source_valid(source, "obs_source_set_present_volume"))
source->present_volume = volume;
}
float obs_source_get_volume(const obs_source_t *source)
{
return obs_source_valid(source, "obs_source_get_volume") ?
source->user_volume : 0.0f;
}
float obs_source_get_present_volume(const obs_source_t *source)
{
return obs_source_valid(source, "obs_source_get_present_volume") ?
source->present_volume : 0.0f;
}
void obs_source_set_sync_offset(obs_source_t *source, int64_t offset)
{
if (obs_source_valid(source, "obs_source_set_sync_offset")) {
@ -2961,77 +2938,6 @@ void obs_source_draw(gs_texture_t *texture, int x, int y, uint32_t cx,
gs_matrix_pop();
}
static inline float get_transition_volume(obs_source_t *source,
obs_source_t *child)
{
if (source && child && source->info.get_transition_volume)
return source->info.get_transition_volume(source->context.data,
child);
return 0.0f;
}
static float obs_source_get_target_volume_refs(obs_source_t *source,
obs_source_t *target, int refs);
struct base_vol_enum_info {
obs_source_t *target;
float vol;
};
static void get_transition_child_vol(obs_source_t *parent, obs_source_t *child,
void *param)
{
struct base_vol_enum_info *info = param;
float vol = obs_source_get_target_volume(child, info->target);
info->vol += vol * get_transition_volume(parent, child);
}
static void get_source_base_vol(obs_source_t *parent, obs_source_t *child,
void *param)
{
struct base_vol_enum_info *info = param;
float vol = obs_source_get_target_volume(child, info->target);
if (vol > info->vol)
info->vol = vol;
UNUSED_PARAMETER(parent);
}
/*
* This traverses a source tree for any references to a particular source.
* If the source is found, it'll just return 1.0. However, if the source
* exists within some transition somewhere, the transition source will be able
* to control what the volume of the source will be. If the source is also
* active outside the transition, then it'll just use 1.0.
*/
float obs_source_get_target_volume(obs_source_t *source, obs_source_t *target)
{
struct base_vol_enum_info info = {target, 0.0f};
bool transition;
if (!obs_source_valid(source, "obs_source_get_target_volume"))
return 0.0f;
if (!obs_ptr_valid(target, "obs_source_get_target_volume"))
return 0.0f;
transition = source->info.type == OBS_SOURCE_TYPE_TRANSITION;
if (source == target)
return 1.0f;
if (source->info.enum_active_sources) {
source->info.enum_active_sources(source->context.data,
transition ?
get_transition_child_vol :
get_source_base_vol,
&info);
}
return info.vol;
}
void obs_source_inc_showing(obs_source_t *source)
{
if (obs_source_valid(source, "obs_source_inc_showing"))

View File

@ -21,20 +21,9 @@
#include "media-io/format-conversion.h"
#include "media-io/video-frame.h"
static inline void calculate_base_volume(struct obs_core_data *data,
struct obs_view *view, obs_source_t *target)
{
if (!target->activate_refs) {
target->base_volume = 0.0f;
} else {
target->base_volume = 1.0f;
}
}
static uint64_t tick_sources(uint64_t cur_time, uint64_t last_time)
{
struct obs_core_data *data = &obs->data;
struct obs_view *view = &data->main_view;
struct obs_source *source;
uint64_t delta_time;
float seconds;
@ -55,17 +44,6 @@ static uint64_t tick_sources(uint64_t cur_time, uint64_t last_time)
source = (struct obs_source*)source->context.next;
}
/* calculate source volumes */
pthread_mutex_lock(&view->channels_mutex);
source = data->first_source;
while (source) {
calculate_base_volume(data, view, source);
source = (struct obs_source*)source->context.next;
}
pthread_mutex_unlock(&view->channels_mutex);
pthread_mutex_unlock(&data->sources_mutex);
return cur_time;

View File

@ -466,7 +466,6 @@ static bool obs_init_audio(struct audio_output_info *ai)
/* TODO: sound subsystem */
audio->user_volume = 1.0f;
audio->present_volume = 1.0f;
errorcode = audio_output_open(&audio->audio, ai);
if (errorcode == AUDIO_OUTPUT_SUCCESS)
@ -1381,22 +1380,11 @@ void obs_set_master_volume(float volume)
obs->audio.user_volume = volume;
}
void obs_set_present_volume(float volume)
{
if (!obs) return;
obs->audio.present_volume = volume;
}
float obs_get_master_volume(void)
{
return obs ? obs->audio.user_volume : 0.0f;
}
float obs_get_present_volume(void)
{
return obs ? obs->audio.present_volume : 0.0f;
}
static obs_source_t *obs_load_source_type(obs_data_t *source_data,
enum obs_source_type type)
{

View File

@ -539,15 +539,9 @@ EXPORT void obs_render_main_view(void);
/** Sets the master user volume */
EXPORT void obs_set_master_volume(float volume);
/** Sets the master presentation volume */
EXPORT void obs_set_present_volume(float volume);
/** Gets the master user volume */
EXPORT float obs_get_master_volume(void);
/** Gets the master presentation volume */
EXPORT float obs_get_present_volume(void);
/** Saves a source to settings data */
EXPORT obs_data_t *obs_save_source(obs_source_t *source);
@ -760,15 +754,9 @@ EXPORT proc_handler_t *obs_source_get_proc_handler(const obs_source_t *source);
/** Sets the user volume for a source that has audio output */
EXPORT void obs_source_set_volume(obs_source_t *source, float volume);
/** Sets the presentation volume for a source */
EXPORT void obs_source_set_present_volume(obs_source_t *source, float volume);
/** Gets the user volume for a source that has audio output */
EXPORT float obs_source_get_volume(const obs_source_t *source);
/** Gets the presentation volume for a source */
EXPORT float obs_source_get_present_volume(const obs_source_t *source);
/** Sets the audio sync offset (in nanoseconds) for a source */
EXPORT void obs_source_set_sync_offset(obs_source_t *source, int64_t offset);