struct RiffChunkHeader
Defined at line 67 of file ../../src/media/audio/lib/wav/wav_internal.h
The RIFF file specification (and the child specification for WAV content)
defines the layout and contents of WAV audio files.
RIFF files consist of so-called _chunks_ (self-describing sections of the
file). These files begin with a RIFF header chunk that describes the primary
format of the file contents, followed by the data itself (in a chunk of its
own). Additional chunks may also be present, containing metadata and/or other
information to support optional features. Because all chunks include a length
field, any unknown chunks can be safely skipped by file readers.
The WAV file format specifies an initial 'RIFF' chunk of type 'WAVE' (length
24), followed by two required Subchunks: 'fmt ' (length 24) and 'data'
(length 8 + the size of the subsequent audio data). Audio data should
immediately follow these first 8 bytes of the 'data' subchunk. Once the
entirety of audio data has been written into the file, the 'length' field for
the 'data' subchunk should be updated with the number of bytes of audio.
Likewise, the overall length for the parent 'RIFF' chunk (which conceptually
contains the two 'fmt ' and 'data' subchunks) must be updated at this point,
to describe its total size (including subchunk headers and the audio data).
Thus, although all audio data follows the file headers, we must update the
headers once all audio has been written.
** Note, lest our RiffChunkHeader struct definition mislead the uninformed **
These struct definitions actually conceptually relocate the final 32-bit
value of the initial RIFF chunk (the RIFF format-type) into the subsequent
'fmt ' subchunk instead. Because the sequence of fields is maintained, this
does not create a problem. We do this so that we can reuse our RIFF struct
definition for the 'data' subchunk as well.
Public Members
uint32_t four_cc
uint32_t length
Public Methods
void FixupEndianForWriting ()
RIFF files are stored in little-endian, regardless of host-architecture.
Defined at line 72 of file ../../src/media/audio/lib/wav/wav_internal.h
void FixupEndianForReading ()
Defined at line 76 of file ../../src/media/audio/lib/wav/wav_internal.h