+++ /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 "asset_reader.h"
-#include "mxf.h"
-#include "exceptions.h"
-#include "decryption_context.h"
-#include <asdcp/AS_DCP.h>
-
-using namespace dcp;
-
-AssetReader::AssetReader (MXF const * mxf)
- : _decryption_context (new DecryptionContext (mxf->key ()))
-{
-
-}
#ifndef LIBDCP_ASSET_READER_H
#define LIBDCP_ASSET_READER_H
+#include "dcp_assert.h"
+#include "asset.h"
+#include <asdcp/AS_DCP.h>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
namespace dcp {
-class MXF;
class DecryptionContext;
+template <class R, class F>
class AssetReader : public boost::noncopyable
{
public:
- explicit AssetReader (MXF const * mxf);
- virtual ~AssetReader () {}
+ explicit AssetReader (Asset const * asset)
+ {
+ _reader = new R ();
+ DCP_ASSERT (asset->file ());
+ Kumu::Result_t const r = _reader->OpenRead (asset->file()->string().c_str());
+ if (ASDCP_FAILURE (r)) {
+ delete _reader;
+ boost::throw_exception (FileError ("could not open MXF file for reading", asset->file().get(), r));
+ }
+ }
+
+ ~AssetReader ()
+ {
+ delete _reader;
+ }
+
+ boost::shared_ptr<const F> get_frame (int n) const
+ {
+ return boost::shared_ptr<const F> (new F (_reader, n, _decryption_context));
+ }
protected:
+ R* _reader;
boost::shared_ptr<DecryptionContext> _decryption_context;
};
#define LIBDCP_MONO_PICTURE_ASSET_H
#include "picture_asset.h"
+#include "mono_picture_asset_reader.h"
namespace dcp {
class MonoPictureAssetWriter;
-class MonoPictureAssetReader;
/** @class MonoPictureAsset
* @brief A 2D (monoscopic) picture asset.
+++ /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 "mono_picture_asset_reader.h"
-#include "mono_picture_asset.h"
-#include "mono_picture_frame.h"
-#include "exceptions.h"
-#include "dcp_assert.h"
-#include <asdcp/AS_DCP.h>
-
-using namespace dcp;
-using boost::shared_ptr;
-
-MonoPictureAssetReader::MonoPictureAssetReader (MonoPictureAsset const * asset)
- : AssetReader (asset)
-{
- _reader = new ASDCP::JP2K::MXFReader ();
- DCP_ASSERT (asset->file ());
- Kumu::Result_t const r = _reader->OpenRead (asset->file()->string().c_str());
- if (ASDCP_FAILURE (r)) {
- delete _reader;
- boost::throw_exception (FileError ("could not open MXF file for reading", asset->file().get(), r));
- }
-}
-
-MonoPictureAssetReader::~MonoPictureAssetReader ()
-{
- delete _reader;
-}
-
-shared_ptr<const MonoPictureFrame>
-MonoPictureAssetReader::get_frame (int n) const
-{
- return shared_ptr<const MonoPictureFrame> (new MonoPictureFrame (_reader, n, _decryption_context));
-}
*/
#include "asset_reader.h"
-#include <boost/shared_ptr.hpp>
-
-namespace ASDCP {
- namespace JP2K {
- class MXFReader;
- }
-}
namespace dcp {
class MonoPictureFrame;
-class MonoPictureAsset;
-
-class MonoPictureAssetReader : public AssetReader
-{
-public:
- ~MonoPictureAssetReader ();
- boost::shared_ptr<const MonoPictureFrame> get_frame (int n) const;
-
-private:
- friend class MonoPictureAsset;
-
- explicit MonoPictureAssetReader (MonoPictureAsset const *);
- ASDCP::JP2K::MXFReader* _reader;
-};
+typedef AssetReader<ASDCP::JP2K::MXFReader, MonoPictureFrame> MonoPictureAssetReader;
}
*/
#include "types.h"
+#include "mono_picture_asset_reader.h"
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <boost/filesystem.hpp>
int j2k_size () const;
private:
- friend class MonoPictureAssetReader;
+ friend MonoPictureAssetReader;
MonoPictureFrame (ASDCP::JP2K::MXFReader* reader, int n, boost::shared_ptr<DecryptionContext>);
#include "types.h"
#include "metadata.h"
#include "sound_frame.h"
+#include "sound_asset_reader.h"
namespace dcp
{
class SoundAssetWriter;
-class SoundAssetReader;
/** @class SoundAsset
* @brief Representation of a sound asset
+++ /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 "sound_asset_reader.h"
-#include "sound_asset.h"
-#include "sound_frame.h"
-#include "exceptions.h"
-#include "dcp_assert.h"
-#include <asdcp/AS_DCP.h>
-
-using boost::shared_ptr;
-using namespace dcp;
-
-SoundAssetReader::SoundAssetReader (SoundAsset const * asset)
- : AssetReader (asset)
-{
- _reader = new ASDCP::PCM::MXFReader ();
- DCP_ASSERT (asset->file ());
- Kumu::Result_t const r = _reader->OpenRead (asset->file()->string().c_str());
- if (ASDCP_FAILURE (r)) {
- delete _reader;
- boost::throw_exception (FileError ("could not open MXF file for reading", asset->file().get(), r));
- }
-}
-
-SoundAssetReader::~SoundAssetReader ()
-{
- delete _reader;
-}
-
-shared_ptr<const SoundFrame>
-SoundAssetReader::get_frame (int n) const
-{
- return shared_ptr<const SoundFrame> (new SoundFrame (_reader, n, _decryption_context));
-}
*/
#include "asset_reader.h"
-#include "sound_frame.h"
-#include <boost/shared_ptr.hpp>
-
-namespace ASDCP {
- namespace PCM {
- class MXFReader;
- }
-}
namespace dcp {
-class SoundAsset;
-
-class SoundAssetReader : public AssetReader
-{
-public:
- ~SoundAssetReader ();
- boost::shared_ptr<const SoundFrame> get_frame (int n) const;
-
-private:
- friend class SoundAsset;
-
- explicit SoundAssetReader (SoundAsset const * asset);
-
- ASDCP::PCM::MXFReader* _reader;
-};
+typedef AssetReader<ASDCP::PCM::MXFReader, SoundFrame> SoundAssetReader;
}
#define LIBDCP_STEREO_PICTURE_ASSET_H
#include "picture_asset.h"
+#include "stereo_picture_asset_reader.h"
namespace dcp {
-class StereoPictureAssetReader;
-
/** A 3D (stereoscopic) picture asset */
class StereoPictureAsset : public PictureAsset
{
+++ /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 "stereo_picture_asset_reader.h"
-#include "stereo_picture_asset.h"
-#include "stereo_picture_frame.h"
-#include "exceptions.h"
-#include "dcp_assert.h"
-#include <asdcp/AS_DCP.h>
-
-using namespace dcp;
-using boost::shared_ptr;
-
-StereoPictureAssetReader::StereoPictureAssetReader (StereoPictureAsset const * asset)
- : AssetReader (asset)
-{
- _reader = new ASDCP::JP2K::MXFSReader ();
- DCP_ASSERT (asset->file ());
- Kumu::Result_t const r = _reader->OpenRead (asset->file()->string().c_str());
- if (ASDCP_FAILURE (r)) {
- delete _reader;
- boost::throw_exception (FileError ("could not open MXF file for reading", asset->file().get(), r));
- }
-}
-
-StereoPictureAssetReader::~StereoPictureAssetReader ()
-{
- delete _reader;
-}
-
-shared_ptr<const StereoPictureFrame>
-StereoPictureAssetReader::get_frame (int n) const
-{
- return shared_ptr<const StereoPictureFrame> (new StereoPictureFrame (_reader, n, _decryption_context));
-}
*/
#include "asset_reader.h"
-#include <boost/shared_ptr.hpp>
-
-namespace ASDCP {
- namespace JP2K {
- class MXFSReader;
- }
-}
namespace dcp {
class StereoPictureFrame;
-class StereoPictureAsset;
-
-class StereoPictureAssetReader : public AssetReader
-{
-public:
- ~StereoPictureAssetReader ();
- boost::shared_ptr<const StereoPictureFrame> get_frame (int n) const;
-
-private:
- friend class StereoPictureAsset;
-
- explicit StereoPictureAssetReader (StereoPictureAsset const *);
- ASDCP::JP2K::MXFSReader* _reader;
-};
+typedef AssetReader<ASDCP::JP2K::MXFSReader, StereoPictureFrame> StereoPictureAssetReader;
}
*/
#include "types.h"
+#include "stereo_picture_asset_reader.h"
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
#include <boost/filesystem.hpp>
int right_j2k_size () const;
private:
- friend class StereoPictureAssetReader;
+ friend StereoPictureAssetReader;
StereoPictureFrame (ASDCP::JP2K::MXFSReader* reader, int n, boost::shared_ptr<DecryptionContext>);
def build(bld):
source = """
asset.cc
- asset_reader.cc
asset_writer.cc
atmos_asset.cc
certificate_chain.cc
metadata.cc
modified_gamma_transfer_function.cc
mono_picture_asset.cc
- mono_picture_asset_reader.cc
mono_picture_asset_writer.cc
mono_picture_frame.cc
mxf.cc
smpte_load_font_node.cc
smpte_subtitle_asset.cc
sound_asset.cc
- sound_asset_reader.cc
sound_asset_writer.cc
stereo_picture_asset.cc
- stereo_picture_asset_reader.cc
stereo_picture_asset_writer.cc
stereo_picture_frame.cc
subtitle_asset.cc