summaryrefslogtreecommitdiff
path: root/Audio/BWFFile.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:49 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:49 +0200
commit76956486fa7ef52a51d4e56df1e13a9f19a6c93c (patch)
treefe0c394439fdc167d1970372e8998874090854dd /Audio/BWFFile.cpp
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
parentffc62c792c9a5196cb4ce7a353287dfe20db6524 (diff)
Update upstream source from tag 'upstream/3.3.0_beta1+dfsg'
Update to upstream version '3.3.0~beta1+dfsg' with Debian dir 85037bbb9376721108594b59b54ead82ac6924a3
Diffstat (limited to 'Audio/BWFFile.cpp')
-rw-r--r--Audio/BWFFile.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/Audio/BWFFile.cpp b/Audio/BWFFile.cpp
index 5ddf9d8b..e7628ccf 100644
--- a/Audio/BWFFile.cpp
+++ b/Audio/BWFFile.cpp
@@ -1171,6 +1171,27 @@ bool BWFFile::flush ()
return success;
}
+bool BWFFile::finalize ()
+{
+ if (!isOpen () || !(openMode () & WriteOnly)) {
+ setErrorString ("Cannot finalize a WAV file that is not open for writing");
+ return false;
+ }
+ auto const samplesSize = size ();
+ bool const success = m_->update_header () && m_->file_.flush ();
+ if (!success) {
+ m_->error_ = FileError::WriteError;
+ setErrorString (m_->file_.error () == FileError::NoError
+ ? QStringLiteral ("Unable to finalize WAV file header")
+ : m_->file_.errorString ());
+ }
+ m_->data_size_ = samplesSize;
+ m_->header_dirty_ = false;
+ QIODevice::close ();
+ m_->file_.close ();
+ return success;
+}
+
int BWFFile::handle () const
{
int h {m_->file_.handle ()};