Report bit depth from sound frame, and handle 16-bit.
[libdcp.git] / src / sound_frame.h
index 3cd3246b71009cd85b4f9e2cee92882bc7db481d..72ab5925c13a510ba991225a84f393b0a667b7ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
     files in the program, then also delete it here.
 */
 
+
 /** @file  src/sound_frame.h
- *  @brief SoundFrame class.
+ *  @brief SoundFrame class
  */
 
+
 #ifndef LIBDCP_SOUND_FRAME_H
 #define LIBDCP_SOUND_FRAME_H
 
-#include <boost/noncopyable.hpp>
-#include <boost/filesystem.hpp>
-#include <stdint.h>
-#include <string>
 
-namespace ASDCP {
-       namespace PCM {
-               class FrameBuffer;
-               class MXFReader;
-       }
-       class AESDecContext;
-}
+#include "frame.h"
+#include <asdcp/AS_DCP.h>
+
 
 namespace dcp {
 
-class DecryptionContext;
 
-/** @class SoundFrame
- *  @brief One &lsquo;frame&rsquo; of sound data from a SoundAsset.
- */
-class SoundFrame : public boost::noncopyable
+class SoundFrame : public Frame<ASDCP::PCM::MXFReader, ASDCP::PCM::FrameBuffer>
 {
 public:
-       ~SoundFrame ();
+       SoundFrame (ASDCP::PCM::MXFReader* reader, int n, std::shared_ptr<const DecryptionContext> c, bool check_hmac);
+       int channels () const;
+       int samples () const;
 
-       uint8_t const * data () const;
-       int size () const;
-
-private:
-       friend class SoundAssetReader;
+       int bits() const {
+               return _bits;
+       }
 
-       SoundFrame (ASDCP::PCM::MXFReader* reader, int n, boost::shared_ptr<DecryptionContext>);
+       int32_t get (int channel, int sample) const;
 
-       /** a buffer to hold the frame */
-       ASDCP::PCM::FrameBuffer* _buffer;
+private:
+       int _channels;
+       int _bits;
 };
 
+
 }
 
+
 #endif