Small bits of pre-release tidying.
[libdcp.git] / src / atmos_asset_writer.cc
index 8431086d3f23110d8584348dcd52912f71d9dafc..891a8c01b2b94e2c7daeab05bbd9da71d08ebd90 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2016-2020 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2016-2021 Carl Hetherington <cth@carlh.net>
 
     This file is part of libdcp.
 
@@ -31,6 +31,7 @@
     files in the program, then also delete it here.
 */
 
+
 #include "atmos_asset_writer.h"
 #include "atmos_asset.h"
 #include "exceptions.h"
 #include "crypto_context.h"
 #include <asdcp/AS_DCP.h>
 
+
 using std::min;
 using std::max;
 using std::shared_ptr;
 using namespace dcp;
 
+
 struct AtmosAssetWriter::ASDCPState
 {
        ASDCP::ATMOS::MXFWriter mxf_writer;
@@ -52,6 +55,7 @@ struct AtmosAssetWriter::ASDCPState
        ASDCP::ATMOS::AtmosDescriptor desc;
 };
 
+
 AtmosAssetWriter::AtmosAssetWriter (AtmosAsset* asset, boost::filesystem::path file)
        : AssetWriter (asset, file)
        , _state (new AtmosAssetWriter::ASDCPState)
@@ -85,8 +89,8 @@ AtmosAssetWriter::write (uint8_t const * data, int size)
        DCP_ASSERT (!_finalized);
 
        if (!_started) {
-               Kumu::Result_t r = _state->mxf_writer.OpenWrite (_file.string().c_str(), _state->writer_info, _state->desc);
-               if (ASDCP_FAILURE (r)) {
+               auto r = _state->mxf_writer.OpenWrite (_file.string().c_str(), _state->writer_info, _state->desc);
+               if (ASDCP_FAILURE(r)) {
                        boost::throw_exception (FileError ("could not open atmos MXF for writing", _file.string(), r));
                }
 
@@ -98,9 +102,9 @@ AtmosAssetWriter::write (uint8_t const * data, int size)
        _state->frame_buffer.Size (size);
        memcpy (_state->frame_buffer.Data(), data, size);
 
-       ASDCP::Result_t const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac());
-       if (ASDCP_FAILURE (r)) {
-               boost::throw_exception (MiscError (String::compose ("could not write atmos MXF frame (%1)", int (r))));
+       auto const r = _state->mxf_writer.WriteFrame (_state->frame_buffer, _crypto_context->context(), _crypto_context->hmac());
+       if (ASDCP_FAILURE(r)) {
+               boost::throw_exception (MiscError(String::compose("could not write atmos MXF frame (%1)", static_cast<int>(r))));
        }
 
        ++_frames_written;
@@ -109,8 +113,8 @@ AtmosAssetWriter::write (uint8_t const * data, int size)
 bool
 AtmosAssetWriter::finalize ()
 {
-       if (_started && ASDCP_FAILURE (_state->mxf_writer.Finalize())) {
-               boost::throw_exception (MiscError ("could not finalise atmos MXF"));
+       if (_started && ASDCP_FAILURE(_state->mxf_writer.Finalize())) {
+               boost::throw_exception (MiscError("could not finalise atmos MXF"));
        }
 
        _asset->_intrinsic_duration = _frames_written;