summaryrefslogtreecommitdiff
path: root/src/sound_asset_writer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound_asset_writer.cc')
-rw-r--r--src/sound_asset_writer.cc12
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;