diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-07-14 23:51:21 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-07-14 23:51:21 +0200 |
| commit | bdf7390c9ec8b24d6f007c4a53c191bb60c0fc75 (patch) | |
| tree | 55651e4561e69d61a251dc9ff6701b9e72093ade /src/mono_picture_asset_writer.cc | |
| parent | 860296bc2a6ffdb8dcf407a2a4ff985ccc30b87d (diff) | |
Close assets on destruction even if finalize() is not called.v1.8.23
Diffstat (limited to 'src/mono_picture_asset_writer.cc')
| -rw-r--r-- | src/mono_picture_asset_writer.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mono_picture_asset_writer.cc b/src/mono_picture_asset_writer.cc index 1abdcccc..b2b829fa 100644 --- a/src/mono_picture_asset_writer.cc +++ b/src/mono_picture_asset_writer.cc @@ -74,6 +74,17 @@ MonoPictureAssetWriter::MonoPictureAssetWriter (PictureAsset* asset, boost::file } +MonoPictureAssetWriter::~MonoPictureAssetWriter() +{ + try { + /* Last-resort finalization to close the file, at least */ + if (_started) { + _state->mxf_writer.Finalize(); + } + } catch (...) {} +} + + void MonoPictureAssetWriter::start (uint8_t const * data, int size) { @@ -131,6 +142,7 @@ MonoPictureAssetWriter::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; |
