diff options
Diffstat (limited to 'libhb/bd.c')
-rw-r--r-- | libhb/bd.c | 121 |
1 files changed, 110 insertions, 11 deletions
diff --git a/libhb/bd.c b/libhb/bd.c index 5a03d7bd2..1cd2cff99 100644 --- a/libhb/bd.c +++ b/libhb/bd.c @@ -130,7 +130,7 @@ static void add_subtitle(int track, hb_list_t *list_subtitle, BLURAY_STREAM_INFO return; } -static void add_audio(int track, hb_list_t *list_audio, BLURAY_STREAM_INFO *bdaudio, int substream_type, uint32_t codec, uint32_t codec_param) +static void add_audio(int track, hb_list_t *list_audio, BLURAY_STREAM_INFO *bdaudio, int substream_type, uint32_t codec, uint32_t codec_param, int attributes) { const char * codec_name; hb_audio_t * audio; @@ -195,7 +195,7 @@ static void add_audio(int track, hb_list_t *list_audio, BLURAY_STREAM_INFO *bdau lang = lang_for_code2( (char*)bdaudio->lang ); - audio->config.lang.attributes = HB_AUDIO_ATTR_NONE; + audio->config.lang.attributes = attributes; snprintf( audio->config.lang.simple, sizeof( audio->config.lang.simple ), "%s", @@ -474,47 +474,146 @@ hb_title_t * hb_bd_title_scan( hb_bd_t * d, int tt, uint64_t min_duration ) case BLURAY_STREAM_TYPE_AUDIO_TRUHD: // Add 2 audio tracks. One for TrueHD and one for AC-3 add_audio(ii, title->list_audio, bdaudio, HB_SUBSTREAM_BD_AC3, - HB_ACODEC_AC3, AV_CODEC_ID_AC3); + HB_ACODEC_AC3, AV_CODEC_ID_AC3, HB_AUDIO_ATTR_NONE); add_audio(ii, title->list_audio, bdaudio, HB_SUBSTREAM_BD_TRUEHD, - HB_ACODEC_FFTRUEHD, AV_CODEC_ID_TRUEHD); + HB_ACODEC_FFTRUEHD, AV_CODEC_ID_TRUEHD, + HB_AUDIO_ATTR_NONE); break; case BLURAY_STREAM_TYPE_AUDIO_DTS: add_audio(ii, title->list_audio, bdaudio, 0, - HB_ACODEC_DCA, AV_CODEC_ID_DTS); + HB_ACODEC_DCA, AV_CODEC_ID_DTS, HB_AUDIO_ATTR_NONE); break; case BLURAY_STREAM_TYPE_AUDIO_MPEG2: case BLURAY_STREAM_TYPE_AUDIO_MPEG1: add_audio(ii, title->list_audio, bdaudio, 0, - HB_ACODEC_FFMPEG, AV_CODEC_ID_MP2); + HB_ACODEC_FFMPEG, AV_CODEC_ID_MP2, + HB_AUDIO_ATTR_NONE); break; case BLURAY_STREAM_TYPE_AUDIO_AC3PLUS: add_audio(ii, title->list_audio, bdaudio, 0, - HB_ACODEC_FFEAC3, AV_CODEC_ID_EAC3); + HB_ACODEC_FFEAC3, AV_CODEC_ID_EAC3, + HB_AUDIO_ATTR_NONE); + break; + + case BLURAY_STREAM_TYPE_AUDIO_AC3PLUS_SECONDARY: + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_FFEAC3, AV_CODEC_ID_EAC3, + HB_AUDIO_ATTR_NONE); break; case BLURAY_STREAM_TYPE_AUDIO_LPCM: add_audio(ii, title->list_audio, bdaudio, 0, - HB_ACODEC_FFMPEG, AV_CODEC_ID_PCM_BLURAY); + HB_ACODEC_FFMPEG, AV_CODEC_ID_PCM_BLURAY, + HB_AUDIO_ATTR_NONE); break; case BLURAY_STREAM_TYPE_AUDIO_AC3: add_audio(ii, title->list_audio, bdaudio, 0, - HB_ACODEC_AC3, AV_CODEC_ID_AC3); + HB_ACODEC_AC3, AV_CODEC_ID_AC3, HB_AUDIO_ATTR_NONE); break; case BLURAY_STREAM_TYPE_AUDIO_DTSHD_MASTER: case BLURAY_STREAM_TYPE_AUDIO_DTSHD: // Add 2 audio tracks. One for DTS-HD and one for DTS add_audio(ii, title->list_audio, bdaudio, HB_SUBSTREAM_BD_DTS, - HB_ACODEC_DCA, AV_CODEC_ID_DTS); + HB_ACODEC_DCA, AV_CODEC_ID_DTS, HB_AUDIO_ATTR_NONE); // DTS-HD is special. The substreams must be concatinated // DTS-core followed by DTS-hd-extensions. Setting // a substream id of 0 says use all substreams. add_audio(ii, title->list_audio, bdaudio, 0, - HB_ACODEC_DCA_HD, AV_CODEC_ID_DTS); + HB_ACODEC_DCA_HD, AV_CODEC_ID_DTS, + HB_AUDIO_ATTR_NONE); + break; + + case BLURAY_STREAM_TYPE_AUDIO_DTSHD_SECONDARY: + // BD "DTSHD_SECONDARY" is DTS Express which has no + // DTS core + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_DCA_HD, AV_CODEC_ID_DTS, + HB_AUDIO_ATTR_NONE); + break; + + default: + hb_log("scan: unknown audio pid 0x%x codec 0x%x", bdaudio->pid, + bdaudio->coding_type); + break; + } + } + + // Add all the secondary audios found in the above clip. + for (jj = 0; jj < ti->clips[audio_clip_index].sec_audio_stream_count; jj++, ii++) + { + BLURAY_STREAM_INFO * bdaudio; + + bdaudio = &ti->clips[audio_clip_index].sec_audio_streams[jj]; + + switch (bdaudio->coding_type) + { + case BLURAY_STREAM_TYPE_AUDIO_TRUHD: + // Add 2 audio tracks. One for TrueHD and one for AC-3 + add_audio(ii, title->list_audio, bdaudio, HB_SUBSTREAM_BD_AC3, + HB_ACODEC_AC3, AV_CODEC_ID_AC3, + HB_AUDIO_ATTR_SECONDARY); + add_audio(ii, title->list_audio, bdaudio, HB_SUBSTREAM_BD_TRUEHD, + HB_ACODEC_FFTRUEHD, AV_CODEC_ID_TRUEHD, + HB_AUDIO_ATTR_SECONDARY); + break; + + case BLURAY_STREAM_TYPE_AUDIO_DTS: + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_DCA, AV_CODEC_ID_DTS, + HB_AUDIO_ATTR_SECONDARY); + break; + + case BLURAY_STREAM_TYPE_AUDIO_MPEG2: + case BLURAY_STREAM_TYPE_AUDIO_MPEG1: + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_FFMPEG, AV_CODEC_ID_MP2, + HB_AUDIO_ATTR_SECONDARY); + break; + + case BLURAY_STREAM_TYPE_AUDIO_AC3PLUS: + case BLURAY_STREAM_TYPE_AUDIO_AC3PLUS_SECONDARY: + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_FFEAC3, AV_CODEC_ID_EAC3, + HB_AUDIO_ATTR_SECONDARY); + break; + + case BLURAY_STREAM_TYPE_AUDIO_LPCM: + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_FFMPEG, AV_CODEC_ID_PCM_BLURAY, + HB_AUDIO_ATTR_SECONDARY); + break; + + case BLURAY_STREAM_TYPE_AUDIO_AC3: + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_AC3, AV_CODEC_ID_AC3, + HB_AUDIO_ATTR_SECONDARY); + break; + + case BLURAY_STREAM_TYPE_AUDIO_DTSHD_MASTER: + case BLURAY_STREAM_TYPE_AUDIO_DTSHD: + // Add 2 audio tracks. One for DTS-HD and one for DTS + add_audio(ii, title->list_audio, bdaudio, HB_SUBSTREAM_BD_DTS, + HB_ACODEC_DCA, AV_CODEC_ID_DTS, + HB_AUDIO_ATTR_SECONDARY); + // DTS-HD is special. The substreams must be concatinated + // DTS-core followed by DTS-hd-extensions. Setting + // a substream id of 0 says use all substreams. + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_DCA_HD, AV_CODEC_ID_DTS, + HB_AUDIO_ATTR_SECONDARY); + break; + + case BLURAY_STREAM_TYPE_AUDIO_DTSHD_SECONDARY: + // BD "DTSHD_SECONDARY" is DTS Express which has no + // DTS core + add_audio(ii, title->list_audio, bdaudio, 0, + HB_ACODEC_DCA_HD, AV_CODEC_ID_DTS, + HB_AUDIO_ATTR_SECONDARY); break; default: |