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

Function best_linked_audio

libhb/preset.c:467–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467static hb_audio_config_t * best_linked_audio(hb_list_t * list_audio,
468 hb_audio_config_t * audio,
469 int out_codec, int copy_mask,
470 int mix_channels)
471{
472 if (audio->list_linked_index == NULL)
473 {
474 return audio;
475 }
476
477 hb_audio_config_t * best_pass_audio = NULL;
478 if (out_codec == HB_ACODEC_AUTO_PASS)
479 {
480 // Autopassthru
481 if (audio->in.codec & copy_mask)
482 {
483 best_pass_audio = audio;
484 }
485 }
486 else if (out_codec & HB_ACODEC_PASS_FLAG)
487 {
488 // Specific codec passthru
489 if (audio->in.codec & out_codec)
490 {
491 best_pass_audio = audio;
492 }
493 }
494 hb_audio_config_t * best_audio = audio;
495 int count = hb_list_count(audio->list_linked_index);
496 int ii;
497 for (ii = 0; ii < count; ii++)
498 {
499 int linked_index;
500 hb_audio_config_t * linked_audio;
501
502 linked_index = *(int*)hb_list_item(audio->list_linked_index, ii);
503 linked_audio = hb_list_audio_config_item(list_audio, linked_index);
504 if (out_codec == HB_ACODEC_AUTO_PASS)
505 {
506 // If auto-passthru, select the best that can be passed
507 if (linked_audio->in.codec & copy_mask)
508 {
509 best_pass_audio = better_audio(linked_audio, best_pass_audio);
510 }
511 }
512 else if (out_codec & HB_ACODEC_PASS_FLAG)
513 {
514 // if passthru for a specific codec, check if either option is
515 // the requested codec
516 if (linked_audio->in.codec & out_codec)
517 {
518 best_pass_audio = better_audio(linked_audio, best_pass_audio);
519 }
520 }
521 best_audio = better_audio(linked_audio, best_audio);
522 }
523 if (best_pass_audio != NULL)
524 {

Callers 1

add_audio_for_langFunction · 0.85

Calls 4

hb_list_countFunction · 0.85
hb_list_itemFunction · 0.85
better_audioFunction · 0.85

Tested by

no test coverage detected