FFmpegfs Fuse Multi Media Filesystem
2.19
Loading...
Searching...
No Matches
src
wave.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2017-2026 by Norbert Schlia (nschlia@oblivion-software.de)
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
*
18
* On Debian systems, the complete text of the GNU General Public License
19
* Version 3 can be found in `/usr/share/common-licenses/GPL-3'.
20
*/
21
33
#ifndef WAVE_H
34
#define WAVE_H
35
36
#pragma once
37
38
#include <stdint.h>
39
40
#include <array>
41
42
#pragma pack(push, 1)
43
49
typedef
struct
WAV_HEADER
50
{
52
std::array<uint8_t, 4>
m_riff_header
;
63
uint32_t
m_wav_size
;
64
std::array<uint8_t, 4>
m_wave_header
;
68
std::array<uint8_t, 4>
m_fmt_header
;
69
uint32_t
m_fmt_chunk_size
;
70
uint16_t
m_audio_format
;
71
uint16_t
m_num_channels
;
72
uint32_t
m_sample_rate
;
73
uint32_t
m_byte_rate
;
74
uint16_t
m_sample_alignment
;
75
uint16_t
m_bit_depth
;
77
}
WAV_HEADER
;
78
79
static_assert
(
sizeof
(
WAV_HEADER
) == 36);
80
86
typedef
struct
WAV_HEADER_EX
87
{
88
uint16_t
m_extension_size
;
89
uint16_t
m_valid_bits_per_sample
;
90
uint32_t
m_channel_mask
;
91
std::array<uint8_t, 16>
m_sub_format_guid
;
92
}
WAV_HEADER_EX
;
93
94
static_assert
(
sizeof
(
WAV_HEADER_EX
) == 24);
95
101
typedef
struct
WAV_FACT
102
{
103
std::array<uint8_t, 4>
m_chunk_id
;
104
uint32_t
m_body_size
;
105
uint32_t
m_number_of_sample_frames
;
106
}
WAV_FACT
;
107
108
static_assert
(
sizeof
(
WAV_FACT
) == 12);
109
115
typedef
struct
WAV_LIST_HEADER
116
{
117
std::array<uint8_t, 4>
m_list_header
;
118
uint32_t
m_data_bytes
;
119
std::array<uint8_t, 4>
m_list_type
;
120
}
WAV_LIST_HEADER
;
121
122
static_assert
(
sizeof
(
WAV_LIST_HEADER
) == 12);
123
128
typedef
struct
WAV_DATA_HEADER
129
{
130
std::array<uint8_t, 4>
m_data_header
;
131
uint32_t
m_data_bytes
;
132
// Remainder of wave file: actual sound data
133
// uint8_t m_bytes[];
134
}
WAV_DATA_HEADER
;
135
136
static_assert
(
sizeof
(
WAV_DATA_HEADER
) == 8);
137
138
#pragma pack(pop)
139
140
#endif
// WAVE_H
WAV_DATA_HEADER
WAVE data header structure.
Definition
wave.h:129
WAV_DATA_HEADER::m_data_header
std::array< uint8_t, 4 > m_data_header
Contains "data" (0x64617461 big-endian form).
Definition
wave.h:130
WAV_DATA_HEADER::m_data_bytes
uint32_t m_data_bytes
Number of bytes in data. Number of samples * num_channels * bit_depth / 8.
Definition
wave.h:131
WAV_FACT
WAVE "fact" header structure.
Definition
wave.h:102
WAV_FACT::m_chunk_id
std::array< uint8_t, 4 > m_chunk_id
Chunk ID 4 0x66 0x61 0x63 0x74 (i.e. "fact")
Definition
wave.h:103
WAV_FACT::m_number_of_sample_frames
uint32_t m_number_of_sample_frames
Number of sample frames 4 32-bit unsigned integer.
Definition
wave.h:105
WAV_FACT::m_body_size
uint32_t m_body_size
Chunk Body Size 4 32-bit unsigned integer.
Definition
wave.h:104
WAV_HEADER_EX
WAVE extended header structure.
Definition
wave.h:87
WAV_HEADER_EX::m_sub_format_guid
std::array< uint8_t, 16 > m_sub_format_guid
Sub Format GUID 16 16-byte GUID.
Definition
wave.h:91
WAV_HEADER_EX::m_valid_bits_per_sample
uint16_t m_valid_bits_per_sample
Valid Bits Per Sample 2 16-bit unsigned integer.
Definition
wave.h:89
WAV_HEADER_EX::m_channel_mask
uint32_t m_channel_mask
Channel Mask 4 32-bit unsigned integer.
Definition
wave.h:90
WAV_HEADER_EX::m_extension_size
uint16_t m_extension_size
Extension Size 2 16-bit unsigned integer (value 22)
Definition
wave.h:88
WAV_HEADER
WAVE header structure.
Definition
wave.h:50
WAV_HEADER::m_sample_alignment
uint16_t m_sample_alignment
num_channels * bit_depth / 8
Definition
wave.h:74
WAV_HEADER::m_sample_rate
uint32_t m_sample_rate
8000, 44100, etc.
Definition
wave.h:72
WAV_HEADER::m_wav_size
uint32_t m_wav_size
Definition
wave.h:63
WAV_HEADER::m_riff_header
std::array< uint8_t, 4 > m_riff_header
RIFF Header: Contains the letters "RIFF" in ASCII form (0x52494646 big-endian form).
Definition
wave.h:52
WAV_HEADER::m_byte_rate
uint32_t m_byte_rate
Number of bytes per second. sample_rate * num_channels * bit_depth / 8.
Definition
wave.h:73
WAV_HEADER::m_wave_header
std::array< uint8_t, 4 > m_wave_header
Contains the letters "WAVE" (0x57415645 big-endian form).
Definition
wave.h:64
WAV_HEADER::m_fmt_header
std::array< uint8_t, 4 > m_fmt_header
RIFF Format Header: Contains "fmt " including trailing space (0x666d7420 big-endian form).
Definition
wave.h:68
WAV_HEADER::m_fmt_chunk_size
uint32_t m_fmt_chunk_size
Should be 16 for PCM This is the size of the rest of the chunk size which follows this number.
Definition
wave.h:69
WAV_HEADER::m_audio_format
uint16_t m_audio_format
Should be 1 for PCM. 3 for IEEE Float.
Definition
wave.h:70
WAV_HEADER::m_num_channels
uint16_t m_num_channels
Number of channels 1...n (1: mono, 2: stereo/dual channel;...)
Definition
wave.h:71
WAV_HEADER::m_bit_depth
uint16_t m_bit_depth
Number of bits per sample: 8 bits = 8, 16 bits = 16, etc.
Definition
wave.h:75
WAV_LIST_HEADER
WAVE list header structure.
Definition
wave.h:116
WAV_LIST_HEADER::m_list_type
std::array< uint8_t, 4 > m_list_type
Contains "adtl" (0x6164746C)
Definition
wave.h:119
WAV_LIST_HEADER::m_data_bytes
uint32_t m_data_bytes
Number of bytes in list.
Definition
wave.h:118
WAV_LIST_HEADER::m_list_header
std::array< uint8_t, 4 > m_list_header
Contains "list" (0x6C696E74)
Definition
wave.h:117
Generated by
1.9.8