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

Function audio_select_and_add_track

gtk/src/audiohandler.c:581–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581static GhbValue*
582audio_select_and_add_track(
583 const hb_title_t *title,
584 GhbValue *settings,
585 GhbValue *pref_audio,
586 const char *lang,
587 int pref_index,
588 int start_track)
589{
590 GhbValue *audio, *asettings = NULL;
591 gdouble drc, gain, quality;
592 gboolean enable_quality;
593 gint track, acodec, bitrate, samplerate, mix;
594
595 gint select_acodec;
596 gint fallback;
597
598 const char *mux_id;
599 const hb_container_t *mux;
600
601 mux_id = ghb_dict_get_string(settings, "FileFormat");
602 mux = ghb_lookup_container_by_name(mux_id);
603
604 gint copy_mask = ghb_get_copy_mask(settings);
605
606 audio = ghb_array_get(pref_audio, pref_index);
607
608 acodec = ghb_settings_audio_encoder_codec(audio, "AudioEncoder");
609 fallback = ghb_select_fallback(settings, acodec);
610
611 bitrate = ghb_settings_audio_bitrate_rate(audio, "AudioBitrate");
612 samplerate = ghb_settings_audio_samplerate_rate(audio, "AudioSamplerate");
613 mix = ghb_settings_mixdown_mix(audio, "AudioMixdown");
614 drc = ghb_dict_get_double(audio, "AudioTrackDRCSlider");
615 gain = ghb_dict_get_double(audio, "AudioTrackGainSlider");
616 enable_quality = ghb_dict_get_bool(audio, "AudioTrackQualityEnable");
617 quality = ghb_dict_get_double(audio, "AudioTrackQuality");
618 if (enable_quality)
619 {
620 bitrate = -1;
621 }
622 else
623 {
624 quality = HB_INVALID_AUDIO_QUALITY;
625 }
626
627 track = ghb_find_audio_track(title, lang, start_track);
628 if (track >= 0)
629 {
630 // Check to see if:
631 // 1. pref codec is passthru
632 // 2. source codec is not passthru
633 // 3. next pref is enabled
634 hb_audio_config_t *aconfig;
635 aconfig = hb_list_audio_config_item(title->list_audio, track);
636 select_acodec = ghb_select_audio_codec(
637 mux->format, aconfig->in.codec, acodec, fallback, copy_mask);
638

Callers 2

audio_add_cbFunction · 0.85
audio_add_all_cbFunction · 0.85

Calls 14

ghb_dict_get_stringFunction · 0.85
ghb_get_copy_maskFunction · 0.85
ghb_select_fallbackFunction · 0.85
ghb_settings_mixdown_mixFunction · 0.85
ghb_dict_get_doubleFunction · 0.85
ghb_dict_get_boolFunction · 0.85
ghb_find_audio_trackFunction · 0.85

Tested by

no test coverage detected