[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2202-gba8ab1d |
Date: |
Mon, 07 Sep 2015 19:30:02 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via ba8ab1d9757bef44ab9be979072337a9e0fe463e (commit)
via a78102bda02cc37ddf61050ff4157985abaab001 (commit)
via ca76d4085de26fb91d9619b28bfcf5951ab0aef0 (commit)
from dc51f5389e4726486b631864151dcfe28e556cf6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=ba8ab1d9757bef44ab9be979072337a9e0fe463e
commit ba8ab1d9757bef44ab9be979072337a9e0fe463e
Author: Sandro Santilli <address@hidden>
Date: Mon Sep 7 21:28:57 2015 +0200
Add note about corrupted wav file fix (#45887)
diff --git a/NEWS b/NEWS
index b0c21c3..1ee06f7 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Caveats:
Improvements since 0.8.10 release are:
+ * Fix corrupted WAV file on --audio-dump (#45887)
* Fix callback registration issue in ExternalInterface (#37223)
* Fix possible out-of-bound read in parser (#43865)
* Fix opening of external URL with Gnash Standalone (#31833)
http://git.savannah.gnu.org/cgit//commit/?id=a78102bda02cc37ddf61050ff4157985abaab001
commit a78102bda02cc37ddf61050ff4157985abaab001
Author: Nutchanon Wetchasit <address@hidden>
Date: Mon Sep 7 21:15:13 2015 +0200
Flush WAVE metadata at the end of audio dumping.
diff --git a/libsound/WAVWriter.cpp b/libsound/WAVWriter.cpp
index f16cf66..e157f68 100644
--- a/libsound/WAVWriter.cpp
+++ b/libsound/WAVWriter.cpp
@@ -66,6 +66,7 @@ WAVWriter::WAVWriter(const std::string& wavefile)
throw SoundException(fmt.str());
}
else {
+ data_size = 0;
write_wave_header(file_stream);
std::cout << "# Created 44100 16Mhz stereo wave file:\n" <<
"AUDIOFILE=" << wavefile << std::endl;
@@ -75,7 +76,19 @@ WAVWriter::WAVWriter(const std::string& wavefile)
/* public */
WAVWriter::~WAVWriter()
{
- if (file_stream) file_stream.close();
+ if (file_stream) {
+ // attempt to flush metadata
+ file_stream.seekp(0);
+ if (file_stream.fail()) {
+ log_error("WAVWriter: Failed to flush audio dump metadata,
resulting file would be incomplete");
+ }
+ else {
+ write_wave_header(file_stream);
+ }
+
+ // close the stream
+ file_stream.close();
+ }
}
/* public */
@@ -86,7 +99,7 @@ WAVWriter::pushSamples(std::int16_t* from, unsigned int
nSamples)
std::uint8_t* stream = reinterpret_cast<std::uint8_t*>(from);
unsigned int len = nSamples*2;
file_stream.write((char*) stream, len);
-
+ data_size += len;
}
/* private */
@@ -104,22 +117,23 @@ WAVWriter::write_wave_header(std::ofstream& outfile)
std::memcpy(wav.wID, "WAVE", 4);
std::memcpy(wav.fId, "fmt ", 4);
+ wav.wFormatTag = 1;
wav.nBitsPerSample = 16;
wav.nSamplesPerSec = 44100;
wav.nAvgBytesPerSec = 44100;
wav.nAvgBytesPerSec *= wav.nBitsPerSample / 8;
wav.nAvgBytesPerSec *= 2;
wav.nChannels = 2;
-
- wav.pcm_header_len = 16;
- wav.wFormatTag = 1;
- wav.rLen = sizeof(WAV_HDR) - 8 + sizeof(CHUNK_HDR);
wav.nBlockAlign = 2 * wav.nBitsPerSample / 8;
- // setup chunk header
+ // setup data chunk header
std::memcpy(chk.dId, "data", 4);
- chk.dLen = 0;
+ chk.dLen = data_size;
+ // setup wav header's size field
+ wav.pcm_header_len = 16;
+ wav.rLen = sizeof(WAV_HDR) - 8 + sizeof(CHUNK_HDR) + chk.dLen;
+
/* write riff/wav header */
outfile.write((char *)&wav, sizeof(WAV_HDR));
diff --git a/libsound/WAVWriter.h b/libsound/WAVWriter.h
index 80a52a1..bd106e8 100644
--- a/libsound/WAVWriter.h
+++ b/libsound/WAVWriter.h
@@ -64,6 +64,9 @@ private:
///
std::ofstream file_stream;
+ /// Current audio data size
+ uint32_t data_size;
+
// write a .WAV file header
void write_wave_header(std::ofstream& outfile);
http://git.savannah.gnu.org/cgit//commit/?id=ca76d4085de26fb91d9619b28bfcf5951ab0aef0
commit ca76d4085de26fb91d9619b28bfcf5951ab0aef0
Author: Nutchanon Wetchasit <address@hidden>
Date: Mon Sep 7 21:15:03 2015 +0200
Use a correct RIFF chunk size in audio dump's WAVE header.
diff --git a/libsound/WAVWriter.cpp b/libsound/WAVWriter.cpp
index 52ac98c..f16cf66 100644
--- a/libsound/WAVWriter.cpp
+++ b/libsound/WAVWriter.cpp
@@ -113,7 +113,7 @@ WAVWriter::write_wave_header(std::ofstream& outfile)
wav.pcm_header_len = 16;
wav.wFormatTag = 1;
- wav.rLen = sizeof(WAV_HDR) + sizeof(CHUNK_HDR);
+ wav.rLen = sizeof(WAV_HDR) - 8 + sizeof(CHUNK_HDR);
wav.nBlockAlign = 2 * wav.nBitsPerSample / 8;
// setup chunk header
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
libsound/WAVWriter.cpp | 30 ++++++++++++++++++++++--------
libsound/WAVWriter.h | 3 +++
3 files changed, 26 insertions(+), 8 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2202-gba8ab1d,
Sandro Santilli <=