MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / audio_codec_changed_cb

Function audio_codec_changed_cb

gtk/src/audiohandler.c:973–1062  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

971}
972
973G_MODULE_EXPORT void
974audio_codec_changed_cb (GtkWidget *widget, gpointer data)
975{
976 static gint prev_acodec = 0;
977 gint acodec;
978 signal_user_data_t *ud = ghb_ud();
979
980 ghb_widget_to_setting(ud->settings, widget);
981 audio_update_setting(ghb_widget_value(widget), "Encoder", ud);
982
983 acodec = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoder");
984
985 float low, high, gran, defval;
986 int dir;
987 GhbValue *asettings;
988 hb_audio_quality_get_limits(acodec, &low, &high, &gran, &dir);
989 defval = hb_audio_quality_get_default(acodec);
990 asettings = audio_get_selected_settings(ud, NULL);
991 if (asettings != NULL && ghb_audio_quality_enabled(asettings))
992 {
993 gdouble quality = ghb_dict_get_double(asettings, "Quality");
994 if (low <= quality && quality <= high)
995 {
996 defval = quality;
997 }
998 }
999 GtkScaleButton *sb;
1000 GtkAdjustment *adj;
1001 sb = GTK_SCALE_BUTTON(ghb_builder_widget("AudioTrackQualityX"));
1002 adj = gtk_scale_button_get_adjustment(sb);
1003 if (dir)
1004 {
1005 // Quality values are inverted
1006 defval = high - defval + low;
1007 }
1008 gtk_adjustment_configure(adj, defval, low, high, gran, gran, 0);
1009
1010 if (block_updates)
1011 {
1012 prev_acodec = acodec;
1013 return;
1014 }
1015
1016 if (ghb_audio_is_passthru(prev_acodec) &&
1017 !ghb_audio_is_passthru(acodec))
1018 {
1019 // Transition from passthru to not, put some audio settings back to
1020 // pref settings
1021 gint track;
1022 gint br, sr, mix;
1023 const char * layout;
1024 GhbValue * atrack;
1025
1026 if (asettings != NULL)
1027 {
1028 br = ghb_dict_get_int(asettings, "Bitrate");
1029 sr = ghb_dict_get_int(asettings, "Samplerate");
1030 mix = ghb_settings_mixdown_mix(asettings, "Mixdown");

Callers

nothing calls this directly

Calls 15

ghb_udFunction · 0.85
ghb_widget_to_settingFunction · 0.85
audio_update_settingFunction · 0.85
ghb_widget_valueFunction · 0.85
ghb_dict_get_doubleFunction · 0.85
ghb_builder_widgetFunction · 0.85
ghb_audio_is_passthruFunction · 0.85

Tested by

no test coverage detected