Skip to content

Commit

Permalink
Refactor code for lead and trail byte checks
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Mar 17, 2024
1 parent 0db748a commit c745624
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/transcription-filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit c745624

Please sign in to comment.