static bool obs_init_data(void) { struct obs_core_data *data = &obs->data; pthread_mutexattr_t attr; assert(data != NULL); pthread_mutex_init_value(&obs->data.displays_mutex); if (pthread_mutexattr_init(&attr) != 0) return false; if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) goto fail; if (pthread_mutex_init(&data->user_sources_mutex, &attr) != 0) goto fail; if (pthread_mutex_init(&data->sources_mutex, &attr) != 0) goto fail; if (pthread_mutex_init(&data->displays_mutex, &attr) != 0) goto fail; if (pthread_mutex_init(&data->outputs_mutex, &attr) != 0) goto fail; if (pthread_mutex_init(&data->encoders_mutex, &attr) != 0) goto fail; if (pthread_mutex_init(&data->services_mutex, &attr) != 0) goto fail; if (!obs_view_init(&data->main_view)) goto fail; data->valid = true; fail: pthread_mutexattr_destroy(&attr); return data->valid; }
obs_view_t *obs_view_create(void) { struct obs_view *view = bzalloc(sizeof(struct obs_view)); if (!obs_view_init(view)) { bfree(view); view = NULL; } return view; }