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
9f625b0a
Commit
9f625b0a
authored
Apr 16, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/Pulse: convert to a class
parent
bc1b4131
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
34 deletions
+30
-34
PulseMixerPlugin.cxx
src/mixer/PulseMixerPlugin.cxx
+18
-21
PulseMixerPlugin.hxx
src/mixer/PulseMixerPlugin.hxx
+4
-4
PulseOutputPlugin.cxx
src/output/PulseOutputPlugin.cxx
+3
-4
PulseOutputPlugin.hxx
src/output/PulseOutputPlugin.hxx
+3
-3
read_mixer.cxx
test/read_mixer.cxx
+2
-2
No files found.
src/mixer/PulseMixerPlugin.cxx
View file @
9f625b0a
...
...
@@ -39,14 +39,17 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "pulse_mixer"
struct
pulse_mixer
{
struct
mixer
base
;
struct
PulseMixer
:
mixer
{
PulseOutput
*
output
;
bool
online
;
struct
pa_cvolume
volume
;
PulseMixer
(
PulseOutput
*
_output
)
:
output
(
_output
),
online
(
false
)
{
mixer_init
(
this
,
&
pulse_mixer_plugin
);
}
};
/**
...
...
@@ -59,7 +62,7 @@ pulse_mixer_quark(void)
}
static
void
pulse_mixer_offline
(
struct
pulse_m
ixer
*
pm
)
pulse_mixer_offline
(
PulseM
ixer
*
pm
)
{
if
(
!
pm
->
online
)
return
;
...
...
@@ -77,7 +80,7 @@ static void
pulse_mixer_volume_cb
(
G_GNUC_UNUSED
pa_context
*
context
,
const
pa_sink_input_info
*
i
,
int
eol
,
void
*
userdata
)
{
struct
pulse_mixer
*
pm
=
(
struct
pulse_m
ixer
*
)
userdata
;
PulseMixer
*
pm
=
(
PulseM
ixer
*
)
userdata
;
if
(
eol
)
return
;
...
...
@@ -94,7 +97,7 @@ pulse_mixer_volume_cb(G_GNUC_UNUSED pa_context *context, const pa_sink_input_inf
}
static
void
pulse_mixer_update
(
struct
pulse_m
ixer
*
pm
,
pulse_mixer_update
(
PulseM
ixer
*
pm
,
struct
pa_context
*
context
,
struct
pa_stream
*
stream
)
{
pa_operation
*
o
;
...
...
@@ -117,7 +120,7 @@ pulse_mixer_update(struct pulse_mixer *pm,
}
void
pulse_mixer_on_connect
(
G_GNUC_UNUSED
struct
pulse_m
ixer
*
pm
,
pulse_mixer_on_connect
(
G_GNUC_UNUSED
PulseM
ixer
*
pm
,
struct
pa_context
*
context
)
{
pa_operation
*
o
;
...
...
@@ -137,13 +140,13 @@ pulse_mixer_on_connect(G_GNUC_UNUSED struct pulse_mixer *pm,
}
void
pulse_mixer_on_disconnect
(
struct
pulse_m
ixer
*
pm
)
pulse_mixer_on_disconnect
(
PulseM
ixer
*
pm
)
{
pulse_mixer_offline
(
pm
);
}
void
pulse_mixer_on_change
(
struct
pulse_m
ixer
*
pm
,
pulse_mixer_on_change
(
PulseM
ixer
*
pm
,
struct
pa_context
*
context
,
struct
pa_stream
*
stream
)
{
pulse_mixer_update
(
pm
,
context
,
stream
);
...
...
@@ -161,33 +164,27 @@ pulse_mixer_init(void *ao, G_GNUC_UNUSED const struct config_param *param,
return
nullptr
;
}
struct
pulse_mixer
*
pm
=
g_new
(
struct
pulse_mixer
,
1
);
mixer_init
(
&
pm
->
base
,
&
pulse_mixer_plugin
);
pm
->
online
=
false
;
pm
->
output
=
po
;
PulseMixer
*
pm
=
new
PulseMixer
(
po
);
pulse_output_set_mixer
(
po
,
pm
);
return
&
pm
->
base
;
return
pm
;
}
static
void
pulse_mixer_finish
(
struct
mixer
*
data
)
{
struct
pulse_mixer
*
pm
=
(
struct
pulse_m
ixer
*
)
data
;
PulseMixer
*
pm
=
(
PulseM
ixer
*
)
data
;
pulse_output_clear_mixer
(
pm
->
output
,
pm
);
/* free resources */
g_free
(
pm
);
delete
pm
;
}
static
int
pulse_mixer_get_volume
(
struct
mixer
*
mixer
,
G_GNUC_UNUSED
GError
**
error_r
)
{
struct
pulse_mixer
*
pm
=
(
struct
pulse_m
ixer
*
)
mixer
;
PulseMixer
*
pm
=
(
PulseM
ixer
*
)
mixer
;
int
ret
;
pulse_output_lock
(
pm
->
output
);
...
...
@@ -204,7 +201,7 @@ pulse_mixer_get_volume(struct mixer *mixer, G_GNUC_UNUSED GError **error_r)
static
bool
pulse_mixer_set_volume
(
struct
mixer
*
mixer
,
unsigned
volume
,
GError
**
error_r
)
{
struct
pulse_mixer
*
pm
=
(
struct
pulse_m
ixer
*
)
mixer
;
PulseMixer
*
pm
=
(
PulseM
ixer
*
)
mixer
;
struct
pa_cvolume
cvolume
;
bool
success
;
...
...
src/mixer/PulseMixerPlugin.hxx
View file @
9f625b0a
...
...
@@ -22,7 +22,7 @@
#include <pulse/def.h>
struct
pulse_m
ixer
;
struct
PulseM
ixer
;
struct
pa_context
;
struct
pa_stream
;
...
...
@@ -31,13 +31,13 @@ extern "C" {
#endif
void
pulse_mixer_on_connect
(
struct
pulse_m
ixer
*
pm
,
struct
pa_context
*
context
);
pulse_mixer_on_connect
(
PulseM
ixer
*
pm
,
struct
pa_context
*
context
);
void
pulse_mixer_on_disconnect
(
struct
pulse_m
ixer
*
pm
);
pulse_mixer_on_disconnect
(
PulseM
ixer
*
pm
);
void
pulse_mixer_on_change
(
struct
pulse_m
ixer
*
pm
,
pulse_mixer_on_change
(
PulseM
ixer
*
pm
,
struct
pa_context
*
context
,
struct
pa_stream
*
stream
);
#ifdef __cplusplus
...
...
src/output/PulseOutputPlugin.cxx
View file @
9f625b0a
...
...
@@ -52,7 +52,7 @@ struct PulseOutput {
const
char
*
server
;
const
char
*
sink
;
struct
pulse_m
ixer
*
mixer
;
PulseM
ixer
*
mixer
;
struct
pa_threaded_mainloop
*
mainloop
;
struct
pa_context
*
context
;
...
...
@@ -91,7 +91,7 @@ pulse_output_unlock(PulseOutput *po)
}
void
pulse_output_set_mixer
(
PulseOutput
*
po
,
struct
pulse_m
ixer
*
pm
)
pulse_output_set_mixer
(
PulseOutput
*
po
,
PulseM
ixer
*
pm
)
{
assert
(
po
!=
nullptr
);
assert
(
po
->
mixer
==
nullptr
);
...
...
@@ -117,8 +117,7 @@ pulse_output_set_mixer(PulseOutput *po, struct pulse_mixer *pm)
}
void
pulse_output_clear_mixer
(
PulseOutput
*
po
,
G_GNUC_UNUSED
struct
pulse_mixer
*
pm
)
pulse_output_clear_mixer
(
PulseOutput
*
po
,
gcc_unused
PulseMixer
*
pm
)
{
assert
(
po
!=
nullptr
);
assert
(
pm
!=
nullptr
);
...
...
src/output/PulseOutputPlugin.hxx
View file @
9f625b0a
...
...
@@ -25,7 +25,7 @@
#include <stdbool.h>
struct
PulseOutput
;
struct
pulse_m
ixer
;
struct
PulseM
ixer
;
struct
pa_cvolume
;
extern
const
struct
audio_output_plugin
pulse_output_plugin
;
...
...
@@ -41,10 +41,10 @@ void
pulse_output_unlock
(
PulseOutput
*
po
);
void
pulse_output_set_mixer
(
PulseOutput
*
po
,
struct
pulse_m
ixer
*
pm
);
pulse_output_set_mixer
(
PulseOutput
*
po
,
PulseM
ixer
*
pm
);
void
pulse_output_clear_mixer
(
PulseOutput
*
po
,
struct
pulse_m
ixer
*
pm
);
pulse_output_clear_mixer
(
PulseOutput
*
po
,
PulseM
ixer
*
pm
);
bool
pulse_output_set_volume
(
PulseOutput
*
po
,
...
...
test/read_mixer.cxx
View file @
9f625b0a
...
...
@@ -49,13 +49,13 @@ pulse_output_unlock(G_GNUC_UNUSED PulseOutput *po)
void
pulse_output_set_mixer
(
G_GNUC_UNUSED
PulseOutput
*
po
,
G_GNUC_UNUSED
struct
pulse_m
ixer
*
pm
)
G_GNUC_UNUSED
PulseM
ixer
*
pm
)
{
}
void
pulse_output_clear_mixer
(
G_GNUC_UNUSED
PulseOutput
*
po
,
G_GNUC_UNUSED
struct
pulse_m
ixer
*
pm
)
G_GNUC_UNUSED
PulseM
ixer
*
pm
)
{
}
...
...
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