New upstream version 22.0.3+dfsg1
This commit is contained in:
parent
665f64a933
commit
cdc9a9fc87
334 changed files with 14525 additions and 2639 deletions
169
libobs/obs.c
169
libobs/obs.c
|
|
@ -218,7 +218,7 @@ static bool obs_init_textures(struct obs_video_info *ovi)
|
|||
gs_effect_t *obs_load_effect(gs_effect_t **effect, const char *file)
|
||||
{
|
||||
if (!*effect) {
|
||||
char *filename = find_libobs_data_file(file);
|
||||
char *filename = obs_find_data_file(file);
|
||||
*effect = gs_effect_create_from_file(filename, NULL);
|
||||
bfree(filename);
|
||||
}
|
||||
|
|
@ -250,49 +250,49 @@ static int obs_init_graphics(struct obs_video_info *ovi)
|
|||
|
||||
gs_enter_context(video->graphics);
|
||||
|
||||
char *filename = find_libobs_data_file("default.effect");
|
||||
char *filename = obs_find_data_file("default.effect");
|
||||
video->default_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
if (gs_get_device_type() == GS_DEVICE_OPENGL) {
|
||||
filename = find_libobs_data_file("default_rect.effect");
|
||||
filename = obs_find_data_file("default_rect.effect");
|
||||
video->default_rect_effect = gs_effect_create_from_file(
|
||||
filename, NULL);
|
||||
bfree(filename);
|
||||
}
|
||||
|
||||
filename = find_libobs_data_file("opaque.effect");
|
||||
filename = obs_find_data_file("opaque.effect");
|
||||
video->opaque_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
filename = find_libobs_data_file("solid.effect");
|
||||
filename = obs_find_data_file("solid.effect");
|
||||
video->solid_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
filename = find_libobs_data_file("format_conversion.effect");
|
||||
filename = obs_find_data_file("format_conversion.effect");
|
||||
video->conversion_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
filename = find_libobs_data_file("bicubic_scale.effect");
|
||||
filename = obs_find_data_file("bicubic_scale.effect");
|
||||
video->bicubic_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
filename = find_libobs_data_file("lanczos_scale.effect");
|
||||
filename = obs_find_data_file("lanczos_scale.effect");
|
||||
video->lanczos_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
filename = find_libobs_data_file("bilinear_lowres_scale.effect");
|
||||
filename = obs_find_data_file("bilinear_lowres_scale.effect");
|
||||
video->bilinear_lowres_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
||||
filename = find_libobs_data_file("premultiplied_alpha.effect");
|
||||
filename = obs_find_data_file("premultiplied_alpha.effect");
|
||||
video->premultiplied_alpha_effect = gs_effect_create_from_file(filename,
|
||||
NULL);
|
||||
bfree(filename);
|
||||
|
|
@ -565,6 +565,7 @@ static bool obs_init_data(void)
|
|||
if (!obs_view_init(&data->main_view))
|
||||
goto fail;
|
||||
|
||||
data->private_data = obs_data_create();
|
||||
data->valid = true;
|
||||
|
||||
fail:
|
||||
|
|
@ -620,6 +621,7 @@ static void obs_free_data(void)
|
|||
pthread_mutex_destroy(&data->draw_callbacks_mutex);
|
||||
da_free(data->draw_callbacks);
|
||||
da_free(data->tick_callbacks);
|
||||
obs_data_release(data->private_data);
|
||||
}
|
||||
|
||||
static const char *obs_signals[] = {
|
||||
|
|
@ -741,6 +743,7 @@ static inline void obs_free_hotkeys(void)
|
|||
}
|
||||
|
||||
extern const struct obs_source_info scene_info;
|
||||
extern const struct obs_source_info group_info;
|
||||
|
||||
extern void log_system_info(void);
|
||||
|
||||
|
|
@ -771,16 +774,60 @@ static bool obs_init(const char *locale, const char *module_config_path,
|
|||
obs->module_config_path = bstrdup(module_config_path);
|
||||
obs->locale = bstrdup(locale);
|
||||
obs_register_source(&scene_info);
|
||||
obs_register_source(&group_info);
|
||||
add_default_module_paths();
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
extern void initialize_crash_handler(void);
|
||||
extern void initialize_com(void);
|
||||
extern void uninitialize_com(void);
|
||||
#endif
|
||||
|
||||
/* Separate from actual context initialization
|
||||
* since this can be set before startup and persist
|
||||
* after shutdown. */
|
||||
static DARRAY(struct dstr) core_module_paths = {0};
|
||||
|
||||
char *obs_find_data_file(const char *file)
|
||||
{
|
||||
struct dstr path = {0};
|
||||
|
||||
char *result = find_libobs_data_file(file);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
for (size_t i = 0; i < core_module_paths.num; ++i) {
|
||||
if (check_path(file, core_module_paths.array[i].array, &path))
|
||||
return path.array;
|
||||
}
|
||||
|
||||
dstr_free(&path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void obs_add_data_path(const char *path)
|
||||
{
|
||||
struct dstr *new_path = da_push_back_new(core_module_paths);
|
||||
dstr_init_copy(new_path, path);
|
||||
da_push_back(core_module_paths, new_path);
|
||||
}
|
||||
|
||||
bool obs_remove_data_path(const char *path)
|
||||
{
|
||||
for (size_t i = 0; i < core_module_paths.num; ++i) {
|
||||
int result = dstr_cmp(&core_module_paths.array[i], path);
|
||||
|
||||
if (result == 0) {
|
||||
dstr_free(&core_module_paths.array[i]);
|
||||
da_erase(core_module_paths, i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char *obs_startup_name = "obs_startup";
|
||||
bool obs_startup(const char *locale, const char *module_config_path,
|
||||
profiler_name_store_t *store)
|
||||
|
|
@ -795,7 +842,6 @@ bool obs_startup(const char *locale, const char *module_config_path,
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
initialize_crash_handler();
|
||||
initialize_com();
|
||||
#endif
|
||||
|
||||
|
|
@ -1262,10 +1308,14 @@ void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t*), void *param)
|
|||
obs_source_t *next_source =
|
||||
(obs_source_t*)source->context.next;
|
||||
|
||||
if ((source->info.type == OBS_SOURCE_TYPE_INPUT) != 0 &&
|
||||
!source->context.private &&
|
||||
!enum_proc(param, source))
|
||||
if (source->info.id == group_info.id &&
|
||||
!enum_proc(param, source)) {
|
||||
break;
|
||||
} else if (source->info.type == OBS_SOURCE_TYPE_INPUT &&
|
||||
!source->context.private &&
|
||||
!enum_proc(param, source)) {
|
||||
break;
|
||||
}
|
||||
|
||||
source = next_source;
|
||||
}
|
||||
|
|
@ -1468,6 +1518,23 @@ void obs_render_main_texture(void)
|
|||
gs_draw_sprite(tex, 0, 0, 0);
|
||||
}
|
||||
|
||||
gs_texture_t *obs_get_main_texture(void)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
int last_tex;
|
||||
|
||||
if (!obs) return NULL;
|
||||
|
||||
last_tex = video->cur_texture == 0
|
||||
? NUM_TEXTURES - 1
|
||||
: video->cur_texture - 1;
|
||||
|
||||
if (!video->textures_rendered[last_tex])
|
||||
return NULL;
|
||||
|
||||
return video->render_textures[last_tex];
|
||||
}
|
||||
|
||||
void obs_set_master_volume(float volume)
|
||||
{
|
||||
struct calldata data = {0};
|
||||
|
|
@ -1627,7 +1694,8 @@ void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb,
|
|||
if (source->info.type == OBS_SOURCE_TYPE_TRANSITION)
|
||||
obs_transition_load(source, source_data);
|
||||
obs_source_load(source);
|
||||
cb(private_data, source);
|
||||
if (cb)
|
||||
cb(private_data, source);
|
||||
}
|
||||
obs_data_release(source_data);
|
||||
}
|
||||
|
|
@ -1950,7 +2018,7 @@ bool obs_set_audio_monitoring_device(const char *name, const char *id)
|
|||
if (!obs || !name || !id || !*name || !*id)
|
||||
return false;
|
||||
|
||||
#if defined(_WIN32) || HAVE_PULSEAUDIO
|
||||
#if defined(_WIN32) || HAVE_PULSEAUDIO || defined(__APPLE__)
|
||||
pthread_mutex_lock(&obs->audio.monitoring_mutex);
|
||||
|
||||
if (strcmp(id, obs->audio.monitoring_device_id) == 0) {
|
||||
|
|
@ -2054,3 +2122,70 @@ uint32_t obs_get_lagged_frames(void)
|
|||
{
|
||||
return obs ? obs->video.lagged_frames : 0;
|
||||
}
|
||||
|
||||
void start_raw_video(video_t *v, const struct video_scale_info *conversion,
|
||||
void (*callback)(void *param, struct video_data *frame),
|
||||
void *param)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
os_atomic_inc_long(&video->raw_active);
|
||||
video_output_connect(v, conversion, callback, param);
|
||||
}
|
||||
|
||||
void stop_raw_video(video_t *v,
|
||||
void (*callback)(void *param, struct video_data *frame),
|
||||
void *param)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
os_atomic_dec_long(&video->raw_active);
|
||||
video_output_disconnect(v, callback, param);
|
||||
}
|
||||
|
||||
void obs_add_raw_video_callback(
|
||||
const struct video_scale_info *conversion,
|
||||
void (*callback)(void *param, struct video_data *frame),
|
||||
void *param)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
if (!obs)
|
||||
return;
|
||||
start_raw_video(video->video, conversion, callback, param);
|
||||
}
|
||||
|
||||
void obs_remove_raw_video_callback(
|
||||
void (*callback)(void *param, struct video_data *frame),
|
||||
void *param)
|
||||
{
|
||||
struct obs_core_video *video = &obs->video;
|
||||
if (!obs)
|
||||
return;
|
||||
stop_raw_video(video->video, callback, param);
|
||||
}
|
||||
|
||||
void obs_apply_private_data(obs_data_t *settings)
|
||||
{
|
||||
if (!obs || !settings)
|
||||
return;
|
||||
|
||||
obs_data_apply(obs->data.private_data, settings);
|
||||
}
|
||||
|
||||
void obs_set_private_data(obs_data_t *settings)
|
||||
{
|
||||
if (!obs)
|
||||
return;
|
||||
|
||||
obs_data_clear(obs->data.private_data);
|
||||
if (settings)
|
||||
obs_data_apply(obs->data.private_data, settings);
|
||||
}
|
||||
|
||||
obs_data_t *obs_get_private_data(void)
|
||||
{
|
||||
if (!obs)
|
||||
return NULL;
|
||||
|
||||
obs_data_t *private_data = obs->data.private_data;
|
||||
obs_data_addref(private_data);
|
||||
return private_data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue