| 527 | } |
| 528 | |
| 529 | static GhbValue* |
| 530 | audio_add_track( |
| 531 | GhbValue *settings, |
| 532 | int track, |
| 533 | int encoder, |
| 534 | gdouble quality, |
| 535 | int bitrate, |
| 536 | int samplerate, |
| 537 | int mix, |
| 538 | gdouble drc, |
| 539 | gdouble gain) |
| 540 | { |
| 541 | GhbValue *asettings; |
| 542 | GhbValue *atrack; |
| 543 | |
| 544 | asettings = ghb_dict_new(); |
| 545 | |
| 546 | ghb_dict_set_int(asettings, "Track", track); |
| 547 | ghb_dict_set_string(asettings, "Encoder", |
| 548 | hb_audio_encoder_get_short_name(encoder)); |
| 549 | ghb_dict_set_double(asettings, "Quality", quality); |
| 550 | ghb_dict_set_int(asettings, "Bitrate", bitrate); |
| 551 | ghb_dict_set_int(asettings, "Samplerate", samplerate); |
| 552 | |
| 553 | atrack = ghb_get_title_audio_track(settings, track); |
| 554 | if (atrack != NULL) |
| 555 | { |
| 556 | const char * layout = ghb_dict_get_string(atrack, "ChannelLayout"); |
| 557 | mix = ghb_get_best_mix(layout, encoder, mix); |
| 558 | |
| 559 | int keep_name = ghb_dict_get_int(settings, "AudioTrackNamePassthru"); |
| 560 | const char * behavior_name = ghb_dict_get_string(settings, "AudioAutomaticNamingBehavior"); |
| 561 | int behavior = hb_audio_autonaming_behavior_get_from_name(behavior_name); |
| 562 | |
| 563 | const char * name = ghb_dict_get_string(atrack, "Name"); |
| 564 | const char * generated_name = hb_audio_name_generate_s(name, layout, mix, |
| 565 | keep_name, behavior); |
| 566 | if (generated_name != NULL) |
| 567 | { |
| 568 | ghb_dict_set_string(asettings, "Name", generated_name); |
| 569 | } |
| 570 | } |
| 571 | ghb_dict_set_string(asettings, "Mixdown", hb_mixdown_get_short_name(mix)); |
| 572 | ghb_dict_set_double(asettings, "DRC", drc); |
| 573 | ghb_dict_set_double(asettings, "Gain", gain); |
| 574 | |
| 575 | ghb_sanitize_audio_settings(settings, asettings); |
| 576 | audio_add_to_settings(settings, asettings); |
| 577 | |
| 578 | return asettings; |
| 579 | } |
| 580 | |
| 581 | static GhbValue* |
| 582 | audio_select_and_add_track( |
no test coverage detected