version bump
[asdcplib.git] / src / PCMParserList.cpp
index 8d80752eb853b6a6cadf7d63ae26c360295a5da2..09bd44ce80ae70a2d0585455d6f8f2e2d65fcdc8 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2004, John Hurst
+Copyright (c) 2004-2009, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -30,9 +30,11 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #include <PCMParserList.h>
+#include <KM_log.h>
 #include <assert.h>
 
 using namespace ASDCP;
+using namespace Kumu;
 
 
 ASDCP::ParserInstance::ParserInstance() : m_p(0), m_SampleSize(0)
@@ -121,10 +123,28 @@ ASDCP::PCMParserList::OpenRead(ui32_t argc, const char** argv, Rational& Picture
       if ( ASDCP_SUCCESS(result) )
        {
          if ( i == 0 )
-           m_ADesc = I->ADesc;
-
+           {
+             m_ADesc = I->ADesc;
+           }
          else
-           m_ADesc.BlockAlign += I->ADesc.BlockAlign;
+           {
+             if ( I->ADesc.AudioSamplingRate != m_ADesc.AudioSamplingRate )
+               {
+                 DefaultLogSink().Error("AudioSamplingRate mismatch in PCM parser list.");
+                 return RESULT_FORMAT;
+               }
+
+             if ( I->ADesc.QuantizationBits  != m_ADesc.QuantizationBits )
+               {
+                 DefaultLogSink().Error("QuantizationBits mismatch in PCM parser list.");
+                 return RESULT_FORMAT;
+               }
+
+             if ( I->ADesc.ContainerDuration < m_ADesc.ContainerDuration )
+               m_ADesc.ContainerDuration = I->ADesc.ContainerDuration;
+
+             m_ADesc.BlockAlign += I->ADesc.BlockAlign;
+           }
 
          m_ChannelCount += I->ADesc.ChannelCount;
        }