--- /dev/null
+/*
+ Copyright (C) 2016 Carl Hetherington <cth@carlh.net>
+
+ This file is part of libdcp.
+
+ libdcp is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ libdcp is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libdcp. If not, see <http://www.gnu.org/licenses/>.
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of portions of this program with the
+ OpenSSL library under certain conditions as described in each
+ individual source file, and distribute linked combinations
+ including the two.
+
+ You must obey the GNU General Public License in all respects
+ for all of the code used other than OpenSSL. If you modify
+ file(s) with this exception, you may extend this exception to your
+ version of the file(s), but you are not obligated to do so. If you
+ do not wish to do so, delete this exception statement from your
+ version. If you delete this exception statement from all source
+ files in the program, then also delete it here.
+*/
+
+#include "decryption_context.h"
+#include "exceptions.h"
+#include <asdcp/KM_fileio.h>
+#include <asdcp/AS_DCP.h>
+#include <boost/noncopyable.hpp>
+
+namespace dcp {
+
+template <class R, class B>
+class Frame : public boost::noncopyable
+{
+public:
+ Frame (R* reader, int n, boost::shared_ptr<const DecryptionContext> c)
+ {
+ /* XXX: unfortunate guesswork on this buffer size */
+ _buffer = new B (Kumu::Megabyte);
+
+ if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->decryption()))) {
+ boost::throw_exception (DCPReadError ("could not read frame"));
+ }
+ }
+
+ ~Frame ()
+ {
+ delete _buffer;
+ }
+
+ uint8_t const * data () const
+ {
+ return _buffer->RoData ();
+ }
+
+ int size () const
+ {
+ return _buffer->Size ();
+ }
+
+private:
+ B* _buffer;
+};
+
+}
#include "mxf.h"
#include "types.h"
#include "metadata.h"
+#include "sound_frame.h"
namespace dcp
{
-class SoundFrame;
class SoundAssetWriter;
class SoundAssetReader;
*/
#include "asset_reader.h"
+#include "sound_frame.h"
#include <boost/shared_ptr.hpp>
namespace ASDCP {
namespace dcp {
-class SoundFrame;
class SoundAsset;
class SoundAssetReader : public AssetReader
#include "asset_writer.h"
#include "types.h"
+#include "sound_frame.h"
#include <boost/shared_ptr.hpp>
#include <boost/filesystem.hpp>
namespace dcp {
-class SoundFrame;
class SoundAsset;
/** @class SoundAssetWriter
+++ /dev/null
-/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
-
- This file is part of libdcp.
-
- libdcp is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- libdcp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with libdcp. If not, see <http://www.gnu.org/licenses/>.
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of portions of this program with the
- OpenSSL library under certain conditions as described in each
- individual source file, and distribute linked combinations
- including the two.
-
- You must obey the GNU General Public License in all respects
- for all of the code used other than OpenSSL. If you modify
- file(s) with this exception, you may extend this exception to your
- version of the file(s), but you are not obligated to do so. If you
- do not wish to do so, delete this exception statement from your
- version. If you delete this exception statement from all source
- files in the program, then also delete it here.
-*/
-
-/** @file src/sound_frame.cc
- * @brief SoundFrame class.
- */
-
-#include "sound_frame.h"
-#include "exceptions.h"
-#include "decryption_context.h"
-#include <asdcp/AS_DCP.h>
-#include <asdcp/KM_fileio.h>
-
-using namespace dcp;
-using boost::shared_ptr;
-
-SoundFrame::SoundFrame (ASDCP::PCM::MXFReader* reader, int n, shared_ptr<DecryptionContext> c)
-{
- /* XXX: unfortunate guesswork on this buffer size */
- _buffer = new ASDCP::PCM::FrameBuffer (1 * Kumu::Megabyte);
-
- if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->decryption()))) {
- boost::throw_exception (DCPReadError ("could not read audio frame"));
- }
-}
-
-SoundFrame::~SoundFrame ()
-{
- delete _buffer;
-}
-
-uint8_t const *
-SoundFrame::data () const
-{
- return _buffer->RoData();
-}
-
-int
-SoundFrame::size () const
-{
- return _buffer->Size ();
-}
#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 ‘frame’ of sound data from a SoundAsset.
- */
-class SoundFrame : public boost::noncopyable
-{
-public:
- ~SoundFrame ();
-
- uint8_t const * data () const;
- int size () const;
-
-private:
- friend class SoundAssetReader;
-
- SoundFrame (ASDCP::PCM::MXFReader* reader, int n, boost::shared_ptr<DecryptionContext>);
-
- /** a buffer to hold the frame */
- ASDCP::PCM::FrameBuffer* _buffer;
-};
+typedef Frame<ASDCP::PCM::MXFReader, ASDCP::PCM::FrameBuffer> SoundFrame;
}
sound_asset.cc
sound_asset_reader.cc
sound_asset_writer.cc
- sound_frame.cc
stereo_picture_asset.cc
stereo_picture_asset_reader.cc
stereo_picture_asset_writer.cc