From 15e31e3641e4f85475984bf4d9ebf8ae47303a8a Mon Sep 17 00:00:00 2001 From: peak3d Date: Thu, 22 Jul 2021 11:07:13 +0200 Subject: [PATCH] Add GetChannels method Signed-off-by: Bernd Kuhls --- Source/C++/Core/Ap4Dac3Atom.cpp | 6 ++++++ Source/C++/Core/Ap4Dac3Atom.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Source/C++/Core/Ap4Dac3Atom.cpp b/Source/C++/Core/Ap4Dac3Atom.cpp index 80a511e..a9ea78a 100644 --- a/Source/C++/Core/Ap4Dac3Atom.cpp +++ b/Source/C++/Core/Ap4Dac3Atom.cpp @@ -143,3 +143,9 @@ AP4_Dac3Atom::InspectFields(AP4_AtomInspector& inspector) inspector.AddField("lfeon", m_StreamInfo.lfeon); return AP4_SUCCESS; } + +AP4_UI08 AP4_Dac3Atom::GetChannels() const +{ + static const AP4_UI08 CC[] = { 2, 1, 2, 3, 3, 4, 4, 5 }; + return CC[m_StreamInfo.acmod] + m_StreamInfo.lfeon; +} diff --git a/Source/C++/Core/Ap4Dac3Atom.h b/Source/C++/Core/Ap4Dac3Atom.h index 2532ef2..78e2875 100644 --- a/Source/C++/Core/Ap4Dac3Atom.h +++ b/Source/C++/Core/Ap4Dac3Atom.h @@ -73,6 +73,7 @@ public: const AP4_DataBuffer& GetRawBytes() const { return m_RawBytes; } unsigned int GetDataRate() const { return m_DataRate; } const StreamInfo& GetStreamInfo() const { return m_StreamInfo; } + AP4_UI08 GetChannels() const; private: // methods -- 2.30.2