From 6c37cc1979b2a01205a888c4c98f3334685ee8dd Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 23 Jan 2021 15:35:24 +0100 Subject: Tidying. --- src/asset_reader.h | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src/asset_reader.h') diff --git a/src/asset_reader.h b/src/asset_reader.h index d1e0f10e..859c88f3 100644 --- a/src/asset_reader.h +++ b/src/asset_reader.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2021 Carl Hetherington This file is part of libdcp. @@ -31,34 +31,40 @@ files in the program, then also delete it here. */ + #ifndef LIBDCP_ASSET_READER_H #define LIBDCP_ASSET_READER_H -#include "dcp_assert.h" + #include "asset.h" #include "crypto_context.h" +#include "dcp_assert.h" #include -#include #include + namespace dcp { + template -class AssetReader : public boost::noncopyable +class AssetReader { public: explicit AssetReader (Asset const * asset, boost::optional key, Standard standard) - : _crypto_context (new DecryptionContext (key, standard)) + : _crypto_context (new DecryptionContext(key, standard)) { _reader = new R (); - DCP_ASSERT (asset->file ()); - Kumu::Result_t const r = _reader->OpenRead (asset->file()->string().c_str()); - if (ASDCP_FAILURE (r)) { + DCP_ASSERT (asset->file()); + auto 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)); + boost::throw_exception (FileError("could not open MXF file for reading", asset->file().get(), r)); } } + AssetReader (AssetReader const&) = delete; + AssetReader& operator== (AssetReader const&) = delete; + ~AssetReader () { delete _reader; @@ -66,7 +72,7 @@ public: std::shared_ptr get_frame (int n) const { - return std::shared_ptr (new F (_reader, n, _crypto_context)); + return std::shared_ptr (new F(_reader, n, _crypto_context)); } R* reader () const { @@ -74,10 +80,12 @@ public: } protected: - R* _reader; + R* _reader = nullptr; std::shared_ptr _crypto_context; }; + } + #endif -- cgit v1.2.3