summaryrefslogtreecommitdiff
path: root/src/stereo_picture_asset_writer.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-07-14 23:51:21 +0200
committerCarl Hetherington <cth@carlh.net>2022-07-14 23:51:21 +0200
commitbdf7390c9ec8b24d6f007c4a53c191bb60c0fc75 (patch)
tree55651e4561e69d61a251dc9ff6701b9e72093ade /src/stereo_picture_asset_writer.cc
parent860296bc2a6ffdb8dcf407a2a4ff985ccc30b87d (diff)
Close assets on destruction even if finalize() is not called.v1.8.23
Diffstat (limited to 'src/stereo_picture_asset_writer.cc')
-rw-r--r--src/stereo_picture_asset_writer.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stereo_picture_asset_writer.cc b/src/stereo_picture_asset_writer.cc
index e02e8360..f4ec7df0 100644
--- a/src/stereo_picture_asset_writer.cc
+++ b/src/stereo_picture_asset_writer.cc
@@ -68,6 +68,17 @@ StereoPictureAssetWriter::StereoPictureAssetWriter (PictureAsset* mxf, boost::fi
}
+StereoPictureAssetWriter::~StereoPictureAssetWriter()
+{
+ try {
+ /* Last-resort finalization to close the file, at least */
+ if (_started) {
+ _state->mxf_writer.Finalize();
+ }
+ } catch (...) {}
+}
+
+
void
StereoPictureAssetWriter::start (uint8_t const * data, int size)
{
@@ -140,6 +151,7 @@ StereoPictureAssetWriter::finalize ()
if (ASDCP_FAILURE(r)) {
boost::throw_exception (MXFFileError("error in finalizing video MXF", _file.string(), r));
}
+ _started = false;
}
_picture_asset->_intrinsic_duration = _frames_written;