Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
8a4b88a5
Commit
8a4b88a5
authored
4 years ago
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encoder/wave: use the structs from RiffFormat.hxx
parent
d2371af1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
28 deletions
+20
-28
WaveEncoderPlugin.cxx
src/encoder/plugins/WaveEncoderPlugin.cxx
+20
-28
No files found.
src/encoder/plugins/WaveEncoderPlugin.cxx
View file @
8a4b88a5
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "WaveEncoderPlugin.hxx"
#include "WaveEncoderPlugin.hxx"
#include "../EncoderAPI.hxx"
#include "../EncoderAPI.hxx"
#include "tag/RiffFormat.hxx"
#include "util/ByteOrder.hxx"
#include "util/ByteOrder.hxx"
#include "util/DynamicFifoBuffer.hxx"
#include "util/DynamicFifoBuffer.hxx"
...
@@ -26,8 +27,6 @@
...
@@ -26,8 +27,6 @@
#include <string.h>
#include <string.h>
static
constexpr
uint16_t
WAVE_FORMAT_PCM
=
1
;
class
WaveEncoder
final
:
public
Encoder
{
class
WaveEncoder
final
:
public
Encoder
{
unsigned
bits
;
unsigned
bits
;
...
@@ -56,19 +55,10 @@ class PreparedWaveEncoder final : public PreparedEncoder {
...
@@ -56,19 +55,10 @@ class PreparedWaveEncoder final : public PreparedEncoder {
};
};
struct
WaveHeader
{
struct
WaveHeader
{
uint32_t
id_riff
;
RiffFileHeader
file_header
;
uint32_t
riff_size
;
RiffChunkHeader
fmt_header
;
uint32_t
id_wave
;
RiffFmtChunk
fmt
;
uint32_t
id_fmt
;
RiffChunkHeader
data_header
;
uint32_t
fmt_size
;
uint16_t
format
;
uint16_t
channels
;
uint32_t
freq
;
uint32_t
byterate
;
uint16_t
blocksize
;
uint16_t
bits
;
uint32_t
id_data
;
uint32_t
data_size
;
};
};
static_assert
(
sizeof
(
WaveHeader
)
==
44
);
static_assert
(
sizeof
(
WaveHeader
)
==
44
);
...
@@ -82,23 +72,25 @@ MakeWaveHeader(int channels, int bits,
...
@@ -82,23 +72,25 @@ MakeWaveHeader(int channels, int bits,
int
data_size
=
0x0FFFFFFF
;
int
data_size
=
0x0FFFFFFF
;
/* constants */
/* constants */
header
.
id_riff
=
ToLE32
(
0x46464952
);
memcpy
(
header
.
file_header
.
id
,
"RIFF"
,
4
);
header
.
id_wave
=
ToLE32
(
0x45564157
);
memcpy
(
header
.
file_header
.
format
,
"WAVE"
,
4
);
header
.
id_fmt
=
ToLE32
(
0x20746d66
);
memcpy
(
header
.
fmt_header
.
id
,
"fmt "
,
4
);
header
.
id_data
=
ToLE32
(
0x6174616
4
);
memcpy
(
header
.
data_header
.
id
,
"data"
,
4
);
/* wave format */
/* wave format */
header
.
f
ormat
=
ToLE16
(
WAVE_FORMAT
_PCM
);
header
.
f
mt
.
tag
=
ToLE16
(
RiffFmtChunk
::
TAG
_PCM
);
header
.
channels
=
ToLE16
(
channels
);
header
.
fmt
.
channels
=
ToLE16
(
channels
);
header
.
bits
=
ToLE16
(
bits
);
header
.
fmt
.
bits_per_sample
=
ToLE16
(
bits
);
header
.
f
req
=
ToLE32
(
freq
);
header
.
f
mt
.
sample_rate
=
ToLE32
(
freq
);
header
.
blocksize
=
ToLE16
(
block_size
);
header
.
fmt
.
block_align
=
ToLE16
(
block_size
);
header
.
byte
rate
=
ToLE32
(
freq
*
block_size
);
header
.
fmt
.
byte_
rate
=
ToLE32
(
freq
*
block_size
);
/* chunk sizes (fake data length) */
/* chunk sizes (fake data length) */
header
.
fmt_size
=
ToLE32
(
16
);
header
.
fmt_header
.
size
=
ToLE32
(
sizeof
(
header
.
fmt
));
header
.
data_size
=
ToLE32
(
data_size
);
header
.
data_header
.
size
=
ToLE32
(
data_size
);
header
.
riff_size
=
ToLE32
(
4
+
(
8
+
16
)
+
(
8
+
data_size
));
header
.
file_header
.
size
=
ToLE32
(
4
+
sizeof
(
header
.
fmt_header
)
+
sizeof
(
header
.
fmt
)
+
sizeof
(
header
.
data_header
)
+
data_size
);
return
header
;
return
header
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment