Add GetSecondsSinceEpoch for Waimea.
authormsheby <msheby@cinecert.com>
Tue, 25 Aug 2009 20:37:34 +0000 (20:37 +0000)
committermsheby <>
Tue, 25 Aug 2009 20:37:34 +0000 (20:37 +0000)
src/KM_util.cpp
src/KM_util.h
src/PCMParserList.cpp
src/wavesplit.cpp

index ba27a37c5d6bffc554343d1a801c517ad2beef03..08ae2575f76ae0c3cfa971b0468c508d503677c7 100755 (executable)
@@ -1125,6 +1125,18 @@ Kumu::Timestamp::Archive(MemIOWriter* Writer) const
   return true;
 }
 
+//
+long
+Kumu::Timestamp::GetSecondsSinceEpoch(void) const
+{
+  Kumu::TAI::caltime ct;
+  Kumu::TAI::tai t;
+  TIMESTAMP_TO_CALTIME(*this, &ct);
+  t = ct;
+
+  return (long) (t.x - ui64_C(4611686018427387914));
+}
+
 //------------------------------------------------------------------------------------------
 
 Kumu::MemIOWriter::MemIOWriter(ByteString* Buf)
index a9c96c66311434e3684e92e1db357d9f115ab80d..28bea68470c99b92653d627183b6c5ac2540ee81 100755 (executable)
@@ -413,6 +413,9 @@ namespace Kumu
       virtual ui32_t ArchiveLength() const { return 8L; }
       virtual bool   Archive(MemIOWriter* Writer) const;
       virtual bool   Unarchive(MemIOReader* Reader);
+
+      // Get the number of seconds since the Unix epoch (1970-01-01T00:00:00+00:00)
+      long GetSecondsSinceEpoch(void) const;
     };
 
   //
index 919a76e4ca497ccdc3070fc298388850626f9d33..09bd44ce80ae70a2d0585455d6f8f2e2d65fcdc8 100755 (executable)
@@ -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;
        }
index c1897333aa4fb787ff6211019e8b2bc44115b1f1..90e7e93f4634e9398529b708c11f9bfbd8b5a489 100755 (executable)
@@ -50,7 +50,7 @@ static const char* PROGRAM_NAME = "wavesplit";    // program name for messages
 // otherwise sets the given flag.
 #define TEST_SET_MAJOR_MODE(f) if ( TEST_MAJOR_MODE() ) \
                                  { \
-                                   fputs("Conflicting major mode, choose one of -(ic)).\n", stderr); \
+                                   fputs("Conflicting major mode, choose one of -(ic).\n", stderr); \
                                    return; \
                                  } \
                                  (f) = true;