gnash-commit
[Top][All Lists]
Advanced

[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-2289-gf9db2f2
Date: Thu, 26 Jan 2017 11:01:13 +0000 (UTC)

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  f9db2f227e72b177854f497b72c0f9ab45b6869a (commit)
      from  2b3bdede0305c4fc3ad21a0a4197330606c9b880 (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=f9db2f227e72b177854f497b72c0f9ab45b6869a


commit f9db2f227e72b177854f497b72c0f9ab45b6869a
Author: Nutchanon Wetchasit <address@hidden>
Date:   Thu Jan 26 12:00:56 2017 +0100

    Use an endian-neutral way for writing audio dump's WAVE header.

diff --git a/libsound/WAVWriter.cpp b/libsound/WAVWriter.cpp
index 995523b..62ec9ca 100644
--- a/libsound/WAVWriter.cpp
+++ b/libsound/WAVWriter.cpp
@@ -136,11 +136,21 @@ WAVWriter::write_wave_header(std::ofstream& outfile)
   wav.rLen = sizeof(WAV_HDR) - 8 + sizeof(CHUNK_HDR) + chk.dLen;
 
   /* write riff/wav header */
-  outfile.write((char *)&wav, sizeof(WAV_HDR));
- 
+  outfile.write(wav.rID, 4);
+  write_uint32(outfile, wav.rLen);
+  outfile.write(wav.wID, 4);
+  outfile.write(wav.fId, 4);
+  write_uint32(outfile, wav.pcm_header_len);
+  write_uint16(outfile, wav.wFormatTag);
+  write_uint16(outfile, wav.nChannels);
+  write_uint32(outfile, wav.nSamplesPerSec);
+  write_uint32(outfile, wav.nAvgBytesPerSec);
+  write_uint16(outfile, wav.nBlockAlign);
+  write_uint16(outfile, wav.nBitsPerSample);
+
   /* write chunk header */
-  outfile.write((char *)&chk, sizeof(CHUNK_HDR));
- 
+  outfile.write(chk.dId, 4);
+  write_uint32(outfile, chk.dLen);
 }
 
 
diff --git a/libsound/WAVWriter.h b/libsound/WAVWriter.h
index bd106e8..c17bbcd 100644
--- a/libsound/WAVWriter.h
+++ b/libsound/WAVWriter.h
@@ -70,6 +70,22 @@ private:
     // write a .WAV file header
     void write_wave_header(std::ofstream& outfile);
 
+    // write an unsigned 32-bit integer in little-endian order
+    inline void write_uint32(std::ofstream& outfile, uint32_t number)
+    {
+        outfile.put(number & 0xFF);
+        outfile.put((number >> 8) & 0xFF);
+        outfile.put((number >> 16) & 0xFF);
+        outfile.put((number >> 24) & 0xFF);
+    }
+
+    // write an unsigned 16-bit integer in little-endian order
+    inline void write_uint16(std::ofstream& outfile, uint16_t number)
+    {
+        outfile.put(number & 0xFF);
+        outfile.put((number >> 8) & 0xFF);
+    }
+
 };
 
 } // gnash.sound namespace 

-----------------------------------------------------------------------

Summary of changes:
 libsound/WAVWriter.cpp |   18 ++++++++++++++----
 libsound/WAVWriter.h   |   16 ++++++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]