X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fframe.h;h=01dfe8b4ab1286ed6ccd630a9727e800c35d3f43;hb=3d53fb23efa153e10c37071a4ecac48b74c2dbd6;hp=f20a1bb36f8d662aac41058d81a54bc8a781afb0;hpb=214d72306bdfdd617c3e6a7cfeb5c5d76d7f5e72;p=libdcp.git diff --git a/src/frame.h b/src/frame.h index f20a1bb3..01dfe8b4 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2016 Carl Hetherington + Copyright (C) 2016-2021 Carl Hetherington This file is part of libdcp. @@ -31,35 +31,41 @@ files in the program, then also delete it here. */ + +/** @file src/frame.h + * @brief Frame class + */ + + #ifndef LIBDCP_FRAME_H #define LIBDCP_FRAME_H -#include "decryption_context.h" + +#include "crypto_context.h" #include "exceptions.h" #include #include -#include + namespace dcp { + template -class Frame : public boost::noncopyable +class Frame { public: - Frame (R* reader, int n, boost::shared_ptr c) + Frame (R* reader, int n, std::shared_ptr c, bool check_hmac) { /* XXX: unfortunate guesswork on this buffer size */ - _buffer = new B (Kumu::Megabyte); + _buffer = std::make_shared(Kumu::Megabyte); - if (ASDCP_FAILURE (reader->ReadFrame (n, *_buffer, c->decryption()))) { - boost::throw_exception (DCPReadError ("could not read frame")); + if (ASDCP_FAILURE(reader->ReadFrame(n, *_buffer, c->context(), check_hmac ? c->hmac() : nullptr))) { + boost::throw_exception (ReadError ("could not read frame")); } } - ~Frame () - { - delete _buffer; - } + Frame (Frame const&) = delete; + Frame& operator= (Frame const&) = delete; uint8_t const * data () const { @@ -72,9 +78,11 @@ public: } private: - B* _buffer; + std::shared_ptr _buffer; }; + } + #endif