This commit is contained in:
Roy Shilkrot 2023-09-08 12:26:05 -04:00
parent 11a51e7512
commit 0fb43fd42a
2 changed files with 54 additions and 50 deletions

View File

@ -228,8 +228,7 @@ void transcription_filter_update(void *data, obs_data_t *s)
if (strcmp(new_text_source_name, "none") == 0 ||
strcmp(new_text_source_name, "(null)") == 0 ||
strcmp(new_text_source_name, "text_file") == 0 ||
strlen(new_text_source_name) == 0) {
strcmp(new_text_source_name, "text_file") == 0 || strlen(new_text_source_name) == 0) {
// new selected text source is not valid, release the old one
if (gf->text_source) {
if (!gf->text_source_mutex) {
@ -498,16 +497,21 @@ obs_properties_t *transcription_filter_properties(void *data)
// Add text sources
obs_enum_sources(add_sources_to_list, subs_output);
obs_properties_add_path(ppts, "subtitle_output_filename", "Output filename", OBS_PATH_FILE_SAVE, "Text (*.txt)", NULL);
obs_properties_add_path(ppts, "subtitle_output_filename", "Output filename",
OBS_PATH_FILE_SAVE, "Text (*.txt)", NULL);
obs_property_set_modified_callback(subs_output, [](obs_properties_t *props, obs_property_t *property, obs_data_t *settings) {
obs_property_set_modified_callback(subs_output, [](obs_properties_t *props,
obs_property_t *property,
obs_data_t *settings) {
const char *new_output = obs_data_get_string(settings, "subtitle_sources");
if (strcmp(new_output, "text_file") == 0) {
// Show the output filename selection input
obs_property_set_visible(obs_properties_get(props, "subtitle_output_filename"), true);
obs_property_set_visible(
obs_properties_get(props, "subtitle_output_filename"), true);
} else {
// Hide the output filename selection input
obs_property_set_visible(obs_properties_get(props, "subtitle_output_filename"), false);
obs_property_set_visible(
obs_properties_get(props, "subtitle_output_filename"), false);
}
return true;
});