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
3ed80f31
Commit
3ed80f31
authored
Dec 01, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pcm/ConfiguredResampler: convert boolean flag to enum
Prepare for adding more resamplers.
parent
a698cc81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
13 deletions
+31
-13
ConfiguredResampler.cxx
src/pcm/ConfiguredResampler.cxx
+31
-13
No files found.
src/pcm/ConfiguredResampler.cxx
View file @
3ed80f31
...
...
@@ -20,44 +20,62 @@
#include "config.h"
#include "ConfiguredResampler.hxx"
#include "FallbackResampler.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#include "ConfigError.hxx"
#include "util/Error.hxx"
#ifdef HAVE_LIBSAMPLERATE
#include "LibsamplerateResampler.hxx"
#include "ConfigGlobal.hxx"
#include "ConfigOption.hxx"
#endif
#include <string.h>
enum
class
SelectedResampler
{
FALLBACK
,
#ifdef HAVE_LIBSAMPLERATE
static
bool
lsr_enabled
;
LIBSAMPLERATE
,
#endif
};
static
SelectedResampler
selected_resampler
=
SelectedResampler
::
FALLBACK
;
bool
pcm_resampler_global_init
(
Error
&
error
)
{
#ifdef HAVE_LIBSAMPLERATE
const
char
*
converter
=
config_get_string
(
CONF_SAMPLERATE_CONVERTER
,
""
);
lsr_enabled
=
strcmp
(
converter
,
"internal"
)
!=
0
;
if
(
lsr_enabled
)
return
pcm_resample_lsr_global_init
(
converter
,
error
);
else
if
(
strcmp
(
converter
,
"internal"
)
==
0
)
return
true
;
#else
(
void
)
error
;
return
true
;
#ifdef HAVE_LIBSAMPLERATE
selected_resampler
=
SelectedResampler
::
LIBSAMPLERATE
;
return
pcm_resample_lsr_global_init
(
converter
,
error
);
#endif
if
(
*
converter
==
0
)
return
true
;
error
.
Format
(
config_domain
,
"The samplerate_converter '%s' is not available"
,
converter
);
return
false
;
}
PcmResampler
*
pcm_resampler_create
()
{
switch
(
selected_resampler
)
{
case
SelectedResampler
:
:
FALLBACK
:
return
new
FallbackPcmResampler
();
#ifdef HAVE_LIBSAMPLERATE
if
(
lsr_enabled
)
case
SelectedResampler
:
:
LIBSAMPLERATE
:
return
new
LibsampleratePcmResampler
();
#endif
}
return
new
FallbackPcmResampler
();
gcc_unreachable
();
}
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