| 641 | } |
| 642 | |
| 643 | static int sanitize_audio_codec(int in_codec, int out_codec, |
| 644 | int copy_mask, int fallback, int mux) |
| 645 | { |
| 646 | int codec = out_codec; |
| 647 | if (out_codec == HB_ACODEC_AUTO_PASS) |
| 648 | { |
| 649 | codec = hb_autopassthru_get_encoder(in_codec, copy_mask, fallback, mux); |
| 650 | } |
| 651 | else if ((out_codec & HB_ACODEC_PASS_FLAG) && |
| 652 | !(in_codec & out_codec & HB_ACODEC_PASS_MASK)) |
| 653 | { |
| 654 | codec = hb_audio_encoder_get_fallback_for_passthru(out_codec); |
| 655 | if (codec == HB_ACODEC_INVALID) |
| 656 | codec = fallback; |
| 657 | } |
| 658 | |
| 659 | // Check that encoder is valid for mux |
| 660 | const hb_encoder_t *encoder = NULL; |
| 661 | while ((encoder = hb_audio_encoder_get_next(encoder)) != NULL) |
| 662 | { |
| 663 | if (encoder->codec == codec && codec != HB_ACODEC_NONE && |
| 664 | !(encoder->muxers & mux)) |
| 665 | { |
| 666 | codec = hb_audio_encoder_get_default(mux); |
| 667 | break; |
| 668 | } |
| 669 | } |
| 670 | if (codec == HB_ACODEC_INVALID) |
| 671 | codec = hb_audio_encoder_get_default(mux); |
| 672 | return codec; |
| 673 | } |
| 674 | |
| 675 | void hb_sanitize_audio_settings(const hb_title_t * title, |
| 676 | hb_value_t * audio_settings) |
no test coverage detected