From 186b6bdf40bfe7a79ae4df047ee0c400d276bdd9 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Sun, 17 Mar 2024 11:39:26 -0400 Subject: [PATCH 1/4] Update macOS brew command and fix compiler warnings --- .github/scripts/utils.zsh/check_macos | 2 +- cmake/linux/compilerconfig.cmake | 3 +- src/transcription-filter-data.h | 2 +- src/transcription-filter.cpp | 40 ++++++++++++++------------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/.github/scripts/utils.zsh/check_macos b/.github/scripts/utils.zsh/check_macos index 54b5fbf..9c63496 100644 --- a/.github/scripts/utils.zsh/check_macos +++ b/.github/scripts/utils.zsh/check_macos @@ -17,6 +17,6 @@ if (( ! ${+commands[brew]} )) { return 2 } -brew bundle --file ${SCRIPT_HOME}/.Brewfile +brew bundle --no-upgrade --file ${SCRIPT_HOME}/.Brewfile rehash log_group diff --git a/cmake/linux/compilerconfig.cmake b/cmake/linux/compilerconfig.cmake index 67d2b74..3d18c06 100644 --- a/cmake/linux/compilerconfig.cmake +++ b/cmake/linux/compilerconfig.cmake @@ -38,7 +38,8 @@ set(_obs_gcc_c_options -Wunused-parameter -Wunused-value -Wunused-variable - -Wvla) + -Wvla + -Wno-error=deprecated-declarations) # gcc options for C++ set(_obs_gcc_cxx_options diff --git a/src/transcription-filter-data.h b/src/transcription-filter-data.h index 1e877e5..f370765 100644 --- a/src/transcription-filter-data.h +++ b/src/transcription-filter-data.h @@ -15,7 +15,7 @@ #include #include -#define MAX_PREPROC_CHANNELS 2 +#define MAX_PREPROC_CHANNELS 10 #define MT_ obs_module_text diff --git a/src/transcription-filter.cpp b/src/transcription-filter.cpp index 3d1dd50..37e2df1 100644 --- a/src/transcription-filter.cpp +++ b/src/transcription-filter.cpp @@ -512,7 +512,7 @@ void *transcription_filter_create(obs_data_t *settings, obs_source_t *filter) obs_data_get_bool(settings, "rename_file_to_match_recording"); gf->process_while_muted = obs_data_get_bool(settings, "process_while_muted"); - for (size_t i = 0; i < MAX_AUDIO_CHANNELS; i++) { + for (size_t i = 0; i < gf->channels; i++) { circlebuf_init(&gf->input_buffers[i]); } circlebuf_init(&gf->info_buffer); @@ -614,6 +614,25 @@ void *transcription_filter_create(obs_data_t *settings, obs_source_t *filter) return gf; } +bool subs_output_select_changed(obs_properties_t *props, + obs_property_t *property, + obs_data_t *settings) { + UNUSED_PARAMETER(property); + // Show or hide the output filename selection input + const char *new_output = obs_data_get_string(settings, "subtitle_sources"); + const bool show_hide = (strcmp(new_output, "text_file") == 0); + obs_property_set_visible(obs_properties_get(props, "subtitle_output_filename"), + show_hide); + obs_property_set_visible(obs_properties_get(props, "subtitle_save_srt"), show_hide); + obs_property_set_visible(obs_properties_get(props, "truncate_output_file"), + show_hide); + obs_property_set_visible(obs_properties_get(props, "only_while_recording"), + show_hide); + obs_property_set_visible( + obs_properties_get(props, "rename_file_to_match_recording"), show_hide); + return true; +} + void transcription_filter_activate(void *data) { struct transcription_filter_data *gf = @@ -731,24 +750,7 @@ obs_properties_t *transcription_filter_properties(void *data) obs_properties_add_bool(ppts, "rename_file_to_match_recording", MT_("rename_file_to_match_recording")); - obs_property_set_modified_callback(subs_output, [](obs_properties_t *props, - obs_property_t *property, - obs_data_t *settings) { - UNUSED_PARAMETER(property); - // Show or hide the output filename selection input - const char *new_output = obs_data_get_string(settings, "subtitle_sources"); - const bool show_hide = (strcmp(new_output, "text_file") == 0); - obs_property_set_visible(obs_properties_get(props, "subtitle_output_filename"), - show_hide); - obs_property_set_visible(obs_properties_get(props, "subtitle_save_srt"), show_hide); - obs_property_set_visible(obs_properties_get(props, "truncate_output_file"), - show_hide); - obs_property_set_visible(obs_properties_get(props, "only_while_recording"), - show_hide); - obs_property_set_visible( - obs_properties_get(props, "rename_file_to_match_recording"), show_hide); - return true; - }); + obs_property_set_modified_callback(subs_output, subs_output_select_changed); // Add a list of available whisper models to download obs_property_t *whisper_models_list = From 0db748af3646abe77752ea834a930f12850dcfde Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Sun, 17 Mar 2024 11:41:31 -0400 Subject: [PATCH 2/4] Add -Wno-error=deprecated-declarations flag to gcc options --- cmake/linux/compilerconfig.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/linux/compilerconfig.cmake b/cmake/linux/compilerconfig.cmake index 3d18c06..3d1c95f 100644 --- a/cmake/linux/compilerconfig.cmake +++ b/cmake/linux/compilerconfig.cmake @@ -21,6 +21,7 @@ set(_obs_gcc_c_options -Wformat -Wformat-security -Wno-conversion + -Wno-error=deprecated-declarations -Wno-float-conversion -Wno-implicit-fallthrough -Wno-missing-braces @@ -38,8 +39,7 @@ set(_obs_gcc_c_options -Wunused-parameter -Wunused-value -Wunused-variable - -Wvla - -Wno-error=deprecated-declarations) + -Wvla) # gcc options for C++ set(_obs_gcc_cxx_options From c74562448f2af80e559d6de9b48655d71f166976 Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Sun, 17 Mar 2024 11:43:01 -0400 Subject: [PATCH 3/4] Refactor code for lead and trail byte checks --- src/transcription-filter.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/transcription-filter.cpp b/src/transcription-filter.cpp index 37e2df1..33c20ca 100644 --- a/src/transcription-filter.cpp +++ b/src/transcription-filter.cpp @@ -184,8 +184,8 @@ void acquire_weak_text_source_ref(struct transcription_filter_data *gf) } } -#define is_lead_byte(c) (((c)&0xe0) == 0xc0 || ((c)&0xf0) == 0xe0 || ((c)&0xf8) == 0xf0) -#define is_trail_byte(c) (((c)&0xc0) == 0x80) +#define is_lead_byte(c) (((c) & 0xe0) == 0xc0 || ((c) & 0xf0) == 0xe0 || ((c) & 0xf8) == 0xf0) +#define is_trail_byte(c) (((c) & 0xc0) == 0x80) inline int lead_byte_length(const uint8_t c) { @@ -614,22 +614,19 @@ void *transcription_filter_create(obs_data_t *settings, obs_source_t *filter) return gf; } -bool subs_output_select_changed(obs_properties_t *props, - obs_property_t *property, - obs_data_t *settings) { +bool subs_output_select_changed(obs_properties_t *props, obs_property_t *property, + obs_data_t *settings) +{ UNUSED_PARAMETER(property); // Show or hide the output filename selection input const char *new_output = obs_data_get_string(settings, "subtitle_sources"); const bool show_hide = (strcmp(new_output, "text_file") == 0); - obs_property_set_visible(obs_properties_get(props, "subtitle_output_filename"), - show_hide); + obs_property_set_visible(obs_properties_get(props, "subtitle_output_filename"), show_hide); obs_property_set_visible(obs_properties_get(props, "subtitle_save_srt"), show_hide); - obs_property_set_visible(obs_properties_get(props, "truncate_output_file"), - show_hide); - obs_property_set_visible(obs_properties_get(props, "only_while_recording"), - show_hide); - obs_property_set_visible( - obs_properties_get(props, "rename_file_to_match_recording"), show_hide); + obs_property_set_visible(obs_properties_get(props, "truncate_output_file"), show_hide); + obs_property_set_visible(obs_properties_get(props, "only_while_recording"), show_hide); + obs_property_set_visible(obs_properties_get(props, "rename_file_to_match_recording"), + show_hide); return true; } From 7bd1e5345183f3e9bf59b47fdd8acba80001e10a Mon Sep 17 00:00:00 2001 From: Roy Shilkrot Date: Sun, 17 Mar 2024 12:02:44 -0400 Subject: [PATCH 4/4] Fix formatting of is_lead_byte and is_trail_byte macros --- src/transcription-filter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transcription-filter.cpp b/src/transcription-filter.cpp index 33c20ca..481e860 100644 --- a/src/transcription-filter.cpp +++ b/src/transcription-filter.cpp @@ -184,8 +184,8 @@ void acquire_weak_text_source_ref(struct transcription_filter_data *gf) } } -#define is_lead_byte(c) (((c) & 0xe0) == 0xc0 || ((c) & 0xf0) == 0xe0 || ((c) & 0xf8) == 0xf0) -#define is_trail_byte(c) (((c) & 0xc0) == 0x80) +#define is_lead_byte(c) (((c)&0xe0) == 0xc0 || ((c)&0xf0) == 0xe0 || ((c)&0xf8) == 0xf0) +#define is_trail_byte(c) (((c)&0xc0) == 0x80) inline int lead_byte_length(const uint8_t c) {