diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt index f458947d9..67d75be9a 100644 --- a/libobs/CMakeLists.txt +++ b/libobs/CMakeLists.txt @@ -138,6 +138,7 @@ set(libobs_libobs_SOURCES obs-source.c obs-output.c obs.c + obs-data.c obs-module.c obs-display.c obs-scene.c @@ -148,6 +149,7 @@ set(libobs_libobs_HEADERS obs-service.h obs-internal.h obs.h + obs-data.h obs-module.h obs-scene.h obs-source.h diff --git a/libobs/obs-data.c b/libobs/obs-data.c new file mode 100644 index 000000000..d76c25bcd --- /dev/null +++ b/libobs/obs-data.c @@ -0,0 +1,594 @@ +/****************************************************************************** + Copyright (C) 2014 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + +#include "util/bmem.h" +#include "util/darray.h" +#include "obs-data.h" + +struct obs_data_item { + volatile int ref; + struct obs_data *parent; + struct obs_data_item *next; + enum obs_data_type type; + size_t name_len; + size_t data_len; + size_t capacity; +}; + +struct obs_data { + volatile int ref; + char *json; + struct obs_data_item *first_item; +}; + +struct obs_data_array { + volatile int ref; + DARRAY(obs_data_t) objects; +}; + +/* ------------------------------------------------------------------------- */ +/* Item structure, designed to be one allocation only */ + +/* ensures data after the name has 16 byte alignment (in case of SSE) */ +static inline size_t get_name_align_size(const char *name) +{ + size_t name_size = strlen(name) + 1; + size_t total_size = sizeof(struct obs_data_item) + (name_size + 15); + return (total_size & 0xFFFFFFF0) - sizeof(struct obs_data_item); +} + +static inline char *get_item_name(struct obs_data_item *item) +{ + return (char*)item + sizeof(struct obs_data_item); +} + +static inline void *get_item_data(struct obs_data_item *item) +{ + return (uint8_t*)get_item_name(item) + item->name_len; +} + +static inline size_t obs_data_item_total_size(struct obs_data_item *item) +{ + return sizeof(struct obs_data_item) + item->data_len + item->name_len; +} + +static inline obs_data_t get_item_obj(struct obs_data_item *item) +{ + return *(obs_data_t*)get_item_data(item); +} + +static inline obs_data_array_t get_item_array(struct obs_data_item *item) +{ + return *(obs_data_array_t*)get_item_data(item); +} + +static inline void item_data_release(struct obs_data_item *item) +{ + if (item->type == OBS_DATA_OBJECT) { + obs_data_t obj = get_item_obj(item); + obs_data_release(obj); + + } else if (item->type == OBS_DATA_ARRAY) { + obs_data_array_t array = get_item_array(item); + obs_data_array_release(array); + } +} + +static inline void item_data_addref(struct obs_data_item *item) +{ + if (item->type == OBS_DATA_OBJECT) { + obs_data_t obj = get_item_obj(item); + obs_data_addref(obj); + + } else if (item->type == OBS_DATA_ARRAY) { + obs_data_array_t array = get_item_array(item); + obs_data_array_addref(array); + } +} + +static struct obs_data_item *obs_data_item_create(const char *name, + const void *data, size_t size, enum obs_data_type type) +{ + struct obs_data_item *item; + size_t name_size, total_size; + + if (!name || !data) + return NULL; + + name_size = get_name_align_size(name); + total_size = name_size + sizeof(struct obs_data_item) + size; + + item = bmalloc(total_size); + memset(item, 0, total_size); + + item->capacity = total_size; + item->type = type; + item->name_len = name_size; + item->data_len = size; + item->ref = 1; + + strcpy(get_item_name(item), name); + memcpy(get_item_data(item), data, size); + + item_data_addref(item); + return item; +} + +static struct obs_data_item **get_item_prev_next(struct obs_data *data, + struct obs_data_item *current) +{ + if (!current || !data) + return NULL; + + struct obs_data_item **prev_next = &data->first_item; + struct obs_data_item *item = data->first_item; + + while (item) { + if (item == current) + return prev_next; + + prev_next = &item->next; + item = item->next; + } + + return NULL; +} + +static inline void obs_data_item_detach(struct obs_data_item *item) +{ + struct obs_data_item **prev_next = get_item_prev_next(item->parent, + item); + + if (prev_next) { + *prev_next = item->next; + item->next = NULL; + } +} + +static inline void obs_data_item_reattach(struct obs_data_item *old_ptr, + struct obs_data_item *new_ptr) +{ + struct obs_data_item **prev_next = get_item_prev_next(new_ptr->parent, + old_ptr); + + if (prev_next) + *prev_next = new_ptr; +} + +static struct obs_data_item *obs_data_item_ensure_capacity( + struct obs_data_item *item) +{ + size_t new_size = obs_data_item_total_size(item); + struct obs_data_item *new_item; + + if (item->capacity >= new_size) + return item; + + new_item = brealloc(item, new_size); + new_item->capacity = new_size; + + obs_data_item_reattach(item, new_item); + return new_item; +} + +static inline void obs_data_item_destroy(struct obs_data_item *item) +{ + item_data_release(item); + obs_data_item_detach(item); + bfree(item); +} + +static inline void obs_data_item_setdata( + struct obs_data_item **p_item, const void *data, size_t size, + enum obs_data_type type) +{ + if (!p_item || !*p_item) + return; + + struct obs_data_item *item = *p_item; + item_data_release(item); + + item->data_len = size; + item->type = type; + item = obs_data_item_ensure_capacity(item); + + if (size) { + memcpy(get_item_data(item), data, size); + item_data_addref(item); + } + + *p_item = item; +} + +/* ------------------------------------------------------------------------- */ + +obs_data_t obs_data_create() +{ + struct obs_data *data = bmalloc(sizeof(struct obs_data)); + memset(data, 0, sizeof(struct obs_data)); + data->ref = 1; + + return data; +} + +obs_data_t obs_data_create_from_json(const char *json_string) +{ + /* TODO */ + return NULL; +} + +int obs_data_addref(obs_data_t data) +{ + return ++data->ref; +} + +static inline obs_data_destroy(struct obs_data *data) +{ + struct obs_data_item *item = data->first_item; + + while (item) { + struct obs_data_item *next = item->next; + obs_data_item_release(&item); + item = next; + } + + bfree(data->json); + bfree(data); +} + +int obs_data_release(obs_data_t data) +{ + if (!data) + return 0; + + int ref = --data->ref; + if (!ref) + obs_data_destroy(data); + + return ref; +} + +const char *obs_data_getjson(obs_data_t data) +{ + /* TODO */ + return data->json; +} + +static struct obs_data_item *get_item(struct obs_data *data, const char *name) +{ + struct obs_data_item *item = data->first_item; + + while (item) { + if (strcmp(get_item_name(item), name) == 0) + return item; + + item = item->next; + } + + return NULL; +} + +static inline struct obs_data_item *get_item_of(struct obs_data *data, + const char *name, enum obs_data_type type) +{ + struct obs_data_item *item = get_item(data, name); + return (item->type == type) ? item : NULL; +} + +static void set_item(struct obs_data *data, const char *name, const void *ptr, + size_t size, enum obs_data_type type) +{ + struct obs_data_item *item = get_item(data, name); + if (!item) { + item = obs_data_item_create(name, ptr, size, type); + item->next = data->first_item; + item->parent = data; + + data->first_item = item; + + } else { + obs_data_item_setdata(&item, ptr, size, type); + } +} + +void obs_data_erase(obs_data_t data, const char *name) +{ + struct obs_data_item *item = get_item(data, name); + + obs_data_item_detach(item); + obs_data_item_release(&item); +} + +void obs_data_setstring(obs_data_t data, const char *name, const char *val) +{ + if (!val) val = ""; + set_item(data, name, val, strlen(val)+1, OBS_DATA_STRING); +} + +void obs_data_setint(obs_data_t data, const char *name, long long val) +{ + double f_val = (double)val; + set_item(data, name, &f_val, sizeof(double), OBS_DATA_NUMBER); +} + +void obs_data_setdouble(obs_data_t data, const char *name, double val) +{ + set_item(data, name, &val, sizeof(double), OBS_DATA_NUMBER); +} + +void obs_data_setbool(obs_data_t data, const char *name, bool val) +{ + set_item(data, name, &val, sizeof(bool), OBS_DATA_BOOLEAN); +} + +void obs_data_setobj(obs_data_t data, const char *name, obs_data_t obj) +{ + set_item(data, name, &obj, sizeof(obs_data_t), OBS_DATA_OBJECT); +} + +void obs_data_setarray(obs_data_t data, const char *name, + obs_data_array_t array) +{ + set_item(data, name, &array, sizeof(obs_data_t), OBS_DATA_ARRAY); +} + +const char *obs_data_getstring(obs_data_t data, const char *name, + const char *def) +{ + struct obs_data_item *item = get_item_of(data, name, OBS_DATA_STRING); + return item ? get_item_data(item) : def; +} + +long long obs_data_getint(obs_data_t data, const char *name, long long def) +{ + struct obs_data_item *item = get_item_of(data, name, OBS_DATA_NUMBER); + return item ? (long long)*(double*)get_item_data(item) : def; +} + +double obs_data_getdouble(obs_data_t data, const char *name, double def) +{ + struct obs_data_item *item = get_item_of(data, name, OBS_DATA_NUMBER); + return item ? *(double*)get_item_data(item) : def; +} + +bool obs_data_getbool(obs_data_t data, const char *name, bool def) +{ + struct obs_data_item *item = get_item_of(data, name, OBS_DATA_BOOLEAN); + return item ? *(bool*)get_item_data(item) : def; +} + +obs_data_t obs_data_getobj(obs_data_t data, const char *name) +{ + struct obs_data_item *item = get_item_of(data, name, OBS_DATA_OBJECT); + obs_data_t obj = get_item_obj(item); + + if (obj) + obj->ref++; + return obj; +} + +obs_data_array_t obs_data_getarray(obs_data_t data, const char *name) +{ + struct obs_data_item *item = get_item_of(data, name, OBS_DATA_ARRAY); + obs_data_array_t array = get_item_array(item); + + if (array) + array->ref++; + return array; +} + +obs_data_array_t obs_data_array_create() +{ + struct obs_data_array *array = bmalloc(sizeof(struct obs_data_array)); + memset(array, 0, sizeof(struct obs_data_array)); + array->ref = 1; + + return array; +} + +int obs_data_array_addref(obs_data_array_t array) +{ + return ++array->ref; +} + +static void obs_data_array_destroy(obs_data_array_t array) +{ + for (size_t i = 0; i < array->objects.num; i++) + obs_data_release(array->objects.array[i]); + da_free(array->objects); + bfree(array); +} + +int obs_data_array_release(obs_data_array_t array) +{ + int ref = --array->ref; + if (!ref) + obs_data_array_destroy(array); + + return ref; +} + +size_t obs_data_array_count(obs_data_array_t array) +{ + return array->objects.num; +} + +obs_data_t obs_data_array_item(obs_data_array_t array, size_t idx) +{ + obs_data_t data; + data = (idx < array->objects.num) ? array->objects.array[idx] : NULL; + + if (data) + data->ref++; + return data; +} + +size_t obs_data_array_push_back(obs_data_array_t array, obs_data_t obj) +{ + obj->ref++; + return da_push_back(array->objects, &obj); +} + +void obs_data_array_insert(obs_data_array_t array, size_t idx, obs_data_t obj) +{ + obj->ref++; + da_insert(array->objects, idx, &obj); +} + +void obs_data_array_erase(obs_data_array_t array, size_t idx) +{ + obs_data_release(array->objects.array[idx]); + da_erase(array->objects, idx); +} + +/* ------------------------------------------------------------------------- */ +/* Item iteration */ + +obs_data_item_t obs_data_first(obs_data_t data) +{ + if (data->first_item) + data->first_item->ref++; + return data->first_item; +} + +obs_data_item_t obs_data_item_byname(obs_data_t data, const char *name) +{ + struct obs_data_item *item = get_item(data, name); + if (item) + item->ref++; + return item; +} + +bool obs_data_item_next(obs_data_item_t *item) +{ + if (item && *item) { + (*item)->ref--; + *item = (*item)->next; + + if (*item) { + (*item)->ref++; + return true; + } + } + + return false; +} + +void obs_data_item_release(obs_data_item_t *item) +{ + if (item && *item) { + int ref = --(*item)->ref; + if (!ref) { + obs_data_item_destroy(*item); + *item = NULL; + } + } +} + +void obs_data_item_remove(obs_data_item_t *item) +{ + if (item && *item) { + obs_data_item_detach(*item); + obs_data_item_release(item); + } +} + +enum obs_data_type obs_data_item_gettype(obs_data_item_t item) +{ + return item->type; +} + +void obs_data_item_setstring(obs_data_item_t *item, const char *val) +{ + obs_data_item_setdata(item, val, strlen(val)+1, OBS_DATA_STRING); +} + +void obs_data_item_setint(obs_data_item_t *item, long long val) +{ + double f_val = (double)val; + obs_data_item_setdata(item, &f_val, sizeof(double), OBS_DATA_NUMBER); +} + +void obs_data_item_setdouble(obs_data_item_t *item, double val) +{ + obs_data_item_setdata(item, &val, sizeof(double), OBS_DATA_NUMBER); +} + +void obs_data_item_setbool(obs_data_item_t *item, bool val) +{ + obs_data_item_setdata(item, &val, sizeof(bool), OBS_DATA_BOOLEAN); +} + +void obs_data_item_setobj(obs_data_item_t *item, obs_data_t val) +{ + obs_data_item_setdata(item, &val, sizeof(obs_data_t), OBS_DATA_OBJECT); +} + +void obs_data_item_setarray(obs_data_item_t *item, obs_data_array_t val) +{ + obs_data_item_setdata(item, &val, sizeof(obs_data_array_t), + OBS_DATA_ARRAY); +} + +static inline bool item_valid(struct obs_data_item *item, + enum obs_data_type type) +{ + return item && item->type == type; +} + +const char *obs_data_item_getstring(obs_data_item_t item, const char *def) +{ + return item_valid(item, OBS_DATA_STRING) ? get_item_data(item) : def; +} + +long long obs_data_item_getint(obs_data_item_t item, long long def) +{ + return item_valid(item, OBS_DATA_NUMBER) ? + (long long)*(double*)get_item_data(item) : def; +} + +double obs_data_item_getdouble(obs_data_item_t item, double def) +{ + return item_valid(item, OBS_DATA_NUMBER) ? + *(double*)get_item_data(item) : def; +} + +bool obs_data_item_getbool(obs_data_item_t item, bool def) +{ + return item_valid(item, OBS_DATA_BOOLEAN) ? + *(bool*)get_item_data(item) : def; +} + +obs_data_t obs_data_item_getobj(obs_data_item_t item) +{ + obs_data_t obj = item_valid(item, OBS_DATA_OBJECT) ? + get_item_obj(item) : NULL; + + if (obj) + obj->ref++; + return obj; +} + +obs_data_array_t obs_data_item_getarray(obs_data_item_t item) +{ + obs_data_array_t array = item_valid(item, OBS_DATA_ARRAY) ? + get_item_array(item) : NULL; + + if (array) + array->ref++; + return array; +} diff --git a/libobs/obs-data.h b/libobs/obs-data.h new file mode 100644 index 000000000..0375dba3c --- /dev/null +++ b/libobs/obs-data.h @@ -0,0 +1,128 @@ +/****************************************************************************** + Copyright (C) 2014 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + +#pragma once + +#include "util/c99defs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * OBS data settings storage + * + * This is used for retrieving or setting the data settings for things such + * as sources, encoders, etc. This is designed for JSON serialization. + */ + +struct obs_data; +struct obs_data_item; +struct obs_data_array; +typedef struct obs_data *obs_data_t; +typedef struct obs_data_item *obs_data_item_t; +typedef struct obs_data_array *obs_data_array_t; + +enum obs_data_type { + OBS_DATA_NULL, + OBS_DATA_STRING, + OBS_DATA_NUMBER, + OBS_DATA_BOOLEAN, + OBS_DATA_OBJECT, + OBS_DATA_ARRAY +}; + +/* ------------------------------------------------------------------------- */ +/* Main usage functions */ + +EXPORT obs_data_t obs_data_create(); +EXPORT obs_data_t obs_data_create_from_json(const char *json_string); +EXPORT int obs_data_addref(obs_data_t data); +EXPORT int obs_data_release(obs_data_t data); + +EXPORT const char *obs_data_getjson(obs_data_t data); + +EXPORT void obs_data_erase(obs_data_t data, const char *name); + +/* Set functions */ +EXPORT void obs_data_setstring(obs_data_t data, const char *name, + const char *val); +EXPORT void obs_data_setint(obs_data_t data, const char *name, + long long val); +EXPORT void obs_data_setdouble(obs_data_t data, const char *name, double val); +EXPORT void obs_data_setbool(obs_data_t data, const char *name, bool val); +EXPORT void obs_data_setobj(obs_data_t data, const char *name, obs_data_t obj); +EXPORT void obs_data_setarray(obs_data_t data, const char *name, + obs_data_array_t array); + +/* + * Get functions + * NOTE: use a macro if you use 'defaults' in more than one place + */ +EXPORT const char *obs_data_getstring(obs_data_t data, const char *name, + const char *def); +EXPORT long long obs_data_getint(obs_data_t data, const char *name, + long long def); +EXPORT double obs_data_getdouble(obs_data_t data, const char *name, double def); +EXPORT bool obs_data_getbool(obs_data_t data, const char *name, bool def); +EXPORT obs_data_t obs_data_getobj(obs_data_t data, const char *name); +EXPORT obs_data_array_t obs_data_getarray(obs_data_t data, const char *name); + +/* Array functions */ +EXPORT obs_data_array_t obs_data_array_create(); +EXPORT int obs_data_array_addref(obs_data_array_t array); +EXPORT int obs_data_array_release(obs_data_array_t array); + +EXPORT size_t obs_data_array_count(obs_data_array_t array); +EXPORT obs_data_t obs_data_array_item(obs_data_array_t array, size_t idx); +EXPORT size_t obs_data_array_push_back(obs_data_array_t array, obs_data_t obj); +EXPORT void obs_data_array_insert(obs_data_array_t array, size_t idx, + obs_data_t obj); +EXPORT void obs_data_array_erase(obs_data_array_t array, size_t idx); + +/* ------------------------------------------------------------------------- */ +/* Item iteration */ + +EXPORT obs_data_item_t obs_data_first(obs_data_t data); +EXPORT obs_data_item_t obs_data_item_byname(obs_data_t data, const char *name); +EXPORT bool obs_data_item_next(obs_data_item_t *item); +EXPORT void obs_data_item_release(obs_data_item_t *item); +EXPORT void obs_data_item_remove(obs_data_item_t *item); + +/* Gets Item type */ +EXPORT enum obs_data_type obs_data_item_gettype(obs_data_item_t item); + +/* Item set functions */ +EXPORT void obs_data_item_setstring(obs_data_item_t *item, const char *val); +EXPORT void obs_data_item_setint(obs_data_item_t *item, long long val); +EXPORT void obs_data_item_setdouble(obs_data_item_t *item, double val); +EXPORT void obs_data_item_setbool(obs_data_item_t *item, bool val); +EXPORT void obs_data_item_setobj(obs_data_item_t *item, obs_data_t val); +EXPORT void obs_data_item_setarray(obs_data_item_t *item, obs_data_array_t val); + +/* Item get functions */ +EXPORT const char *obs_data_item_getstring(obs_data_item_t item, + const char *def); +EXPORT long long obs_data_item_getint(obs_data_item_t item, long long def); +EXPORT double obs_data_item_getdouble(obs_data_item_t item, double def); +EXPORT bool obs_data_item_getbool(obs_data_item_t item, bool def); +EXPORT obs_data_t obs_data_item_getobj(obs_data_item_t item); +EXPORT obs_data_array_t obs_data_item_getarray(obs_data_item_t item); + +#ifdef __cplusplus +} +#endif diff --git a/libobs/obs-encoder.c b/libobs/obs-encoder.c index 0e643ef6e..c382ed4ac 100644 --- a/libobs/obs-encoder.c +++ b/libobs/obs-encoder.c @@ -58,7 +58,7 @@ const char *obs_encoder_getdisplayname(const char *id, const char *locale) } obs_encoder_t obs_encoder_create(const char *id, const char *name, - const char *settings) + obs_data_t settings) { struct obs_encoder *encoder; struct encoder_info *ei = get_encoder_info(id); @@ -82,7 +82,8 @@ obs_encoder_t obs_encoder_create(const char *id, const char *name, return NULL; } - dstr_copy(&encoder->settings, settings); + encoder->settings = settings; + obs_data_addref(settings); pthread_mutex_lock(&obs->data.encoders_mutex); da_push_back(obs->data.encoders, &encoder); @@ -98,12 +99,12 @@ void obs_encoder_destroy(obs_encoder_t encoder) pthread_mutex_unlock(&obs->data.encoders_mutex); encoder->callbacks.destroy(encoder->data); - dstr_free(&encoder->settings); + obs_data_release(encoder->settings); bfree(encoder); } } -void obs_encoder_update(obs_encoder_t encoder, const char *settings) +void obs_encoder_update(obs_encoder_t encoder, obs_data_t settings) { encoder->callbacks.update(encoder->data, settings); } @@ -142,12 +143,8 @@ bool obs_encoder_request_keyframe(obs_encoder_t encoder) return false; } -const char *obs_encoder_get_settings(obs_encoder_t encoder) +obs_data_t obs_encoder_get_settings(obs_encoder_t encoder) { - return encoder->settings.array; -} - -void obs_encoder_save_settings(obs_encoder_t encoder, const char *settings) -{ - dstr_copy(&encoder->settings, settings); + obs_data_addref(encoder->settings); + return encoder->settings; } diff --git a/libobs/obs-encoder.h b/libobs/obs-encoder.h index e31acfbb1..1d4fe9ec3 100644 --- a/libobs/obs-encoder.h +++ b/libobs/obs-encoder.h @@ -60,7 +60,7 @@ * (seen by the user). * * --------------------------------------------------------- - * void *[name]_create(const char *settings, const char *name, + * void *[name]_create(obs_data_t settings, const char *name, * obs_encoder_t encoder); * Creates an encoder. * @@ -74,7 +74,7 @@ * Destroys the encoder. * * --------------------------------------------------------- - * void [name]_update(void *data, const char *settings) + * void [name]_update(void *data, obs_data_t settings) * Updates the encoder's settings * * settings: New settings of the encoder @@ -126,10 +126,10 @@ struct encoder_info { const char *(*getname)(const char *locale); - void *(*create)(const char *settings, struct obs_encoder *encoder); + void *(*create)(obs_data_t settings, struct obs_encoder *encoder); void (*destroy)(void *data); - void (*update)(void *data, const char *settings); + void (*update)(void *data, obs_data_t settings); bool (*reset)(void *data); @@ -151,7 +151,7 @@ struct obs_encoder { char *name; void *data; struct encoder_info callbacks; - struct dstr settings; + obs_data_t settings; pthread_mutex_t data_callbacks_mutex; DARRAY(struct obs_encoder_callback) data_callbacks; diff --git a/libobs/obs-output.c b/libobs/obs-output.c index 48b47c802..357d4a1fb 100644 --- a/libobs/obs-output.c +++ b/libobs/obs-output.c @@ -46,7 +46,7 @@ static inline const struct output_info *find_output(const char *id) } obs_output_t obs_output_create(const char *id, const char *name, - const char *settings) + obs_data_t settings) { const struct output_info *info = find_output(id); struct obs_output *output; @@ -65,7 +65,9 @@ obs_output_t obs_output_create(const char *id, const char *name, } output->name = bstrdup(name); - dstr_init_copy(&output->settings, settings); + + obs_data_addref(settings); + output->settings = settings; pthread_mutex_lock(&obs->data.outputs_mutex); da_push_back(obs->data.outputs, &output); @@ -81,7 +83,7 @@ void obs_output_destroy(obs_output_t output) pthread_mutex_unlock(&obs->data.outputs_mutex); output->callbacks.destroy(output->data); - dstr_free(&output->settings); + obs_data_release(output->settings); bfree(output->name); bfree(output); } @@ -102,7 +104,7 @@ bool obs_output_active(obs_output_t output) return output->callbacks.active(output); } -void obs_output_update(obs_output_t output, const char *settings) +void obs_output_update(obs_output_t output, obs_data_t settings) { if (output->callbacks.update) output->callbacks.update(output->data, settings); @@ -118,8 +120,3 @@ void obs_output_pause(obs_output_t output) if (output->callbacks.pause) output->callbacks.pause(output->data); } - -void obs_output_save_settings(obs_output_t output, const char *settings) -{ - dstr_copy(&output->settings, settings); -} diff --git a/libobs/obs-output.h b/libobs/obs-output.h index 356e63810..17957514b 100644 --- a/libobs/obs-output.h +++ b/libobs/obs-output.h @@ -58,7 +58,7 @@ * Returns the full translated name of the output type (seen by the user). * * --------------------------------------------------------- - * void *[name]_create(const char *settings, obs_output_t output); + * void *[name]_create(obs_data_t settings, obs_output_t output); * Creates an output. * * settings: Settings of the output. @@ -70,7 +70,7 @@ * Destroys the output. * * --------------------------------------------------------- - * void [name]_update(void *data, const char *settings) + * void [name]_update(void *data, obs_data_t settings) * Updates the output's settings * * settings: New settings of the output @@ -103,10 +103,10 @@ struct output_info { const char *(*getname)(const char *locale); - void *(*create)(const char *settings, struct obs_output *output); + void *(*create)(obs_data_t settings, struct obs_output *output); void (*destroy)(void *data); - void (*update)(void *data, const char *settings); + void (*update)(void *data, obs_data_t settings); bool (*start)(void *data); void (*stop)(void *data); @@ -121,7 +121,7 @@ struct obs_output { char *name; void *data; struct output_info callbacks; - struct dstr settings; + obs_data_t settings; }; extern bool load_output_info(void *module, const char *module_name, diff --git a/libobs/obs-scene.c b/libobs/obs-scene.c index 3d9ddd07d..2a0f0c6ea 100644 --- a/libobs/obs-scene.c +++ b/libobs/obs-scene.c @@ -34,7 +34,7 @@ static const char *scene_getname(const char *locale) return "Scene"; } -static void *scene_create(const char *settings, struct obs_source *source) +static void *scene_create(obs_data_t settings, struct obs_source *source) { struct obs_scene *scene = bmalloc(sizeof(struct obs_scene)); scene->source = source; diff --git a/libobs/obs-service.h b/libobs/obs-service.h index c6db8e360..691d04350 100644 --- a/libobs/obs-service.h +++ b/libobs/obs-service.h @@ -24,9 +24,9 @@ struct service_info { const char *(*getname)(const char *locale); - void *(*create)(const char *settings, struct service_data *service); + void *(*create)(obs_data_t settings, struct service_data *service); void (*destroy)(void *data); - void (*config)(void *data, const char *settings); + void (*config)(void *data, obs_data_t settings); /* optional */ const char *(*getdata)(const char *attribute); diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 1a690a6fb..b52522d15 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -101,7 +101,7 @@ const char *obs_source_getdisplayname(enum obs_source_type type, } /* internal initialization */ -bool obs_source_init(struct obs_source *source, const char *settings, +bool obs_source_init(struct obs_source *source, obs_data_t settings, const struct source_info *info) { uint32_t flags = info->get_output_flags(source->data); @@ -111,7 +111,9 @@ bool obs_source_init(struct obs_source *source, const char *settings, pthread_mutex_init_value(&source->filter_mutex); pthread_mutex_init_value(&source->video_mutex); pthread_mutex_init_value(&source->audio_mutex); - dstr_copy(&source->settings, settings); + source->settings = settings; + obs_data_addref(settings); + memcpy(&source->callbacks, info, sizeof(struct source_info)); if (pthread_mutex_init(&source->filter_mutex, NULL) != 0) @@ -146,7 +148,7 @@ static inline void obs_source_dosignal(struct obs_source *source, } obs_source_t obs_source_create(enum obs_source_type type, const char *id, - const char *name, const char *settings) + const char *name, obs_data_t settings) { struct obs_source *source; @@ -214,7 +216,7 @@ static void obs_source_destroy(obs_source_t source) pthread_mutex_destroy(&source->filter_mutex); pthread_mutex_destroy(&source->audio_mutex); pthread_mutex_destroy(&source->video_mutex); - dstr_free(&source->settings); + obs_data_release(source->settings); bfree(source->name); bfree(source); } @@ -271,7 +273,7 @@ uint32_t obs_source_get_output_flags(obs_source_t source) return source->callbacks.get_output_flags(source->data); } -void obs_source_update(obs_source_t source, const char *settings) +void obs_source_update(obs_source_t source, obs_data_t settings) { if (source->callbacks.update) source->callbacks.update(source->data, settings); @@ -688,14 +690,10 @@ void obs_source_filter_setorder(obs_source_t source, obs_source_t filter, } } -const char *obs_source_getsettings(obs_source_t source) +obs_data_t obs_source_getsettings(obs_source_t source) { - return source->settings.array; -} - -void obs_source_savesettings(obs_source_t source, const char *settings) -{ - dstr_copy(&source->settings, settings); + obs_data_addref(source->settings); + return source->settings; } static inline struct source_frame *filter_async_video(obs_source_t source, diff --git a/libobs/obs-source.h b/libobs/obs-source.h index 56e69fc12..4f9e85d53 100644 --- a/libobs/obs-source.h +++ b/libobs/obs-source.h @@ -70,7 +70,7 @@ * Returns the full name of the source type (seen by the user). * * --------------------------------------------------------- - * void *[name]_create(const char *settings, obs_source_t source); + * void *[name]_create(obs_data_t settings, obs_source_t source); * Creates a source. * * settings: Settings of the source. @@ -93,7 +93,7 @@ * =========================================== * Optional Source Exports * =========================================== - * void [name]_update(void *data, const char *settings); + * void [name]_update(void *data, obs_data_t settings); * Called to update the settings of the source. * * --------------------------------------------------------- @@ -166,7 +166,7 @@ struct source_info { const char *(*getname)(const char *locale); - void *(*create)(const char *settings, obs_source_t source); + void *(*create)(obs_data_t settings, obs_source_t source); void (*destroy)(void *data); uint32_t (*get_output_flags)(void *data); @@ -174,7 +174,7 @@ struct source_info { /* ----------------------------------------------------------------- */ /* optional implementations */ - void (*update)(void *data, const char *settings); + void (*update)(void *data, obs_data_t settings); void (*activate)(void *data); void (*deactivate)(void *data); @@ -201,7 +201,7 @@ struct obs_source { /* source-specific data */ char *name; /* user-defined name */ enum obs_source_type type; - struct dstr settings; + obs_data_t settings; void *data; struct source_info callbacks; @@ -248,7 +248,7 @@ extern bool load_source_info(void *module, const char *module_name, const char *source_name, struct source_info *info); bool obs_source_init_handlers(struct obs_source *source); -extern bool obs_source_init(struct obs_source *source, const char *settings, +extern bool obs_source_init(struct obs_source *source, obs_data_t settings, const struct source_info *info); extern void obs_source_activate(obs_source_t source); diff --git a/libobs/obs.h b/libobs/obs.h index 46c65fbc8..551bcef82 100644 --- a/libobs/obs.h +++ b/libobs/obs.h @@ -27,6 +27,7 @@ #include "callback/proc.h" #include "obs-defs.h" +#include "obs-data.h" /* * Main libobs header used by applications. @@ -350,7 +351,7 @@ EXPORT const char *obs_source_getdisplayname(enum obs_source_type type, * or modifying video/audio. Use obs_source_release to release it. */ EXPORT obs_source_t obs_source_create(enum obs_source_type type, - const char *id, const char *name, const char *settings); + const char *id, const char *name, obs_data_t settings); /** * Adds/releases a reference to a source. When the last reference is @@ -375,7 +376,7 @@ EXPORT bool obs_source_removed(obs_source_t source); EXPORT uint32_t obs_source_get_output_flags(obs_source_t source); /** Updates settings for this source */ -EXPORT void obs_source_update(obs_source_t source, const char *settings); +EXPORT void obs_source_update(obs_source_t source, obs_data_t settings); /** Renders a video source. */ EXPORT void obs_source_video_render(obs_source_t source); @@ -419,7 +420,7 @@ EXPORT void obs_source_filter_setorder(obs_source_t source, obs_source_t filter, enum order_movement movement); /** Gets the settings string for a source */ -EXPORT const char *obs_source_getsettings(obs_source_t source); +EXPORT obs_data_t obs_source_getsettings(obs_source_t source); /** Gets the name of a source */ EXPORT const char *obs_source_getname(obs_source_t source); @@ -446,9 +447,6 @@ EXPORT float obs_source_getvolume(obs_source_t source); /* ------------------------------------------------------------------------- */ /* Functions used by sources */ -/** Saves the settings string for a source */ -EXPORT void obs_source_savesettings(obs_source_t source, const char *settings); - /** Outputs asynchronous video data */ EXPORT void obs_source_output_video(obs_source_t source, const struct source_frame *frame); @@ -542,7 +540,7 @@ EXPORT const char *obs_output_getdisplayname(const char *id, * directshow, or other custom outputs. */ EXPORT obs_output_t obs_output_create(const char *id, const char *name, - const char *settings); + obs_data_t settings); EXPORT void obs_output_destroy(obs_output_t output); /** Starts the output. */ @@ -555,7 +553,7 @@ EXPORT void obs_output_stop(obs_output_t output); EXPORT bool obs_output_active(obs_output_t output); /** Updates the settings for this output context */ -EXPORT void obs_output_update(obs_output_t output, const char *settings); +EXPORT void obs_output_update(obs_output_t output, obs_data_t settings); /** Specifies whether the output can be paused */ EXPORT bool obs_output_canpause(obs_output_t output); @@ -564,11 +562,7 @@ EXPORT bool obs_output_canpause(obs_output_t output); EXPORT void obs_output_pause(obs_output_t output); /* Gets the current output settings string */ -EXPORT const char *obs_output_get_settings(obs_output_t output); - -/* Saves the output settings string, typically used only by outputs */ -EXPORT void obs_output_save_settings(obs_output_t output, - const char *settings); +EXPORT obs_data_t obs_output_get_settings(obs_output_t output); /* ------------------------------------------------------------------------- */ @@ -577,10 +571,10 @@ EXPORT const char *obs_encoder_getdisplayname(const char *id, const char *locale); EXPORT obs_encoder_t obs_encoder_create(const char *id, const char *name, - const char *settings); + obs_data_t settings); EXPORT void obs_encoder_destroy(obs_encoder_t encoder); -EXPORT void obs_encoder_update(obs_encoder_t encoder, const char *settings); +EXPORT void obs_encoder_update(obs_encoder_t encoder, obs_data_t settings); EXPORT bool obs_encoder_reset(obs_encoder_t encoder); @@ -601,10 +595,7 @@ EXPORT bool obs_encoder_setbitrate(obs_encoder_t encoder, uint32_t bitrate, EXPORT bool obs_encoder_request_keyframe(obs_encoder_t encoder); -EXPORT const char *obs_encoder_get_settings(obs_encoder_t encoder); - -EXPORT void obs_encoder_save_settings(obs_encoder_t encoder, - const char *settings); +EXPORT obs_data_t obs_encoder_get_settings(obs_encoder_t encoder); /* ------------------------------------------------------------------------- */ @@ -613,7 +604,7 @@ EXPORT const char *obs_service_getdisplayname(const char *id, const char *locale); EXPORT obs_service_t obs_service_create(const char *service, - const char *settings); + obs_data_t settings); EXPORT void obs_service_destroy(obs_service_t service); EXPORT void obs_service_setdata(obs_service_t service, const char *attribute, diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-output.c b/plugins/obs-ffmpeg/obs-ffmpeg-output.c index f9df3db71..892c74654 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-output.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-output.c @@ -293,7 +293,7 @@ const char *ffmpeg_output_getname(const char *locale) return "FFmpeg file output"; } -struct ffmpeg_output *ffmpeg_output_create(const char *settings, +struct ffmpeg_output *ffmpeg_output_create(obs_data_t settings, obs_output_t output) { struct ffmpeg_output *data = bmalloc(sizeof(struct ffmpeg_output)); @@ -312,7 +312,7 @@ void ffmpeg_output_destroy(struct ffmpeg_output *data) } } -void ffmpeg_output_update(struct ffmpeg_output *data, const char *settings) +void ffmpeg_output_update(struct ffmpeg_output *data, obs_data_t settings) { } diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-output.h b/plugins/obs-ffmpeg/obs-ffmpeg-output.h index 67f29b4c2..028f7d5f8 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-output.h +++ b/plugins/obs-ffmpeg/obs-ffmpeg-output.h @@ -49,12 +49,12 @@ struct ffmpeg_output { EXPORT const char *ffmpeg_output_getname(const char *locale); -EXPORT struct ffmpeg_output *ffmpeg_output_create(const char *settings, +EXPORT struct ffmpeg_output *ffmpeg_output_create(obs_data_t settings, obs_output_t output); EXPORT void ffmpeg_output_destroy(struct ffmpeg_output *data); EXPORT void ffmpeg_output_update(struct ffmpeg_output *data, - const char *settings); + obs_data_t settings); EXPORT bool ffmpeg_output_start(struct ffmpeg_output *data); EXPORT void ffmpeg_output_stop(struct ffmpeg_output *data); diff --git a/plugins/obs-outputs/obs-outputs.fbp b/plugins/obs-outputs/obs-outputs.fbp deleted file mode 100644 index bd63ec488..000000000 --- a/plugins/obs-outputs/obs-outputs.fbp +++ /dev/null @@ -1,2590 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - - 1000 - none - 1 - MyProject1 - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - StreamConfig - - 663,546 - wxDEFAULT_DIALOG_STYLE - - StreamConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer6 - wxVERTICAL - none - - 5 - wxEXPAND|wxALL - 1 - - - serviceSizer - wxVERTICAL - protected - - 5 - wxEXPAND - 0 - - - bSizer7 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoder - - 0 - - - 0 - 230,-1 - 1 - m_staticText9 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_comboBox5 - 1 - - - protected - 1 - - Resizable - -1 - 1 - - wxCB_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Combo! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Add - - 0 - - - 0 - - 1 - m_button4 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Edit - - 0 - - - 0 - - 1 - m_button5 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizer9 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Service - - 0 - - - 0 - 230,-1 - 1 - m_staticText10 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_comboBox6 - 1 - - - protected - 1 - - Resizable - -1 - 1 - - wxCB_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - Combo! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_RIGHT - 0 - - - bSizer10 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - OK - - 0 - - - 0 - - 1 - m_button7 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Cancel - - 0 - - - 0 - - 1 - m_button8 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - wxAUI_MGR_DEFAULT - - - 1 - 1 - impl_virtual - - - 0 - wxID_ANY - - - MyPanel2 - - 742,442 - - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer19 - wxVERTICAL - none - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - StreamConfig.Encoding.VideoEncoding - - sbSizer2 - wxVERTICAL - none - - - 5 - wxEXPAND - 1 - - 2 - 0 - - gSizer5 - none - 0 - 0 - - 5 - wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.EnableCBR - - 0 - - - 0 - -1,-1 - 1 - m_checkBox1 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.CBRPadding - - 0 - - - 0 - -1,-1 - 1 - m_checkBox2 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - - - 0 - - fgSizer9 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.Quality - - 0 - - - 0 - 242,-1 - 1 - m_staticText17 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_comboBox6 - 1 - - - protected - 1 - - Resizable - -1 - 1 - 100,-1 - wxCB_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.CustomBuffer - - 0 - - - 0 - -1,-1 - 1 - m_checkBox3 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - - - 0 - - fgSizer10 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.MaxBitrate - - 0 - - - 0 - 242,-1 - 1 - m_staticText19 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_textCtrl2 - 1 - - - protected - 1 - - Resizable - 1 - 100,-1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - - - 0 - - fgSizer15 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.BufferSize - - 0 - - - 0 - 232,-1 - 1 - m_staticText20 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_textCtrl3 - 1 - - - protected - 1 - - Resizable - 1 - 100,-1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - StreamConfig.Encoding.AudioEncoding - - sbSizer3 - wxVERTICAL - none - - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - - - 0 - - fgSizer12 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.AudioBitrate - - 0 - - - 0 - 242,-1 - 1 - m_staticText23 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_comboBox7 - 1 - - - protected - 1 - - Resizable - -1 - 1 - 100,-1 - wxCB_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 2 - wxBOTH - - - 0 - - fgSizer13 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Encoding.AudioFormat - - 0 - - - 0 - 242,-1 - 1 - m_staticText24 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_comboBox8 - 1 - - - protected - 1 - - Resizable - -1 - 1 - - wxCB_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - wxAUI_MGR_DEFAULT - - - 1 - 1 - impl_virtual - - - 0 - wxID_ANY - - -1,-1 - DefaultStream - - -1,-1 - - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer4 - wxVERTICAL - none - - 0 - - 0 - - 2 - wxBOTH - - - 0 - - fgSizer6 - wxFLEX_GROWMODE_SPECIFIED - none - 0 - 0 - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.Server - - 0 - - - 0 - 230,-1 - 1 - m_staticText12 - 1 - - - protected - 1 - - Resizable - 1 - -1,-1 - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_choice1 - 1 - - - protected - 1 - - Resizable - 0 - 1 - 300,-1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - StreamConfig.StreamKey - - 0 - - - 0 - - 1 - m_staticText13 - 1 - - - protected - 1 - - Resizable - 1 - - wxALIGN_RIGHT - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_textCtrl1 - 1 - - - protected - 1 - - Resizable - 1 - 300,-1 - wxTE_PASSWORD - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/obs-outputs/obs-x264.c b/plugins/obs-outputs/obs-x264.c index d65d7e27c..c762d50b4 100644 --- a/plugins/obs-outputs/obs-x264.c +++ b/plugins/obs-outputs/obs-x264.c @@ -23,7 +23,7 @@ const char *obs_x264_getname(const char *locale) return "x264 (Software)"; } -struct obs_x264 *obs_x264_create(const char *settings, obs_encoder_t encoder) +struct obs_x264 *obs_x264_create(obs_data_t settings, obs_encoder_t encoder) { struct obs_x264 *data = bmalloc(sizeof(struct obs_x264)); } @@ -32,7 +32,7 @@ void obs_x264_destroy(struct obs_x264 *data) { } -void obs_x264_update(struct obs_x264 *data, const char *settings) +void obs_x264_update(struct obs_x264 *data, obs_data_t settings) { } diff --git a/plugins/obs-outputs/obs-x264.h b/plugins/obs-outputs/obs-x264.h index 8190ce28b..df527d873 100644 --- a/plugins/obs-outputs/obs-x264.h +++ b/plugins/obs-outputs/obs-x264.h @@ -31,11 +31,11 @@ struct obs_x264 { EXPORT const char *obs_x264_getname(const char *locale); -EXPORT struct obs_x264 *obs_x264_create(const char *settings, +EXPORT struct obs_x264 *obs_x264_create(obs_data_t settings, obs_encoder_t encoder); EXPORT void obs_x264_destroy(struct obs_x264 *data); -EXPORT void obs_x264_update(struct obs_x264 *data, const char *settings); +EXPORT void obs_x264_update(struct obs_x264 *data, obs_data_t settings); EXPORT void obs_x264_reset(struct obs_x264 *data); diff --git a/plugins/obs-outputs/rtmp-stream.c b/plugins/obs-outputs/rtmp-stream.c index 884dbc45e..4e5ada482 100644 --- a/plugins/obs-outputs/rtmp-stream.c +++ b/plugins/obs-outputs/rtmp-stream.c @@ -23,7 +23,7 @@ const char *rtmp_stream_getname(const char *locale) return "RTMP Stream"; } -void *rtmp_stream_create(const char *settings, obs_output_t output) +void *rtmp_stream_create(obs_data_t settings, obs_output_t output) { struct rtmp_stream *stream = bmalloc(sizeof(struct rtmp_stream)); memset(stream, 0, sizeof(struct rtmp_stream)); @@ -33,7 +33,7 @@ void rtmp_stream_destroy(struct rtmp_stream *stream) { } -void rtmp_stream_update(struct rtmp_stream *stream, const char *settings) +void rtmp_stream_update(struct rtmp_stream *stream, obs_data_t settings) { } diff --git a/plugins/obs-outputs/rtmp-stream.h b/plugins/obs-outputs/rtmp-stream.h index 02edeb73a..79f7546a5 100644 --- a/plugins/obs-outputs/rtmp-stream.h +++ b/plugins/obs-outputs/rtmp-stream.h @@ -30,10 +30,9 @@ struct rtmp_stream { }; EXPORT const char *rtmp_stream_getname(const char *locale); -EXPORT void *rtmp_stream_create(const char *settings, obs_output_t output); +EXPORT void *rtmp_stream_create(obs_data_t settings, obs_output_t output); EXPORT void rtmp_stream_destroy(struct rtmp_stream *stream); -EXPORT void rtmp_stream_update(struct rtmp_stream *stream, - const char *settings); +EXPORT void rtmp_stream_update(struct rtmp_stream *stream, obs_data_t settings); EXPORT bool rtmp_stream_start(struct rtmp_stream *stream); EXPORT void rtmp_stream_stop(struct rtmp_stream *stream); EXPORT bool rtmp_stream_active(struct rtmp_stream *stream); diff --git a/vs/2013/libobs/libobs.vcxproj b/vs/2013/libobs/libobs.vcxproj index 6957c4251..86b50e868 100644 --- a/vs/2013/libobs/libobs.vcxproj +++ b/vs/2013/libobs/libobs.vcxproj @@ -43,6 +43,7 @@ + @@ -91,6 +92,7 @@ + diff --git a/vs/2013/libobs/libobs.vcxproj.filters b/vs/2013/libobs/libobs.vcxproj.filters index c43665875..20effa18c 100644 --- a/vs/2013/libobs/libobs.vcxproj.filters +++ b/vs/2013/libobs/libobs.vcxproj.filters @@ -201,6 +201,9 @@ libobs\Header Files + + libobs\Header Files + @@ -332,5 +335,8 @@ libobs\Source Files + + libobs\Source Files + \ No newline at end of file