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
42e248a8
Commit
42e248a8
authored
Oct 08, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm_convert: add function pcm_convert_channels()
For future internal use.
parent
e71a6529
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
pcm_convert.c
src/pcm_convert.c
+50
-0
No files found.
src/pcm_convert.c
View file @
42e248a8
...
...
@@ -56,6 +56,56 @@ void pcm_convert_deinit(struct pcm_convert_state *state)
pcm_buffer_deinit
(
&
state
->
byteswap_buffer
);
}
G_GNUC_UNUSED
static
const
void
*
pcm_convert_channels
(
struct
pcm_buffer
*
buffer
,
enum
sample_format
format
,
uint8_t
dest_channels
,
uint8_t
src_channels
,
const
void
*
src
,
size_t
src_size
,
size_t
*
dest_size_r
,
GError
**
error_r
)
{
const
void
*
dest
=
NULL
;
switch
(
format
)
{
case
SAMPLE_FORMAT_UNDEFINED
:
case
SAMPLE_FORMAT_S8
:
case
SAMPLE_FORMAT_S24
:
case
SAMPLE_FORMAT_FLOAT
:
g_set_error
(
error_r
,
pcm_convert_quark
(),
0
,
"Channel conversion not implemented for format '%s'"
,
sample_format_to_string
(
format
));
return
NULL
;
case
SAMPLE_FORMAT_S16
:
dest
=
pcm_convert_channels_16
(
buffer
,
dest_channels
,
src_channels
,
src
,
src_size
,
dest_size_r
);
break
;
case
SAMPLE_FORMAT_S24_P32
:
dest
=
pcm_convert_channels_24
(
buffer
,
dest_channels
,
src_channels
,
src
,
src_size
,
dest_size_r
);
break
;
case
SAMPLE_FORMAT_S32
:
dest
=
pcm_convert_channels_32
(
buffer
,
dest_channels
,
src_channels
,
src
,
src_size
,
dest_size_r
);
break
;
}
if
(
dest
==
NULL
)
{
g_set_error
(
error_r
,
pcm_convert_quark
(),
0
,
"Conversion from %u to %u channels "
"is not implemented"
,
src_channels
,
dest_channels
);
return
NULL
;
}
return
dest
;
}
static
const
int16_t
*
pcm_convert_16
(
struct
pcm_convert_state
*
state
,
const
struct
audio_format
*
src_format
,
...
...
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