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
d3e1b72d
Commit
d3e1b72d
authored
Jan 09, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/{alsa,pulse}: convert to C++
parent
b5e1bd57
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
32 deletions
+60
-32
Makefile.am
Makefile.am
+3
-3
AlsaMixerPlugin.cxx
src/mixer/AlsaMixerPlugin.cxx
+18
-16
PulseMixerPlugin.cxx
src/mixer/PulseMixerPlugin.cxx
+13
-11
PulseMixerPlugin.h
src/mixer/PulseMixerPlugin.h
+9
-1
mixer_api.h
src/mixer_api.h
+8
-0
pulse_output_plugin.c
src/output/pulse_output_plugin.c
+1
-1
pulse_output_plugin.h
src/output/pulse_output_plugin.h
+8
-0
No files found.
Makefile.am
View file @
d3e1b72d
...
...
@@ -101,7 +101,6 @@ mpd_headers = \
src/mixer_plugin.h
\
src/mixer_type.h
\
src/mixer/software_mixer_plugin.h
\
src/mixer/pulse_mixer_plugin.h
\
src/daemon.h
\
src/AudioCompress/config.h
\
src/AudioCompress/compress.h
\
...
...
@@ -812,7 +811,7 @@ libmixer_plugins_a_CPPFLAGS = $(AM_CPPFLAGS) \
if
HAVE_ALSA
liboutput_plugins_a_SOURCES
+=
\
src/output/alsa_output_plugin.c src/output/alsa_output_plugin.h
libmixer_plugins_a_SOURCES
+=
src/mixer/
alsa_mixer_plugin.c
libmixer_plugins_a_SOURCES
+=
src/mixer/
AlsaMixerPlugin.cxx
endif
if
HAVE_ROAR
...
...
@@ -870,7 +869,8 @@ endif
if
HAVE_PULSE
liboutput_plugins_a_SOURCES
+=
\
src/output/pulse_output_plugin.c src/output/pulse_output_plugin.h
libmixer_plugins_a_SOURCES
+=
src/mixer/pulse_mixer_plugin.c
libmixer_plugins_a_SOURCES
+=
\
src/mixer/PulseMixerPlugin.cxx src/mixer/PulseMixerPlugin.h
endif
if
HAVE_SHOUT
...
...
src/mixer/
alsa_mixer_plugin.c
→
src/mixer/
AlsaMixerPlugin.cxx
View file @
d3e1b72d
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -77,7 +77,7 @@ find_fd(GSList **list_r, int fd)
if
(
list
==
NULL
)
return
NULL
;
GPollFD
*
p
=
list
->
data
;
GPollFD
*
p
=
(
GPollFD
*
)
list
->
data
;
if
(
p
->
fd
==
fd
)
return
list_r
;
...
...
@@ -103,7 +103,7 @@ alsa_mixer_update_fd(struct alsa_mixer_source *source, const struct pollfd *p,
GSList
*
found
=
*
found_r
;
*
found_r
=
found
->
next
;
GPollFD
*
q
=
found
->
data
;
GPollFD
*
q
=
(
GPollFD
*
)
found
->
data
;
if
(
q
->
events
!=
p
->
events
)
{
/* refresh events */
g_source_remove_poll
(
&
source
->
source
,
q
);
...
...
@@ -135,7 +135,7 @@ alsa_mixer_update_fds(struct alsa_mixer_source *source)
g_free
(
pfds
);
for
(;
old
!=
NULL
;
old
=
old
->
next
)
{
GPollFD
*
q
=
old
->
data
;
GPollFD
*
q
=
(
GPollFD
*
)
old
->
data
;
g_source_remove_poll
(
&
source
->
source
,
q
);
g_free
(
q
);
}
...
...
@@ -163,7 +163,7 @@ alsa_mixer_source_check(GSource *_source)
struct
alsa_mixer_source
*
source
=
(
struct
alsa_mixer_source
*
)
_source
;
for
(
const
GSList
*
i
=
source
->
fds
;
i
!=
NULL
;
i
=
i
->
next
)
{
const
GPollFD
*
poll_fd
=
i
->
data
;
const
GPollFD
*
poll_fd
=
(
GPollFD
*
)
i
->
data
;
if
(
poll_fd
->
revents
!=
0
)
return
true
;
}
...
...
@@ -194,10 +194,12 @@ alsa_mixer_source_finalize(GSource *_source)
}
static
GSourceFuncs
alsa_mixer_source_funcs
=
{
.
prepare
=
alsa_mixer_source_prepare
,
.
check
=
alsa_mixer_source_check
,
.
dispatch
=
alsa_mixer_source_dispatch
,
.
finalize
=
alsa_mixer_source_finalize
,
alsa_mixer_source_prepare
,
alsa_mixer_source_check
,
alsa_mixer_source_dispatch
,
alsa_mixer_source_finalize
,
nullptr
,
nullptr
,
};
/*
...
...
@@ -421,11 +423,11 @@ alsa_mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
}
const
struct
mixer_plugin
alsa_mixer_plugin
=
{
.
init
=
alsa_mixer_init
,
.
finish
=
alsa_mixer_finish
,
.
open
=
alsa_mixer_open
,
.
close
=
alsa_mixer_close
,
.
get_volume
=
alsa_mixer_get_volume
,
.
set_volume
=
alsa_mixer_set_volume
,
.
global
=
true
,
alsa_mixer_init
,
alsa_mixer_finish
,
alsa_mixer_open
,
alsa_mixer_close
,
alsa_mixer_get_volume
,
alsa_mixer_set_volume
,
true
,
};
src/mixer/
pulse_mixer_plugin.c
→
src/mixer/
PulseMixerPlugin.cxx
View file @
d3e1b72d
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,7 +18,7 @@
*/
#include "config.h"
#include "
pulse_mixer_p
lugin.h"
#include "
PulseMixerP
lugin.h"
#include "mixer_api.h"
#include "output/pulse_output_plugin.h"
#include "conf.h"
...
...
@@ -77,7 +77,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
=
userdata
;
struct
pulse_mixer
*
pm
=
(
struct
pulse_mixer
*
)
userdata
;
if
(
eol
)
return
;
...
...
@@ -153,16 +153,15 @@ static struct mixer *
pulse_mixer_init
(
void
*
ao
,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
GError
**
error_r
)
{
struct
pulse_mixer
*
pm
;
struct
pulse_output
*
po
=
ao
;
struct
pulse_output
*
po
=
(
struct
pulse_output
*
)
ao
;
if
(
ao
==
NULL
)
{
g_set_error
(
error_r
,
pulse_mixer_quark
(),
0
,
"The pulse mixer cannot work without the audio output"
);
return
false
;
return
nullptr
;
}
pm
=
g_new
(
struct
pulse_mixer
,
1
);
struct
pulse_mixer
*
pm
=
g_new
(
struct
pulse_mixer
,
1
);
mixer_init
(
&
pm
->
base
,
&
pulse_mixer_plugin
);
pm
->
online
=
false
;
...
...
@@ -229,8 +228,11 @@ pulse_mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
}
const
struct
mixer_plugin
pulse_mixer_plugin
=
{
.
init
=
pulse_mixer_init
,
.
finish
=
pulse_mixer_finish
,
.
get_volume
=
pulse_mixer_get_volume
,
.
set_volume
=
pulse_mixer_set_volume
,
pulse_mixer_init
,
pulse_mixer_finish
,
nullptr
,
nullptr
,
pulse_mixer_get_volume
,
pulse_mixer_set_volume
,
false
,
};
src/mixer/
pulse_mixer_p
lugin.h
→
src/mixer/
PulseMixerP
lugin.h
View file @
d3e1b72d
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -26,6 +26,10 @@ struct pulse_mixer;
struct
pa_context
;
struct
pa_stream
;
#ifdef __cplusplus
extern
"C"
{
#endif
void
pulse_mixer_on_connect
(
struct
pulse_mixer
*
pm
,
struct
pa_context
*
context
);
...
...
@@ -36,4 +40,8 @@ void
pulse_mixer_on_change
(
struct
pulse_mixer
*
pm
,
struct
pa_context
*
context
,
struct
pa_stream
*
stream
);
#ifdef __cplusplus
}
#endif
#endif
src/mixer_api.h
View file @
d3e1b72d
...
...
@@ -46,7 +46,15 @@ struct mixer {
bool
failed
;
};
#ifdef __cplusplus
extern
"C"
{
#endif
void
mixer_init
(
struct
mixer
*
mixer
,
const
struct
mixer_plugin
*
plugin
);
#ifdef __cplusplus
}
#endif
#endif
src/output/pulse_output_plugin.c
View file @
d3e1b72d
...
...
@@ -21,7 +21,7 @@
#include "pulse_output_plugin.h"
#include "output_api.h"
#include "mixer_list.h"
#include "mixer/
pulse_mixer_p
lugin.h"
#include "mixer/
PulseMixerP
lugin.h"
#include <glib.h>
...
...
src/output/pulse_output_plugin.h
View file @
d3e1b72d
...
...
@@ -30,6 +30,10 @@ struct pa_cvolume;
extern
const
struct
audio_output_plugin
pulse_output_plugin
;
#ifdef __cplusplus
extern
"C"
{
#endif
void
pulse_output_lock
(
struct
pulse_output
*
po
);
...
...
@@ -46,4 +50,8 @@ bool
pulse_output_set_volume
(
struct
pulse_output
*
po
,
const
struct
pa_cvolume
*
volume
,
GError
**
error_r
);
#ifdef __cplusplus
}
#endif
#endif
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