static void stinger_update(void *data, obs_data_t *settings) { struct stinger_info *s = data; const char *path = obs_data_get_string(settings, "path"); obs_data_t *media_settings = obs_data_create(); obs_data_set_string(media_settings, "local_file", path); obs_source_release(s->media_source); s->media_source = obs_source_create_private("ffmpeg_source", NULL, media_settings); obs_data_release(media_settings); int64_t point = obs_data_get_int(settings, "transition_point"); s->transition_point_is_frame = obs_data_get_int(settings, "tp_type") == TIMING_FRAME; if (s->transition_point_is_frame) s->transition_point_frame = (uint64_t)point; else s->transition_point_ns = (uint64_t)(point * 1000000LL); s->monitoring_type = (int)obs_data_get_int(settings,"audio_monitoring"); obs_source_set_monitoring_type(s->media_source, s->monitoring_type); s->fade_style = (enum fade_style)obs_data_get_int(settings, "audio_fade_style"); switch (s->fade_style) { default: case FADE_STYLE_FADE_OUT_FADE_IN: s->mix_a = mix_a_fade_in_out; s->mix_b = mix_b_fade_in_out; break; case FADE_STYLE_CROSS_FADE: s->mix_a = mix_a_cross_fade; s->mix_b = mix_b_cross_fade; break; } }
static OBSSource CreateLabel(const char *name, size_t h) { obs_data_t *settings = obs_data_create(); obs_data_t *font = obs_data_create(); std::string text; text += " "; text += name; text += " "; #if defined(_WIN32) obs_data_set_string(font, "face", "Arial"); #elif defined(__APPLE__) obs_data_set_string(font, "face", "Helvetica"); #else obs_data_set_string(font, "face", "Monospace"); #endif obs_data_set_int(font, "flags", 1); // Bold text obs_data_set_int(font, "size", int(h / 9.81)); obs_data_set_obj(settings, "font", font); obs_data_set_string(settings, "text", text.c_str()); obs_data_set_bool(settings, "outline", false); #ifdef _WIN32 const char *text_source_id = "text_gdiplus"; #else const char *text_source_id = "text_ft2_source"; #endif OBSSource txtSource = obs_source_create_private(text_source_id, name, settings); obs_source_release(txtSource); obs_data_release(font); obs_data_release(settings); return txtSource; }
obs_scene_t *obs_scene_create_private(const char *name) { struct obs_source *source = obs_source_create_private("scene", name, NULL); return source->context.data; }