Skip to content

Commit

Permalink
gtk: winui: macui: add vorbis and alac auto passhtru
Browse files Browse the repository at this point in the history
  • Loading branch information
galad87 committed Oct 21, 2024
1 parent d608835 commit 937886f
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 67 deletions.
2 changes: 2 additions & 0 deletions gtk/data/internal_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"AudioAllowDTSPass": false,
"AudioAllowDTSHDPass": false,
"AudioAllowEAC3Pass": false,
"AudioAllowALACPass": false,
"AudioAllowFLACPass": false,
"AudioAllowTRUEHDPass": false,
"AudioAllowVORBISPass": false,
"AudioAllowOPUSPass": false,
"AudioBitrate": "192",
"AudioEncoder": "copy:ac3",
Expand Down
8 changes: 8 additions & 0 deletions gtk/src/audiohandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ int ghb_get_copy_mask(GhbValue *settings)
{
mask |= HB_ACODEC_EAC3_PASS;
}
if (ghb_dict_get_bool(settings, "AudioAllowALACPass"))
{
mask |= HB_ACODEC_ALAC_PASS;
}
if (ghb_dict_get_bool(settings, "AudioAllowFLACPass"))
{
mask |= HB_ACODEC_FLAC_PASS;
Expand All @@ -332,6 +336,10 @@ int ghb_get_copy_mask(GhbValue *settings)
{
mask |= HB_ACODEC_TRUEHD_PASS;
}
if (ghb_dict_get_bool(settings, "AudioAllowVORBISPass"))
{
mask |= HB_ACODEC_VORBIS_PASS;
}
if (ghb_dict_get_bool(settings, "AudioAllowOPUSPass"))
{
mask |= HB_ACODEC_OPUS_PASS;
Expand Down
17 changes: 17 additions & 0 deletions gtk/src/presets.c
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,11 @@ ghb_preset_to_settings(GhbValue *settings, GhbValue *preset)
case HB_ACODEC_EAC3_PASS:
ghb_dict_set_bool(settings, "AudioAllowEAC3Pass", 1);
break;
case HB_ACODEC_FFALAC:
case HB_ACODEC_FFALAC24:
case HB_ACODEC_ALAC_PASS:
ghb_dict_set_bool(settings, "AudioAllowALACPass", 1);
break;
case HB_ACODEC_FFFLAC:
case HB_ACODEC_FFFLAC24:
case HB_ACODEC_FLAC_PASS:
Expand All @@ -498,6 +503,10 @@ ghb_preset_to_settings(GhbValue *settings, GhbValue *preset)
case HB_ACODEC_TRUEHD_PASS:
ghb_dict_set_bool(settings, "AudioAllowTRUEHDPass", 1);
break;
case HB_ACODEC_VORBIS:
case HB_ACODEC_VORBIS_PASS:
ghb_dict_set_bool(settings, "AudioAllowOPUSPass", 1);
break;
case HB_ACODEC_OPUS:
case HB_ACODEC_OPUS_PASS:
ghb_dict_set_bool(settings, "AudioAllowOPUSPass", 1);
Expand Down Expand Up @@ -1730,6 +1739,10 @@ GhbValue* ghb_create_copy_mask(GhbValue *settings)
{
ghb_array_append(copy_mask, ghb_string_value_new("copy:eac3"));
}
if (ghb_dict_get_bool(settings, "AudioAllowALACPass"))
{
ghb_array_append(copy_mask, ghb_string_value_new("copy:alac"));
}
if (ghb_dict_get_bool(settings, "AudioAllowFLACPass"))
{
ghb_array_append(copy_mask, ghb_string_value_new("copy:flac"));
Expand All @@ -1738,6 +1751,10 @@ GhbValue* ghb_create_copy_mask(GhbValue *settings)
{
ghb_array_append(copy_mask, ghb_string_value_new("copy:truehd"));
}
if (ghb_dict_get_bool(settings, "AudioAllowVORBISPass"))
{
ghb_array_append(copy_mask, ghb_string_value_new("copy:vorbis"));
}
if (ghb_dict_get_bool(settings, "AudioAllowOPUSPass"))
{
ghb_array_append(copy_mask, ghb_string_value_new("copy:opus"));
Expand Down
39 changes: 35 additions & 4 deletions gtk/src/ui/ghb.ui
Original file line number Diff line number Diff line change
Expand Up @@ -5102,6 +5102,22 @@ This permits TrueHD passthru to be selected when automatic passthru selection is
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="AudioAllowALACPass">
<property name="label" translatable="yes">ALAC</property>
<property name="focusable">1</property>
<property name="tooltip-text" translatable="yes">Enable this if your playback device supports ALAC.
This permits ALAC passthru to be selected when automatic passthru selection is enabled.</property>
<property name="halign">start</property>
<property name="active">1</property>
<signal name="toggled" handler="audio_passthru_widget_changed_cb" swapped="no"/>
<layout>
<property name="column">2</property>
<property name="row">3</property>
</layout>
</object>
</child>
<child>
<child>
<object class="GtkCheckButton" id="AudioAllowFLACPass">
<property name="label" translatable="yes">FLAC</property>
Expand All @@ -5112,8 +5128,8 @@ This permits FLAC passthru to be selected when automatic passthru selection is e
<property name="active">1</property>
<signal name="toggled" handler="audio_passthru_widget_changed_cb" swapped="no"/>
<layout>
<property name="column">2</property>
<property name="row">3</property>
<property name="column">1</property>
<property name="row">4</property>
</layout>
</object>
</child>
Expand All @@ -5127,11 +5143,26 @@ This permits AAC passthru to be selected when automatic passthru selection is en
<property name="active">1</property>
<signal name="toggled" handler="audio_passthru_widget_changed_cb" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="column">2</property>
<property name="row">4</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="AudioAllowVORBISPass">
<property name="label" translatable="yes">Vorbis</property>
<property name="focusable">1</property>
<property name="tooltip-text" translatable="yes">Enable this if your playback device supports Vorbis.
This permits Vorbis passthru to be selected when automatic passthru selection is enabled.</property>
<property name="halign">start</property>
<property name="active">1</property>
<signal name="toggled" handler="audio_passthru_widget_changed_cb" swapped="no"/>
<layout>
<property name="column">1</property>
<property name="row">5</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="AudioAllowOPUSPass">
<property name="label" translatable="yes">Opus</property>
Expand All @@ -5143,7 +5174,7 @@ This permits Opus passthru to be selected when automatic passthru selection is e
<signal name="toggled" handler="audio_passthru_widget_changed_cb" swapped="no"/>
<layout>
<property name="column">2</property>
<property name="row">4</property>
<property name="row">5</property>
</layout>
</object>
</child>
Expand Down
Loading

0 comments on commit 937886f

Please sign in to comment.