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
c4403c52
Commit
c4403c52
authored
Jan 28, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AudioOutput: add constructor and destructor
parent
07b89b2b
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
27 additions
and
101 deletions
+27
-101
Finish.cxx
src/output/Finish.cxx
+9
-10
Init.cxx
src/output/Init.cxx
+14
-12
Internal.hxx
src/output/Internal.hxx
+3
-3
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+0
-5
AoOutputPlugin.cxx
src/output/plugins/AoOutputPlugin.cxx
+0
-6
FifoOutputPlugin.cxx
src/output/plugins/FifoOutputPlugin.cxx
+0
-6
HttpdInternal.hxx
src/output/plugins/HttpdInternal.hxx
+1
-7
HttpdOutputPlugin.cxx
src/output/plugins/HttpdOutputPlugin.cxx
+0
-1
JackOutputPlugin.cxx
src/output/plugins/JackOutputPlugin.cxx
+0
-5
NullOutputPlugin.cxx
src/output/plugins/NullOutputPlugin.cxx
+0
-5
OpenALOutputPlugin.cxx
src/output/plugins/OpenALOutputPlugin.cxx
+0
-5
OssOutputPlugin.cxx
src/output/plugins/OssOutputPlugin.cxx
+0
-5
PipeOutputPlugin.cxx
src/output/plugins/PipeOutputPlugin.cxx
+0
-6
PulseOutputPlugin.cxx
src/output/plugins/PulseOutputPlugin.cxx
+0
-1
RecorderOutputPlugin.cxx
src/output/plugins/RecorderOutputPlugin.cxx
+0
-6
RoarOutputPlugin.cxx
src/output/plugins/RoarOutputPlugin.cxx
+0
-5
ShoutOutputPlugin.cxx
src/output/plugins/ShoutOutputPlugin.cxx
+0
-6
SolarisOutputPlugin.cxx
src/output/plugins/SolarisOutputPlugin.cxx
+0
-5
WinmmOutputPlugin.cxx
src/output/plugins/WinmmOutputPlugin.cxx
+0
-2
No files found.
src/output/Finish.cxx
View file @
c4403c52
...
...
@@ -25,19 +25,18 @@
#include <assert.h>
void
ao_base_finish
(
AudioOutput
*
ao
)
AudioOutput
::~
AudioOutput
()
{
assert
(
!
ao
->
open
);
assert
(
!
ao
->
fail_timer
.
IsDefined
());
assert
(
!
ao
->
thread
.
IsDefined
());
assert
(
!
open
);
assert
(
!
fail_timer
.
IsDefined
());
assert
(
!
thread
.
IsDefined
());
if
(
ao
->
mixer
!=
nullptr
)
mixer_free
(
ao
->
mixer
);
if
(
mixer
!=
nullptr
)
mixer_free
(
mixer
);
delete
ao
->
replay_gain_filter
;
delete
ao
->
other_replay_gain_filter
;
delete
ao
->
filter
;
delete
replay_gain_filter
;
delete
other_replay_gain_filter
;
delete
filter
;
}
void
...
...
src/output/Init.cxx
View file @
c4403c52
...
...
@@ -46,6 +46,20 @@
#define AUDIO_OUTPUT_FORMAT "format"
#define AUDIO_FILTERS "filters"
AudioOutput
::
AudioOutput
()
:
enabled
(
true
),
really_enabled
(
false
),
open
(
false
),
pause
(
false
),
allow_play
(
true
),
in_playback_loop
(
false
),
woken_for_play
(
false
),
filter
(
nullptr
),
replay_gain_filter
(
nullptr
),
other_replay_gain_filter
(
nullptr
),
command
(
AO_COMMAND_NONE
)
{
}
static
const
AudioOutputPlugin
*
audio_output_detect
(
Error
&
error
)
{
...
...
@@ -166,12 +180,6 @@ ao_base_init(AudioOutput *ao,
ao
->
tags
=
param
.
GetBlockValue
(
"tags"
,
true
);
ao
->
always_on
=
param
.
GetBlockValue
(
"always_on"
,
false
);
ao
->
enabled
=
param
.
GetBlockValue
(
"enabled"
,
true
);
ao
->
really_enabled
=
false
;
ao
->
open
=
false
;
ao
->
pause
=
false
;
ao
->
allow_play
=
true
;
ao
->
in_playback_loop
=
false
;
ao
->
woken_for_play
=
false
;
/* set up the filter chain */
...
...
@@ -202,12 +210,6 @@ ao_base_init(AudioOutput *ao,
"Failed to initialize filter chain for '%s'"
,
ao
->
name
);
ao
->
command
=
AO_COMMAND_NONE
;
ao
->
mixer
=
nullptr
;
ao
->
replay_gain_filter
=
nullptr
;
ao
->
other_replay_gain_filter
=
nullptr
;
/* done */
return
true
;
...
...
src/output/Internal.hxx
View file @
c4403c52
...
...
@@ -263,6 +263,9 @@ struct AudioOutput {
* Has the output finished playing #chunk?
*/
bool
chunk_finished
;
AudioOutput
();
~
AudioOutput
();
};
/**
...
...
@@ -294,9 +297,6 @@ ao_base_init(AudioOutput *ao,
const
config_param
&
param
,
Error
&
error
);
void
ao_base_finish
(
AudioOutput
*
ao
);
void
audio_output_free
(
AudioOutput
*
ao
);
#endif
src/output/plugins/AlsaOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -126,10 +126,6 @@ struct AlsaOutput {
return
ao_base_init
(
&
base
,
&
alsa_output_plugin
,
param
,
error
);
}
void
Deinit
()
{
ao_base_finish
(
&
base
);
}
};
static
constexpr
Domain
alsa_output_domain
(
"alsa_output"
);
...
...
@@ -189,7 +185,6 @@ alsa_finish(AudioOutput *ao)
{
AlsaOutput
*
ad
=
(
AlsaOutput
*
)
ao
;
ad
->
Deinit
();
delete
ad
;
/* free libasound's config cache */
...
...
src/output/plugins/AoOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -47,10 +47,6 @@ struct AoOutput {
error
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
bool
Configure
(
const
config_param
&
param
,
Error
&
error
);
};
...
...
@@ -163,7 +159,6 @@ ao_output_init(const config_param ¶m, Error &error)
}
if
(
!
ad
->
Configure
(
param
,
error
))
{
ad
->
Deinitialize
();
delete
ad
;
return
nullptr
;
}
...
...
@@ -177,7 +172,6 @@ ao_output_finish(AudioOutput *ao)
AoOutput
*
ad
=
(
AoOutput
*
)
ao
;
ao_free_options
(
ad
->
options
);
ad
->
Deinitialize
();
delete
ad
;
ao_output_ref
--
;
...
...
src/output/plugins/FifoOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -55,10 +55,6 @@ struct FifoOutput {
error
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
bool
Create
(
Error
&
error
);
bool
Check
(
Error
&
error
);
void
Delete
();
...
...
@@ -195,7 +191,6 @@ fifo_output_init(const config_param ¶m, Error &error)
}
if
(
!
fifo_open
(
fd
,
error
))
{
fd
->
Deinitialize
();
delete
fd
;
return
nullptr
;
}
...
...
@@ -209,7 +204,6 @@ fifo_output_finish(AudioOutput *ao)
FifoOutput
*
fd
=
(
FifoOutput
*
)
ao
;
fd
->
Close
();
fd
->
Deinitialize
();
delete
fd
;
}
...
...
src/output/plugins/HttpdInternal.hxx
View file @
c4403c52
...
...
@@ -169,10 +169,6 @@ public:
bool
Init
(
const
config_param
&
param
,
Error
&
error
);
void
Finish
()
{
ao_base_finish
(
&
base
);
}
bool
Configure
(
const
config_param
&
param
,
Error
&
error
);
AudioOutput
*
InitAndConfigure
(
const
config_param
&
param
,
...
...
@@ -180,10 +176,8 @@ public:
if
(
!
Init
(
param
,
error
))
return
nullptr
;
if
(
!
Configure
(
param
,
error
))
{
Finish
();
if
(
!
Configure
(
param
,
error
))
return
nullptr
;
}
return
&
base
;
}
...
...
src/output/plugins/HttpdOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -156,7 +156,6 @@ httpd_output_finish(AudioOutput *ao)
{
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
httpd
->
Finish
();
delete
httpd
;
}
...
...
src/output/plugins/JackOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -83,10 +83,6 @@ struct JackOutput {
return
ao_base_init
(
&
base
,
&
jack_output_plugin
,
param
,
error_r
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
};
static
constexpr
Domain
jack_output_domain
(
"jack_output"
);
...
...
@@ -399,7 +395,6 @@ mpd_jack_finish(AudioOutput *ao)
for
(
unsigned
i
=
0
;
i
<
jd
->
num_destination_ports
;
++
i
)
g_free
(
jd
->
destination_ports
[
i
]);
jd
->
Deinitialize
();
delete
jd
;
}
...
...
src/output/plugins/NullOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -33,10 +33,6 @@ struct NullOutput {
return
ao_base_init
(
&
base
,
&
null_output_plugin
,
param
,
error
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
};
static
AudioOutput
*
...
...
@@ -59,7 +55,6 @@ null_finish(AudioOutput *ao)
{
NullOutput
*
nd
=
(
NullOutput
*
)
ao
;
nd
->
Deinitialize
();
delete
nd
;
}
...
...
src/output/plugins/OpenALOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -52,10 +52,6 @@ struct OpenALOutput {
return
ao_base_init
(
&
base
,
&
openal_output_plugin
,
param
,
error_r
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
};
static
constexpr
Domain
openal_output_domain
(
"openal_output"
);
...
...
@@ -157,7 +153,6 @@ openal_finish(AudioOutput *ao)
{
OpenALOutput
*
od
=
(
OpenALOutput
*
)
ao
;
od
->
Deinitialize
();
delete
od
;
}
...
...
src/output/plugins/OssOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -84,10 +84,6 @@ struct OssOutput {
return
ao_base_init
(
&
base
,
&
oss_output_plugin
,
param
,
error_r
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
};
static
constexpr
Domain
oss_output_domain
(
"oss_output"
);
...
...
@@ -222,7 +218,6 @@ oss_output_finish(AudioOutput *ao)
{
OssOutput
*
od
=
(
OssOutput
*
)
ao
;
ao_base_finish
(
&
od
->
base
);
delete
od
;
}
...
...
src/output/plugins/PipeOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -39,10 +39,6 @@ struct PipeOutput {
error
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
bool
Configure
(
const
config_param
&
param
,
Error
&
error
);
};
...
...
@@ -72,7 +68,6 @@ pipe_output_init(const config_param ¶m, Error &error)
}
if
(
!
pd
->
Configure
(
param
,
error
))
{
pd
->
Deinitialize
();
delete
pd
;
return
nullptr
;
}
...
...
@@ -85,7 +80,6 @@ pipe_output_finish(AudioOutput *ao)
{
PipeOutput
*
pd
=
(
PipeOutput
*
)
ao
;
pd
->
Deinitialize
();
delete
pd
;
}
...
...
src/output/plugins/PulseOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -353,7 +353,6 @@ pulse_output_finish(AudioOutput *ao)
{
PulseOutput
*
po
=
(
PulseOutput
*
)
ao
;
ao_base_finish
(
&
po
->
base
);
delete
po
;
}
...
...
src/output/plugins/RecorderOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -62,10 +62,6 @@ struct RecorderOutput {
error_r
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
bool
Configure
(
const
config_param
&
param
,
Error
&
error
);
bool
WriteToFile
(
const
void
*
data
,
size_t
length
,
Error
&
error
);
...
...
@@ -118,7 +114,6 @@ recorder_output_init(const config_param ¶m, Error &error)
}
if
(
!
recorder
->
Configure
(
param
,
error
))
{
recorder
->
Deinitialize
();
delete
recorder
;
return
nullptr
;
}
...
...
@@ -132,7 +127,6 @@ recorder_output_finish(AudioOutput *ao)
RecorderOutput
*
recorder
=
(
RecorderOutput
*
)
ao
;
encoder_finish
(
recorder
->
encoder
);
recorder
->
Deinitialize
();
delete
recorder
;
}
...
...
src/output/plugins/RoarOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -61,10 +61,6 @@ public:
error
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
void
Configure
(
const
config_param
&
param
);
bool
Open
(
AudioFormat
&
audio_format
,
Error
&
error
);
...
...
@@ -155,7 +151,6 @@ roar_finish(AudioOutput *ao)
{
RoarOutput
*
self
=
(
RoarOutput
*
)
ao
;
self
->
Deinitialize
();
delete
self
;
}
...
...
src/output/plugins/ShoutOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -72,10 +72,6 @@ struct ShoutOutput final {
error
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
bool
Configure
(
const
config_param
&
param
,
Error
&
error
);
};
...
...
@@ -285,7 +281,6 @@ my_shout_init_driver(const config_param ¶m, Error &error)
}
if
(
!
sd
->
Configure
(
param
,
error
))
{
sd
->
Deinitialize
();
delete
sd
;
return
nullptr
;
}
...
...
@@ -369,7 +364,6 @@ my_shout_finish_driver(AudioOutput *ao)
encoder_finish
(
sd
->
encoder
);
sd
->
Deinitialize
();
delete
sd
;
shout_init_count
--
;
...
...
src/output/plugins/SolarisOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -61,10 +61,6 @@ struct SolarisOutput {
return
ao_base_init
(
&
base
,
&
solaris_output_plugin
,
param
,
error_r
);
}
void
Deinitialize
()
{
ao_base_finish
(
&
base
);
}
};
static
bool
...
...
@@ -95,7 +91,6 @@ solaris_output_finish(AudioOutput *ao)
{
SolarisOutput
*
so
=
(
SolarisOutput
*
)
ao
;
so
->
Deinitialize
();
delete
so
;
}
...
...
src/output/plugins/WinmmOutputPlugin.cxx
View file @
c4403c52
...
...
@@ -119,7 +119,6 @@ winmm_output_init(const config_param ¶m, Error &error)
const
char
*
device
=
param
.
GetBlockValue
(
"device"
);
if
(
!
get_device_id
(
device
,
&
wo
->
device_id
,
error
))
{
ao_base_finish
(
&
wo
->
base
);
delete
wo
;
return
nullptr
;
}
...
...
@@ -132,7 +131,6 @@ winmm_output_finish(AudioOutput *ao)
{
WinmmOutput
*
wo
=
(
WinmmOutput
*
)
ao
;
ao_base_finish
(
&
wo
->
base
);
delete
wo
;
}
...
...
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