Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-03-24 11:43:44 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2015-03-24 11:43:44 +0300
commit93516bb06b7d15073ce46b05093c58642ff12bff (patch)
tree60dd886299d383e71b19ca2e27f3274e3618ae08
parent202ec86dc2c913999fff07d1a6e5a5c30103eece (diff)
More generic DTS profile name handling
-rw-r--r--decoder/LAVAudio/DTSDecoder.cpp18
-rw-r--r--decoder/LAVAudio/LAVAudio.cpp26
2 files changed, 26 insertions, 18 deletions
diff --git a/decoder/LAVAudio/DTSDecoder.cpp b/decoder/LAVAudio/DTSDecoder.cpp
index f2c3ea86..28082cd4 100644
--- a/decoder/LAVAudio/DTSDecoder.cpp
+++ b/decoder/LAVAudio/DTSDecoder.cpp
@@ -315,6 +315,10 @@ int CLAVAudio::SafeDTSDecode(BYTE *pInput, int len, BYTE *pOutput, int unk1, int
return nPCMLen;
};
+static const int DTSProfiles[] = {
+ FF_PROFILE_DTS, FF_PROFILE_UNKNOWN, FF_PROFILE_DTS_ES, FF_PROFILE_DTS_96_24, FF_PROFILE_UNKNOWN, FF_PROFILE_DTS_HD_HRA, FF_PROFILE_DTS_HD_MA, FF_PROFILE_DTS_EXPRESS
+};
+
HRESULT CLAVAudio::DecodeDTS(const BYTE * pDataBuffer, int buffsize, int &consumed, HRESULT *hrDeliver)
{
HRESULT hr = S_FALSE;
@@ -397,14 +401,18 @@ HRESULT CLAVAudio::DecodeDTS(const BYTE * pDataBuffer, int buffsize, int &consum
out.dwChannelMask = get_channel_mask(channels); // TODO
out.wBitsPerSample = bitdepth;
- // DTS Express
- if (profile == 0 && !m_bsParser.m_DTSHeader.HasCore) {
- profile = 1 << 7;
- }
+ int profile_index = 0;
+ while(profile >>= 1) profile_index++;
+
+ if (profile_index > 7)
+ m_pAVCtx->profile = FF_PROFILE_UNKNOWN;
+ else if (profile == 0 && !m_bsParser.m_DTSHeader.HasCore)
+ m_pAVCtx->profile = FF_PROFILE_DTS_EXPRESS;
+ else
+ m_pAVCtx->profile = DTSProfiles[profile_index];
// TODO: get rid of these
m_pAVCtx->sample_rate = HDSampleRate;
- m_pAVCtx->profile = profile;
m_pAVCtx->bits_per_raw_sample = bitdepth;
// Send current input time to the delivery function
diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp
index 3f5729ab..2ebf6679 100644
--- a/decoder/LAVAudio/LAVAudio.cpp
+++ b/decoder/LAVAudio/LAVAudio.cpp
@@ -813,19 +813,19 @@ HRESULT CLAVAudio::GetDecodeDetails(const char **pCodec, const char **pDecodeFor
}
} else {
if (pCodec) {
- if (m_pDTSDecoderContext) {
- static const char *DTSProfiles[] = {
- "dts", nullptr, "dts-es", "dts 96/24", nullptr, "dts-hd hra", "dts-hd ma", "dts express"
- };
-
- int index = 0, profile = m_pAVCtx ? m_pAVCtx->profile : FF_PROFILE_UNKNOWN;
- if (profile != FF_PROFILE_UNKNOWN)
- while(profile >>= 1) index++;
- if (index > 7) index = 0;
-
- *pCodec = DTSProfiles[index] ? DTSProfiles[index] : "dts";
- } else if (m_pAVCodec) {
- *pCodec = m_pAVCodec->name;
+ if (m_pAVCodec) {
+ if (m_nCodecId == AV_CODEC_ID_DTS && m_pAVCtx && m_pAVCtx->profile != FF_PROFILE_UNKNOWN) {
+ static const char *DTSProfiles[] = {
+ nullptr, nullptr, "dts", "dts-es", "dts 96/24", "dts-hd hra", "dts-hd ma", "dts express"
+ };
+ int index = m_pAVCtx->profile / 10;
+ if (index >= 0 && index < countof(DTSProfiles) && DTSProfiles[index])
+ *pCodec = DTSProfiles[index];
+ else
+ *pCodec = "dts";
+ }
+ else
+ *pCodec = m_pAVCodec->name;
}
}
if (pnChannels) {