Improve naming scheme of libobs core structures
This commit is contained in:
parent
ab4ab95790
commit
89cfbdc033
@ -51,7 +51,7 @@ struct obs_display {
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
struct obs_video {
|
||||
struct obs_core_video {
|
||||
graphics_t graphics;
|
||||
stagesurf_t copy_surfaces[NUM_TEXTURES];
|
||||
texture_t render_textures[NUM_TEXTURES];
|
||||
@ -71,13 +71,13 @@ struct obs_video {
|
||||
uint32_t base_height;
|
||||
};
|
||||
|
||||
struct obs_audio {
|
||||
struct obs_core_audio {
|
||||
/* TODO: sound output subsystem */
|
||||
audio_t audio;
|
||||
};
|
||||
|
||||
/* user sources, output channels, and displays */
|
||||
struct obs_program_data {
|
||||
struct obs_core_data {
|
||||
/* arrays of pointers jim? you should really stop being lazy and use
|
||||
* linked lists. */
|
||||
DARRAY(struct obs_display*) displays;
|
||||
@ -94,7 +94,7 @@ struct obs_program_data {
|
||||
volatile bool valid;
|
||||
};
|
||||
|
||||
struct obs_subsystem {
|
||||
struct obs_core {
|
||||
DARRAY(struct obs_module) modules;
|
||||
DARRAY(struct source_info) input_types;
|
||||
DARRAY(struct source_info) filter_types;
|
||||
@ -110,11 +110,11 @@ struct obs_subsystem {
|
||||
|
||||
/* segmented into multiple sub-structures to keep things a bit more
|
||||
* clean and organized */
|
||||
struct obs_video video;
|
||||
struct obs_audio audio;
|
||||
struct obs_program_data data;
|
||||
struct obs_core_video video;
|
||||
struct obs_core_audio audio;
|
||||
struct obs_core_data data;
|
||||
};
|
||||
|
||||
extern struct obs_subsystem *obs;
|
||||
extern struct obs_core *obs;
|
||||
|
||||
extern void *obs_video_thread(void *param);
|
||||
|
@ -236,7 +236,7 @@ void obs_source_release(obs_source_t source)
|
||||
|
||||
void obs_source_remove(obs_source_t source)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
size_t id;
|
||||
|
||||
pthread_mutex_lock(&data->sources_mutex);
|
||||
|
@ -113,7 +113,7 @@ static inline void set_render_size(uint32_t width, uint32_t height)
|
||||
|
||||
static inline void render_channels(void)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
|
||||
for (size_t i = 0; i < MAX_CHANNELS; i++) {
|
||||
struct obs_source *source = data->channels[i];
|
||||
@ -122,7 +122,7 @@ static inline void render_channels(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void unmap_last_surface(struct obs_video *video)
|
||||
static inline void unmap_last_surface(struct obs_core_video *video)
|
||||
{
|
||||
if (video->mapped_surface) {
|
||||
stagesurface_unmap(video->mapped_surface);
|
||||
@ -130,8 +130,8 @@ static inline void unmap_last_surface(struct obs_video *video)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void render_main_texture(struct obs_video *video, int cur_texture,
|
||||
int prev_texture)
|
||||
static inline void render_main_texture(struct obs_core_video *video,
|
||||
int cur_texture, int prev_texture)
|
||||
{
|
||||
struct vec4 clear_color;
|
||||
vec4_set(&clear_color, 0.3f, 0.0f, 0.0f, 1.0f);
|
||||
@ -145,7 +145,7 @@ static inline void render_main_texture(struct obs_video *video, int cur_texture,
|
||||
video->textures_rendered[cur_texture] = true;
|
||||
}
|
||||
|
||||
static inline void render_output_texture(struct obs_video *video,
|
||||
static inline void render_output_texture(struct obs_core_video *video,
|
||||
int cur_texture, int prev_texture)
|
||||
{
|
||||
texture_t texture = video->render_textures[prev_texture];
|
||||
@ -189,7 +189,7 @@ static inline void render_output_texture(struct obs_video *video,
|
||||
video->textures_output[cur_texture] = true;
|
||||
}
|
||||
|
||||
static inline void stage_output_texture(struct obs_video *video,
|
||||
static inline void stage_output_texture(struct obs_core_video *video,
|
||||
int cur_texture, int prev_texture)
|
||||
{
|
||||
texture_t texture = video->output_textures[prev_texture];
|
||||
@ -205,7 +205,7 @@ static inline void stage_output_texture(struct obs_video *video,
|
||||
video->textures_copied[cur_texture] = true;
|
||||
}
|
||||
|
||||
static inline void render_video(struct obs_video *video, int cur_texture,
|
||||
static inline void render_video(struct obs_core_video *video, int cur_texture,
|
||||
int prev_texture)
|
||||
{
|
||||
gs_beginscene();
|
||||
@ -222,7 +222,7 @@ static inline void render_video(struct obs_video *video, int cur_texture,
|
||||
gs_endscene();
|
||||
}
|
||||
|
||||
static inline void output_video(struct obs_video *video, int cur_texture,
|
||||
static inline void output_video(struct obs_core_video *video, int cur_texture,
|
||||
int prev_texture, uint64_t timestamp)
|
||||
{
|
||||
stagesurf_t surface = video->copy_surfaces[prev_texture];
|
||||
@ -241,7 +241,7 @@ static inline void output_video(struct obs_video *video, int cur_texture,
|
||||
|
||||
static inline void output_frame(uint64_t timestamp)
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
int cur_texture = video->cur_texture;
|
||||
int prev_texture = cur_texture == 0 ? NUM_TEXTURES-1 : cur_texture-1;
|
||||
|
||||
|
40
libobs/obs.c
40
libobs/obs.c
@ -21,7 +21,7 @@
|
||||
#include "obs-internal.h"
|
||||
#include "obs-module.h"
|
||||
|
||||
struct obs_subsystem *obs = NULL;
|
||||
struct obs_core *obs = NULL;
|
||||
|
||||
extern char *find_libobs_data_file(const char *file);
|
||||
|
||||
@ -50,7 +50,7 @@ static inline void make_video_info(struct video_output_info *vi,
|
||||
|
||||
static bool obs_init_textures(struct obs_video_info *ovi)
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < NUM_TEXTURES; i++) {
|
||||
@ -81,7 +81,7 @@ static bool obs_init_textures(struct obs_video_info *ovi)
|
||||
|
||||
static bool obs_init_graphics(struct obs_video_info *ovi)
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
struct gs_init_data graphics_data;
|
||||
bool success = true;
|
||||
int errorcode;
|
||||
@ -119,7 +119,7 @@ static bool obs_init_graphics(struct obs_video_info *ovi)
|
||||
|
||||
static bool obs_init_video(struct obs_video_info *ovi)
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
struct video_output_info vi;
|
||||
int errorcode;
|
||||
|
||||
@ -146,7 +146,7 @@ static bool obs_init_video(struct obs_video_info *ovi)
|
||||
|
||||
static void obs_free_video()
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
|
||||
if (video->video) {
|
||||
void *thread_retval;
|
||||
@ -164,7 +164,7 @@ static void obs_free_video()
|
||||
|
||||
static void obs_free_graphics()
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
size_t i;
|
||||
|
||||
if (video->graphics) {
|
||||
@ -197,7 +197,7 @@ static void obs_free_graphics()
|
||||
|
||||
static bool obs_init_audio(struct audio_output_info *ai)
|
||||
{
|
||||
struct obs_audio *audio = &obs->audio;
|
||||
struct obs_core_audio *audio = &obs->audio;
|
||||
int errorcode;
|
||||
|
||||
/* TODO: sound subsystem */
|
||||
@ -215,16 +215,16 @@ static bool obs_init_audio(struct audio_output_info *ai)
|
||||
|
||||
static void obs_free_audio(void)
|
||||
{
|
||||
struct obs_audio *audio = &obs->audio;
|
||||
struct obs_core_audio *audio = &obs->audio;
|
||||
if (audio->audio)
|
||||
audio_output_close(audio->audio);
|
||||
|
||||
memset(audio, 0, sizeof(struct obs_audio));
|
||||
memset(audio, 0, sizeof(struct obs_core_audio));
|
||||
}
|
||||
|
||||
static bool obs_init_data(void)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
pthread_mutexattr_t attr;
|
||||
bool success = false;
|
||||
|
||||
@ -252,7 +252,7 @@ fail:
|
||||
|
||||
static void obs_free_data(void)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
uint32_t i;
|
||||
|
||||
data->valid = false;
|
||||
@ -291,8 +291,8 @@ static inline bool obs_init_handlers(void)
|
||||
|
||||
static bool obs_init(void)
|
||||
{
|
||||
obs = bmalloc(sizeof(struct obs_subsystem));
|
||||
memset(obs, 0, sizeof(struct obs_subsystem));
|
||||
obs = bmalloc(sizeof(struct obs_core));
|
||||
memset(obs, 0, sizeof(struct obs_core));
|
||||
|
||||
obs_init_data();
|
||||
return obs_init_handlers();
|
||||
@ -346,7 +346,7 @@ void obs_shutdown(void)
|
||||
|
||||
bool obs_reset_video(struct obs_video_info *ovi)
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
|
||||
obs_free_video();
|
||||
|
||||
@ -372,7 +372,7 @@ bool obs_reset_audio(struct audio_output_info *ai)
|
||||
|
||||
bool obs_get_video_info(struct obs_video_info *ovi)
|
||||
{
|
||||
struct obs_video *video = &obs->video;
|
||||
struct obs_core_video *video = &obs->video;
|
||||
const struct video_output_info *info;
|
||||
|
||||
if (!obs || !video->graphics)
|
||||
@ -394,7 +394,7 @@ bool obs_get_video_info(struct obs_video_info *ovi)
|
||||
|
||||
bool obs_get_audio_info(struct audio_output_info *aoi)
|
||||
{
|
||||
struct obs_audio *audio = &obs->audio;
|
||||
struct obs_core_audio *audio = &obs->audio;
|
||||
const struct audio_output_info *info;
|
||||
|
||||
if (!obs || !audio->audio)
|
||||
@ -562,7 +562,7 @@ void obs_set_output_source(uint32_t channel, obs_source_t source)
|
||||
|
||||
void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t), void *param)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
|
||||
pthread_mutex_lock(&data->outputs_mutex);
|
||||
|
||||
@ -575,7 +575,7 @@ void obs_enum_outputs(bool (*enum_proc)(void*, obs_output_t), void *param)
|
||||
|
||||
void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t), void *param)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
|
||||
pthread_mutex_lock(&data->encoders_mutex);
|
||||
|
||||
@ -588,7 +588,7 @@ void obs_enum_encoders(bool (*enum_proc)(void*, obs_encoder_t), void *param)
|
||||
|
||||
void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t), void *param)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
|
||||
pthread_mutex_lock(&data->sources_mutex);
|
||||
|
||||
@ -601,7 +601,7 @@ void obs_enum_sources(bool (*enum_proc)(void*, obs_source_t), void *param)
|
||||
|
||||
obs_source_t obs_get_source_by_name(const char *name)
|
||||
{
|
||||
struct obs_program_data *data = &obs->data;
|
||||
struct obs_core_data *data = &obs->data;
|
||||
struct obs_source *source = NULL;
|
||||
size_t i;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user