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
8ce48d83
Commit
8ce48d83
authored
Oct 23, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/FormatConverter: move check to Open()
Report unsupported format while opening the filter, not later when the first conversion takes place.
parent
200cdb6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
10 deletions
+24
-10
FormatConverter.cxx
src/pcm/FormatConverter.cxx
+24
-10
No files found.
src/pcm/FormatConverter.cxx
View file @
8ce48d83
...
@@ -28,11 +28,31 @@
...
@@ -28,11 +28,31 @@
bool
bool
PcmFormatConverter
::
Open
(
SampleFormat
_src_format
,
SampleFormat
_dest_format
,
PcmFormatConverter
::
Open
(
SampleFormat
_src_format
,
SampleFormat
_dest_format
,
gcc_unused
Error
&
error
)
Error
&
error
)
{
{
assert
(
_src_format
!=
SampleFormat
::
UNDEFINED
);
assert
(
_src_format
!=
SampleFormat
::
UNDEFINED
);
assert
(
_dest_format
!=
SampleFormat
::
UNDEFINED
);
assert
(
_dest_format
!=
SampleFormat
::
UNDEFINED
);
switch
(
_dest_format
)
{
case
SampleFormat
:
:
UNDEFINED
:
assert
(
false
);
gcc_unreachable
();
case
SampleFormat
:
:
S8
:
case
SampleFormat
:
:
DSD
:
error
.
Format
(
pcm_domain
,
"PCM conversion from %s to %s is not implemented"
,
sample_format_to_string
(
_src_format
),
sample_format_to_string
(
_dest_format
));
return
nullptr
;
case
SampleFormat
:
:
S16
:
case
SampleFormat
:
:
S24_P32
:
case
SampleFormat
:
:
S32
:
case
SampleFormat
:
:
FLOAT
:
break
;
}
src_format
=
_src_format
;
src_format
=
_src_format
;
dest_format
=
_dest_format
;
dest_format
=
_dest_format
;
return
true
;
return
true
;
...
@@ -48,20 +68,14 @@ PcmFormatConverter::Close()
...
@@ -48,20 +68,14 @@ PcmFormatConverter::Close()
}
}
ConstBuffer
<
void
>
ConstBuffer
<
void
>
PcmFormatConverter
::
Convert
(
ConstBuffer
<
void
>
src
,
Error
&
error
)
PcmFormatConverter
::
Convert
(
ConstBuffer
<
void
>
src
,
gcc_unused
Error
&
error
)
{
{
switch
(
dest_format
)
{
switch
(
dest_format
)
{
case
SampleFormat
:
:
UNDEFINED
:
case
SampleFormat
:
:
UNDEFINED
:
assert
(
false
);
gcc_unreachable
();
case
SampleFormat
:
:
S8
:
case
SampleFormat
:
:
S8
:
case
SampleFormat
:
:
DSD
:
case
SampleFormat
:
:
DSD
:
error
.
Format
(
pcm_domain
,
assert
(
false
);
"PCM conversion from %s to %s is not implemented"
,
gcc_unreachable
();
sample_format_to_string
(
src_format
),
sample_format_to_string
(
dest_format
));
return
nullptr
;
case
SampleFormat
:
:
S16
:
case
SampleFormat
:
:
S16
:
return
pcm_convert_to_16
(
buffer
,
dither
,
return
pcm_convert_to_16
(
buffer
,
dither
,
...
...
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