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
a0beb5fa
Commit
a0beb5fa
authored
Aug 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MixerPlugin: pass config_param reference
parent
f54bcc1f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
30 additions
and
27 deletions
+30
-27
MixerControl.cxx
src/MixerControl.cxx
+1
-1
MixerControl.hxx
src/MixerControl.hxx
+1
-1
MixerPlugin.hxx
src/MixerPlugin.hxx
+2
-3
OutputInit.cxx
src/OutputInit.cxx
+4
-2
AlsaMixerPlugin.cxx
src/mixer/AlsaMixerPlugin.cxx
+10
-10
OssMixerPlugin.cxx
src/mixer/OssMixerPlugin.cxx
+5
-5
PulseMixerPlugin.cxx
src/mixer/PulseMixerPlugin.cxx
+1
-1
RoarMixerPlugin.cxx
src/mixer/RoarMixerPlugin.cxx
+1
-1
SoftwareMixerPlugin.cxx
src/mixer/SoftwareMixerPlugin.cxx
+1
-1
WinmmMixerPlugin.cxx
src/mixer/WinmmMixerPlugin.cxx
+1
-1
read_mixer.cxx
test/read_mixer.cxx
+3
-1
No files found.
src/MixerControl.cxx
View file @
a0beb5fa
...
...
@@ -31,7 +31,7 @@
Mixer
*
mixer_new
(
const
struct
mixer_plugin
*
plugin
,
void
*
ao
,
const
struct
config_param
*
param
,
const
config_param
&
param
,
GError
**
error_r
)
{
Mixer
*
mixer
;
...
...
src/MixerControl.hxx
View file @
a0beb5fa
...
...
@@ -37,7 +37,7 @@ extern "C" {
Mixer
*
mixer_new
(
const
struct
mixer_plugin
*
plugin
,
void
*
ao
,
const
struct
config_param
*
param
,
const
config_param
&
param
,
GError
**
error_r
);
void
...
...
src/MixerPlugin.hxx
View file @
a0beb5fa
...
...
@@ -37,13 +37,12 @@ struct mixer_plugin {
* Alocates and configures a mixer device.
*
* @param ao the pointer returned by audio_output_plugin.init
* @param param the configuration section, or NULL if there is
* no configuration
* @param param the configuration section
* @param error_r location to store the error occurring, or
* NULL to ignore errors
* @return a mixer object, or NULL on error
*/
Mixer
*
(
*
init
)(
void
*
ao
,
const
struct
config_param
*
param
,
Mixer
*
(
*
init
)(
void
*
ao
,
const
config_param
&
param
,
GError
**
error_r
);
/**
...
...
src/OutputInit.cxx
View file @
a0beb5fa
...
...
@@ -112,10 +112,12 @@ audio_output_load_mixer(struct audio_output *ao,
if
(
plugin
==
NULL
)
return
NULL
;
return
mixer_new
(
plugin
,
ao
,
&
param
,
error_r
);
return
mixer_new
(
plugin
,
ao
,
param
,
error_r
);
case
MIXER_TYPE_SOFTWARE
:
mixer
=
mixer_new
(
&
software_mixer_plugin
,
NULL
,
NULL
,
NULL
);
mixer
=
mixer_new
(
&
software_mixer_plugin
,
nullptr
,
config_param
(),
nullptr
);
assert
(
mixer
!=
NULL
);
filter_chain_append
(
filter_chain
,
"software_mixer"
,
...
...
src/mixer/AlsaMixerPlugin.cxx
View file @
a0beb5fa
...
...
@@ -31,7 +31,7 @@
#define VOLUME_MIXER_ALSA_DEFAULT "default"
#define VOLUME_MIXER_ALSA_CONTROL_DEFAULT "PCM"
#define VOLUME_MIXER_ALSA_INDEX_DEFAULT 0
static
constexpr
unsigned
VOLUME_MIXER_ALSA_INDEX_DEFAULT
=
0
;
class
AlsaMixerMonitor
final
:
private
MultiSocketMonitor
{
snd_mixer_t
*
const
mixer
;
...
...
@@ -61,7 +61,7 @@ class AlsaMixer final : public Mixer {
public
:
AlsaMixer
()
:
Mixer
(
alsa_mixer_plugin
)
{}
void
Configure
(
const
config_param
*
param
);
void
Configure
(
const
config_param
&
param
);
bool
Setup
(
GError
**
error_r
);
bool
Open
(
GError
**
error_r
);
void
Close
();
...
...
@@ -138,18 +138,18 @@ alsa_mixer_elem_callback(G_GNUC_UNUSED snd_mixer_elem_t *elem, unsigned mask)
*/
inline
void
AlsaMixer
::
Configure
(
const
config_param
*
param
)
AlsaMixer
::
Configure
(
const
config_param
&
param
)
{
device
=
config_get_block_string
(
param
,
"mixer_device"
,
VOLUME_MIXER_ALSA_DEFAULT
);
control
=
config_get_block_string
(
param
,
"mixer_control"
,
VOLUME_MIXER_ALSA_CONTROL_DEFAULT
);
index
=
config_get_block_unsigned
(
param
,
"mixer_index"
,
VOLUME_MIXER_ALSA_INDEX_DEFAULT
);
device
=
param
.
GetBlockValue
(
"mixer_device"
,
VOLUME_MIXER_ALSA_DEFAULT
);
control
=
param
.
GetBlockValue
(
"mixer_control"
,
VOLUME_MIXER_ALSA_CONTROL_DEFAULT
);
index
=
param
.
GetBlockValue
(
"mixer_index"
,
VOLUME_MIXER_ALSA_INDEX_DEFAULT
);
}
static
Mixer
*
alsa_mixer_init
(
G_GNUC_UNUSED
void
*
ao
,
const
struct
config_param
*
param
,
alsa_mixer_init
(
G_GNUC_UNUSED
void
*
ao
,
const
config_param
&
param
,
G_GNUC_UNUSED
GError
**
error_r
)
{
AlsaMixer
*
am
=
new
AlsaMixer
();
...
...
src/mixer/OssMixerPlugin.cxx
View file @
a0beb5fa
...
...
@@ -51,7 +51,7 @@ class OssMixer : public Mixer {
public
:
OssMixer
()
:
Mixer
(
oss_mixer_plugin
)
{}
bool
Configure
(
const
config_param
*
param
,
GError
**
error_r
);
bool
Configure
(
const
config_param
&
param
,
GError
**
error_r
);
bool
Open
(
GError
**
error_r
);
void
Close
();
...
...
@@ -84,11 +84,11 @@ oss_find_mixer(const char *name)
}
inline
bool
OssMixer
::
Configure
(
const
config_param
*
param
,
GError
**
error_r
)
OssMixer
::
Configure
(
const
config_param
&
param
,
GError
**
error_r
)
{
device
=
config_get_block_string
(
param
,
"mixer_device"
,
device
=
param
.
GetBlockValue
(
"mixer_device"
,
VOLUME_MIXER_OSS_DEFAULT
);
control
=
config_get_block_string
(
param
,
"mixer_control"
,
NULL
);
control
=
param
.
GetBlockValue
(
"mixer_control"
);
if
(
control
!=
NULL
)
{
volume_control
=
oss_find_mixer
(
control
);
...
...
@@ -104,7 +104,7 @@ OssMixer::Configure(const config_param *param, GError **error_r)
}
static
Mixer
*
oss_mixer_init
(
G_GNUC_UNUSED
void
*
ao
,
const
struct
config_param
*
param
,
oss_mixer_init
(
G_GNUC_UNUSED
void
*
ao
,
const
config_param
&
param
,
GError
**
error_r
)
{
OssMixer
*
om
=
new
OssMixer
();
...
...
src/mixer/PulseMixerPlugin.cxx
View file @
a0beb5fa
...
...
@@ -153,7 +153,7 @@ pulse_mixer_on_change(PulseMixer *pm,
}
static
Mixer
*
pulse_mixer_init
(
void
*
ao
,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
pulse_mixer_init
(
void
*
ao
,
gcc_unused
const
config_param
&
param
,
GError
**
error_r
)
{
PulseOutput
*
po
=
(
PulseOutput
*
)
ao
;
...
...
src/mixer/RoarMixerPlugin.cxx
View file @
a0beb5fa
...
...
@@ -34,7 +34,7 @@ struct RoarMixer final : public Mixer {
};
static
Mixer
*
roar_mixer_init
(
void
*
ao
,
gcc_unused
const
struct
config_param
*
param
,
roar_mixer_init
(
void
*
ao
,
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
RoarMixer
((
RoarOutput
*
)
ao
);
...
...
src/mixer/SoftwareMixerPlugin.cxx
View file @
a0beb5fa
...
...
@@ -51,7 +51,7 @@ struct SoftwareMixer final : public Mixer {
static
Mixer
*
software_mixer_init
(
gcc_unused
void
*
ao
,
gcc_unused
const
struct
config_param
*
param
,
gcc_unused
const
config_param
&
param
,
gcc_unused
GError
**
error_r
)
{
return
new
SoftwareMixer
();
...
...
src/mixer/WinmmMixerPlugin.cxx
View file @
a0beb5fa
...
...
@@ -60,7 +60,7 @@ winmm_volume_encode(int volume)
}
static
Mixer
*
winmm_mixer_init
(
void
*
ao
,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
winmm_mixer_init
(
void
*
ao
,
gcc_unused
const
config_param
&
param
,
G_GNUC_UNUSED
GError
**
error_r
)
{
assert
(
ao
!=
nullptr
);
...
...
test/read_mixer.cxx
View file @
a0beb5fa
...
...
@@ -25,6 +25,7 @@
#include "GlobalEvents.hxx"
#include "Main.hxx"
#include "event/Loop.hxx"
#include "ConfigData.hxx"
#include <glib.h>
...
...
@@ -125,7 +126,8 @@ int main(int argc, G_GNUC_UNUSED char **argv)
main_loop
=
new
EventLoop
(
EventLoop
::
Default
());
Mixer
*
mixer
=
mixer_new
(
&
alsa_mixer_plugin
,
NULL
,
NULL
,
&
error
);
Mixer
*
mixer
=
mixer_new
(
&
alsa_mixer_plugin
,
nullptr
,
config_param
(),
&
error
);
if
(
mixer
==
NULL
)
{
g_printerr
(
"mixer_new() failed: %s
\n
"
,
error
->
message
);
g_error_free
(
error
);
...
...
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