Skip to content

Commit

Permalink
libhb: improve scanning of DTS audio
Browse files Browse the repository at this point in the history
It seems ffmpeg's stream probe does not always go deep enough to
trigger the decoder to fill in the DTS profile. HandBrake's subsequent
audio probe during scan picks up the profile.

Fixes HandBrake#6237
  • Loading branch information
jstebbins committed Sep 2, 2024
1 parent deb4c45 commit 5383a91
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions libhb/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,41 @@ static void LookForAudio(hb_scan_t *scan, hb_title_t * title, hb_audio_t * audio
audio->config.in.flags = info.flags;
audio->config.in.mode = info.mode;

// Under some circumstances, ffmpeg fails to probe the DTS profile
// during it's initial scan of DTS audio tracks. The profile gets
// picked up during our more indepth scan here.
if (audio->config.in.codec == HB_ACODEC_FFMPEG)
{
switch (audio->config.in.codec_param)
{
case AV_CODEC_ID_DTS:
{
switch (info.profile)
{
case AV_PROFILE_DTS:
case AV_PROFILE_DTS_ES:
case AV_PROFILE_DTS_96_24:
case AV_PROFILE_DTS_EXPRESS:
audio->config.in.codec = HB_ACODEC_DCA;
break;

case AV_PROFILE_DTS_HD_MA:
case AV_PROFILE_DTS_HD_HRA:
case AV_PROFILE_DTS_HD_MA_X:
case AV_PROFILE_DTS_HD_MA_X_IMAX:
audio->config.in.codec = HB_ACODEC_DCA_HD;
break;

default:
break;
}
} break;

default:
break;
}
}

// now that we have all the info, set the audio description
const char *codec_name = NULL;
const char *profile_name = NULL;
Expand Down

0 comments on commit 5383a91

Please sign in to comment.