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
c4c44c44
Commit
c4c44c44
authored
Oct 19, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_{channels,format}: add alignment assertions
parent
0debe9bd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
pcm_channels.c
src/pcm_channels.c
+6
-0
pcm_format.c
src/pcm_format.c
+6
-0
No files found.
src/pcm_channels.c
View file @
c4c44c44
...
@@ -75,6 +75,8 @@ pcm_convert_channels_16(struct pcm_buffer *buffer,
...
@@ -75,6 +75,8 @@ pcm_convert_channels_16(struct pcm_buffer *buffer,
uint8_t
src_channels
,
const
int16_t
*
src
,
uint8_t
src_channels
,
const
int16_t
*
src
,
size_t
src_size
,
size_t
*
dest_size_r
)
size_t
src_size
,
size_t
*
dest_size_r
)
{
{
assert
(
src_size
%
(
sizeof
(
*
src
)
*
src_channels
)
==
0
);
unsigned
num_frames
=
src_size
/
src_channels
/
sizeof
(
*
src
);
unsigned
num_frames
=
src_size
/
src_channels
/
sizeof
(
*
src
);
unsigned
dest_size
=
num_frames
*
dest_channels
*
sizeof
(
*
src
);
unsigned
dest_size
=
num_frames
*
dest_channels
*
sizeof
(
*
src
);
int16_t
*
dest
=
pcm_buffer_get
(
buffer
,
dest_size
);
int16_t
*
dest
=
pcm_buffer_get
(
buffer
,
dest_size
);
...
@@ -146,6 +148,8 @@ pcm_convert_channels_24(struct pcm_buffer *buffer,
...
@@ -146,6 +148,8 @@ pcm_convert_channels_24(struct pcm_buffer *buffer,
uint8_t
src_channels
,
const
int32_t
*
src
,
uint8_t
src_channels
,
const
int32_t
*
src
,
size_t
src_size
,
size_t
*
dest_size_r
)
size_t
src_size
,
size_t
*
dest_size_r
)
{
{
assert
(
src_size
%
(
sizeof
(
*
src
)
*
src_channels
)
==
0
);
unsigned
num_frames
=
src_size
/
src_channels
/
sizeof
(
*
src
);
unsigned
num_frames
=
src_size
/
src_channels
/
sizeof
(
*
src
);
unsigned
dest_size
=
num_frames
*
dest_channels
*
sizeof
(
*
src
);
unsigned
dest_size
=
num_frames
*
dest_channels
*
sizeof
(
*
src
);
int32_t
*
dest
=
pcm_buffer_get
(
buffer
,
dest_size
);
int32_t
*
dest
=
pcm_buffer_get
(
buffer
,
dest_size
);
...
@@ -212,6 +216,8 @@ pcm_convert_channels_32(struct pcm_buffer *buffer,
...
@@ -212,6 +216,8 @@ pcm_convert_channels_32(struct pcm_buffer *buffer,
uint8_t
src_channels
,
const
int32_t
*
src
,
uint8_t
src_channels
,
const
int32_t
*
src
,
size_t
src_size
,
size_t
*
dest_size_r
)
size_t
src_size
,
size_t
*
dest_size_r
)
{
{
assert
(
src_size
%
(
sizeof
(
*
src
)
*
src_channels
)
==
0
);
unsigned
num_frames
=
src_size
/
src_channels
/
sizeof
(
*
src
);
unsigned
num_frames
=
src_size
/
src_channels
/
sizeof
(
*
src
);
unsigned
dest_size
=
num_frames
*
dest_channels
*
sizeof
(
*
src
);
unsigned
dest_size
=
num_frames
*
dest_channels
*
sizeof
(
*
src
);
int32_t
*
dest
=
pcm_buffer_get
(
buffer
,
dest_size
);
int32_t
*
dest
=
pcm_buffer_get
(
buffer
,
dest_size
);
...
...
src/pcm_format.c
View file @
c4c44c44
...
@@ -62,6 +62,8 @@ pcm_convert_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither,
...
@@ -62,6 +62,8 @@ pcm_convert_to_16(struct pcm_buffer *buffer, struct pcm_dither *dither,
enum
sample_format
src_format
,
const
void
*
src
,
enum
sample_format
src_format
,
const
void
*
src
,
size_t
src_size
,
size_t
*
dest_size_r
)
size_t
src_size
,
size_t
*
dest_size_r
)
{
{
assert
(
src_size
%
sample_format_size
(
src_format
)
==
0
);
const
void
*
src_end
=
pcm_end_pointer
(
src
,
src_size
);
const
void
*
src_end
=
pcm_end_pointer
(
src
,
src_size
);
unsigned
num_samples
;
unsigned
num_samples
;
int16_t
*
dest
;
int16_t
*
dest
;
...
@@ -157,6 +159,8 @@ pcm_convert_to_24(struct pcm_buffer *buffer,
...
@@ -157,6 +159,8 @@ pcm_convert_to_24(struct pcm_buffer *buffer,
enum
sample_format
src_format
,
const
void
*
src
,
enum
sample_format
src_format
,
const
void
*
src
,
size_t
src_size
,
size_t
*
dest_size_r
)
size_t
src_size
,
size_t
*
dest_size_r
)
{
{
assert
(
src_size
%
sample_format_size
(
src_format
)
==
0
);
unsigned
num_samples
;
unsigned
num_samples
;
int32_t
*
dest
;
int32_t
*
dest
;
...
@@ -240,6 +244,8 @@ pcm_convert_to_32(struct pcm_buffer *buffer,
...
@@ -240,6 +244,8 @@ pcm_convert_to_32(struct pcm_buffer *buffer,
enum
sample_format
src_format
,
const
void
*
src
,
enum
sample_format
src_format
,
const
void
*
src
,
size_t
src_size
,
size_t
*
dest_size_r
)
size_t
src_size
,
size_t
*
dest_size_r
)
{
{
assert
(
src_size
%
sample_format_size
(
src_format
)
==
0
);
unsigned
num_samples
;
unsigned
num_samples
;
int32_t
*
dest
;
int32_t
*
dest
;
...
...
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