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/sound_asset_writer.cc | |
| parent | 860296bc2a6ffdb8dcf407a2a4ff985ccc30b87d (diff) | |
Close assets on destruction even if finalize() is not called.v1.8.23
Diffstat (limited to 'src/sound_asset_writer.cc')
| -rw-r--r-- | src/sound_asset_writer.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/sound_asset_writer.cc b/src/sound_asset_writer.cc index 2842a1d5..40acf924 100644 --- a/src/sound_asset_writer.cc +++ b/src/sound_asset_writer.cc @@ -111,6 +111,17 @@ SoundAssetWriter::SoundAssetWriter (SoundAsset* asset, boost::filesystem::path f } +SoundAssetWriter::~SoundAssetWriter() +{ + try { + /* Last-resort finalization to close the file, at least */ + if (_started) { + _state->mxf_writer.Finalize(); + } + } catch (...) {} +} + + void SoundAssetWriter::start () { @@ -265,6 +276,7 @@ SoundAssetWriter::finalize () if (ASDCP_FAILURE(r)) { boost::throw_exception (MiscError(String::compose ("could not finalise audio MXF (%1)", static_cast<int>(r)))); } + _started = false; } _asset->_intrinsic_duration = _frames_written; |
