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
3907ddbc
Commit
3907ddbc
authored
May 23, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/{Internal,Control}: add "noexcept"
parent
e616be0a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
98 additions
and
97 deletions
+98
-97
Control.cxx
src/output/Control.cxx
+30
-29
Control.hxx
src/output/Control.hxx
+36
-36
Finish.cxx
src/output/Finish.cxx
+1
-1
Internal.hxx
src/output/Internal.hxx
+11
-11
OutputPlugin.cxx
src/output/OutputPlugin.cxx
+4
-4
OutputPlugin.hxx
src/output/OutputPlugin.hxx
+4
-4
Source.hxx
src/output/Source.hxx
+1
-1
Thread.cxx
src/output/Thread.cxx
+11
-11
No files found.
src/output/Control.cxx
View file @
3907ddbc
...
...
@@ -54,25 +54,25 @@ AudioOutputControl::Configure(const ConfigBlock &block)
}
const
char
*
AudioOutputControl
::
GetName
()
const
AudioOutputControl
::
GetName
()
const
noexcept
{
return
output
->
GetName
();
}
AudioOutputClient
&
AudioOutputControl
::
GetClient
()
AudioOutputControl
::
GetClient
()
noexcept
{
return
*
output
->
client
;
}
Mixer
*
AudioOutputControl
::
GetMixer
()
const
AudioOutputControl
::
GetMixer
()
const
noexcept
{
return
output
->
mixer
;
}
bool
AudioOutputControl
::
LockSetEnabled
(
bool
new_value
)
AudioOutputControl
::
LockSetEnabled
(
bool
new_value
)
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
@@ -84,20 +84,20 @@ AudioOutputControl::LockSetEnabled(bool new_value)
}
bool
AudioOutputControl
::
LockToggleEnabled
()
AudioOutputControl
::
LockToggleEnabled
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
return
enabled
=
!
enabled
;
}
bool
AudioOutputControl
::
IsOpen
()
const
AudioOutputControl
::
IsOpen
()
const
noexcept
{
return
output
->
IsOpen
();
}
void
AudioOutputControl
::
WaitForCommand
()
AudioOutputControl
::
WaitForCommand
()
noexcept
{
while
(
!
IsCommandFinished
())
{
mutex
.
unlock
();
...
...
@@ -107,7 +107,7 @@ AudioOutputControl::WaitForCommand()
}
void
AudioOutputControl
::
CommandAsync
(
Command
cmd
)
AudioOutputControl
::
CommandAsync
(
Command
cmd
)
noexcept
{
assert
(
IsCommandFinished
());
...
...
@@ -116,14 +116,14 @@ AudioOutputControl::CommandAsync(Command cmd)
}
void
AudioOutputControl
::
CommandWait
(
Command
cmd
)
AudioOutputControl
::
CommandWait
(
Command
cmd
)
noexcept
{
CommandAsync
(
cmd
);
WaitForCommand
();
}
void
AudioOutputControl
::
LockCommandWait
(
Command
cmd
)
AudioOutputControl
::
LockCommandWait
(
Command
cmd
)
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
CommandWait
(
cmd
);
...
...
@@ -148,7 +148,7 @@ AudioOutputControl::EnableAsync()
}
void
AudioOutputControl
::
DisableAsync
()
AudioOutputControl
::
DisableAsync
()
noexcept
{
if
(
!
thread
.
IsDefined
())
{
if
(
output
->
plugin
.
disable
==
nullptr
)
...
...
@@ -177,7 +177,8 @@ AudioOutputControl::EnableDisableAsync()
}
inline
bool
AudioOutputControl
::
Open
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
mp
)
AudioOutputControl
::
Open
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
mp
)
noexcept
{
assert
(
allow_play
);
assert
(
audio_format
.
IsValid
());
...
...
@@ -215,7 +216,7 @@ AudioOutputControl::Open(const AudioFormat audio_format, const MusicPipe &mp)
}
void
AudioOutputControl
::
CloseWait
()
AudioOutputControl
::
CloseWait
()
noexcept
{
assert
(
allow_play
);
...
...
@@ -233,7 +234,7 @@ AudioOutputControl::CloseWait()
bool
AudioOutputControl
::
LockUpdate
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
mp
,
bool
force
)
bool
force
)
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
@@ -249,19 +250,19 @@ AudioOutputControl::LockUpdate(const AudioFormat audio_format,
}
bool
AudioOutputControl
::
LockIsChunkConsumed
(
const
MusicChunk
&
chunk
)
const
AudioOutputControl
::
LockIsChunkConsumed
(
const
MusicChunk
&
chunk
)
const
noexcept
{
return
output
->
LockIsChunkConsumed
(
chunk
);
}
void
AudioOutputControl
::
ClearTailChunk
(
const
MusicChunk
&
chunk
)
AudioOutputControl
::
ClearTailChunk
(
const
MusicChunk
&
chunk
)
noexcept
{
output
->
ClearTailChunk
(
chunk
);
}
void
AudioOutputControl
::
LockPlay
()
AudioOutputControl
::
LockPlay
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
@@ -274,7 +275,7 @@ AudioOutputControl::LockPlay()
}
void
AudioOutputControl
::
LockPauseAsync
()
AudioOutputControl
::
LockPauseAsync
()
noexcept
{
if
(
output
->
mixer
!=
nullptr
&&
output
->
plugin
.
pause
==
nullptr
)
/* the device has no pause mode: close the mixer,
...
...
@@ -290,7 +291,7 @@ AudioOutputControl::LockPauseAsync()
}
void
AudioOutputControl
::
LockDrainAsync
()
AudioOutputControl
::
LockDrainAsync
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
@@ -300,7 +301,7 @@ AudioOutputControl::LockDrainAsync()
}
void
AudioOutputControl
::
LockCancelAsync
()
AudioOutputControl
::
LockCancelAsync
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
@@ -311,7 +312,7 @@ AudioOutputControl::LockCancelAsync()
}
void
AudioOutputControl
::
LockAllowPlay
()
AudioOutputControl
::
LockAllowPlay
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
@@ -321,7 +322,7 @@ AudioOutputControl::LockAllowPlay()
}
void
AudioOutputControl
::
LockRelease
()
AudioOutputControl
::
LockRelease
()
noexcept
{
if
(
always_on
)
LockPauseAsync
();
...
...
@@ -330,7 +331,7 @@ AudioOutputControl::LockRelease()
}
void
AudioOutputControl
::
LockCloseWait
()
AudioOutputControl
::
LockCloseWait
()
noexcept
{
assert
(
!
output
->
open
||
!
fail_timer
.
IsDefined
());
...
...
@@ -339,13 +340,13 @@ AudioOutputControl::LockCloseWait()
}
void
AudioOutputControl
::
SetReplayGainMode
(
ReplayGainMode
_mode
)
AudioOutputControl
::
SetReplayGainMode
(
ReplayGainMode
_mode
)
noexcept
{
return
output
->
SetReplayGainMode
(
_mode
);
}
void
AudioOutputControl
::
StopThread
()
AudioOutputControl
::
StopThread
()
noexcept
{
assert
(
thread
.
IsDefined
());
assert
(
allow_play
);
...
...
@@ -355,14 +356,14 @@ AudioOutputControl::StopThread()
}
void
AudioOutput
::
BeginDestroy
()
AudioOutput
::
BeginDestroy
()
noexcept
{
if
(
mixer
!=
nullptr
)
mixer_auto_close
(
mixer
);
}
void
AudioOutputControl
::
BeginDestroy
()
AudioOutputControl
::
BeginDestroy
()
noexcept
{
output
->
BeginDestroy
();
...
...
@@ -373,13 +374,13 @@ AudioOutputControl::BeginDestroy()
}
void
AudioOutput
::
FinishDestroy
()
AudioOutput
::
FinishDestroy
()
noexcept
{
audio_output_free
(
this
);
}
void
AudioOutputControl
::
FinishDestroy
()
AudioOutputControl
::
FinishDestroy
()
noexcept
{
if
(
thread
.
IsDefined
())
thread
.
Join
();
...
...
src/output/Control.hxx
View file @
3907ddbc
...
...
@@ -183,72 +183,72 @@ public:
void
Configure
(
const
ConfigBlock
&
block
);
gcc_pure
const
char
*
GetName
()
const
;
const
char
*
GetName
()
const
noexcept
;
AudioOutputClient
&
GetClient
();
AudioOutputClient
&
GetClient
()
noexcept
;
gcc_pure
Mixer
*
GetMixer
()
const
;
Mixer
*
GetMixer
()
const
noexcept
;
/**
* Caller must lock the mutex.
*/
bool
IsEnabled
()
const
{
bool
IsEnabled
()
const
noexcept
{
return
enabled
;
}
/**
* @return true if the value has been modified
*/
bool
LockSetEnabled
(
bool
new_value
);
bool
LockSetEnabled
(
bool
new_value
)
noexcept
;
/**
* @return the new "enabled" value
*/
bool
LockToggleEnabled
();
bool
LockToggleEnabled
()
noexcept
;
gcc_pure
bool
IsOpen
()
const
;
bool
IsOpen
()
const
noexcept
;
/**
* Caller must lock the mutex.
*/
bool
IsBusy
()
const
{
bool
IsBusy
()
const
noexcept
{
return
IsOpen
()
&&
!
IsCommandFinished
();
}
/**
* Caller must lock the mutex.
*/
const
std
::
exception_ptr
&
GetLastError
()
const
{
const
std
::
exception_ptr
&
GetLastError
()
const
noexcept
{
return
last_error
;
}
void
StartThread
();
void
StopThread
();
void
StopThread
()
noexcept
;
/**
* Caller must lock the mutex.
*/
bool
IsCommandFinished
()
const
{
bool
IsCommandFinished
()
const
noexcept
{
return
command
==
Command
::
NONE
;
}
void
CommandFinished
();
void
CommandFinished
()
noexcept
;
/**
* Waits for command completion.
*
* Caller must lock the mutex.
*/
void
WaitForCommand
();
void
WaitForCommand
()
noexcept
;
/**
* Sends a command, but does not wait for completion.
*
* Caller must lock the mutex.
*/
void
CommandAsync
(
Command
cmd
);
void
CommandAsync
(
Command
cmd
)
noexcept
;
/**
* Sends a command to the #AudioOutput object and waits for
...
...
@@ -256,16 +256,16 @@ public:
*
* Caller must lock the mutex.
*/
void
CommandWait
(
Command
cmd
);
void
CommandWait
(
Command
cmd
)
noexcept
;
/**
* Lock the #AudioOutput object and execute the command
* synchronously.
*/
void
LockCommandWait
(
Command
cmd
);
void
LockCommandWait
(
Command
cmd
)
noexcept
;
void
BeginDestroy
();
void
FinishDestroy
();
void
BeginDestroy
()
noexcept
;
void
FinishDestroy
()
noexcept
;
/**
* Enables the device, but don't wait for completion.
...
...
@@ -279,7 +279,7 @@ public:
*
* Caller must lock the mutex.
*/
void
DisableAsync
();
void
DisableAsync
()
noexcept
;
/**
* Attempt to enable or disable the device as specified by the
...
...
@@ -289,23 +289,23 @@ public:
* Caller must lock the mutex.
*/
void
EnableDisableAsync
();
void
LockPauseAsync
();
void
LockPauseAsync
()
noexcept
;
void
CloseWait
();
void
LockCloseWait
();
void
CloseWait
()
noexcept
;
void
LockCloseWait
()
noexcept
;
/**
* Closes the audio output, but if the "always_on" flag is set, put it
* into pause mode instead.
*/
void
LockRelease
();
void
LockRelease
()
noexcept
;
void
SetReplayGainMode
(
ReplayGainMode
_mode
);
void
SetReplayGainMode
(
ReplayGainMode
_mode
)
noexcept
;
/**
* Caller must lock the mutex.
*/
bool
Open
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
mp
)
;
bool
Open
(
AudioFormat
audio_format
,
const
MusicPipe
&
mp
)
noexcept
;
/**
* Opens or closes the device, depending on the "enabled"
...
...
@@ -316,27 +316,27 @@ public:
*/
bool
LockUpdate
(
const
AudioFormat
audio_format
,
const
MusicPipe
&
mp
,
bool
force
);
bool
force
)
noexcept
;
gcc_pure
bool
LockIsChunkConsumed
(
const
MusicChunk
&
chunk
)
const
;
bool
LockIsChunkConsumed
(
const
MusicChunk
&
chunk
)
const
noexcept
;
void
ClearTailChunk
(
const
MusicChunk
&
chunk
);
void
ClearTailChunk
(
const
MusicChunk
&
chunk
)
noexcept
;
void
LockPlay
();
void
LockDrainAsync
();
void
LockPlay
()
noexcept
;
void
LockDrainAsync
()
noexcept
;
/**
* Clear the "allow_play" flag and send the "CANCEL" command
* asynchronously. To finish the operation, the caller has to
* call LockAllowPlay().
*/
void
LockCancelAsync
();
void
LockCancelAsync
()
noexcept
;
/**
* Set the "allow_play" and signal the thread.
*/
void
LockAllowPlay
();
void
LockAllowPlay
()
noexcept
;
private
:
/**
...
...
@@ -351,11 +351,11 @@ private:
* @return true if playback should be continued, false if a
* command was issued
*/
bool
WaitForDelay
();
bool
WaitForDelay
()
noexcept
;
bool
FillSourceOrClose
();
bool
PlayChunk
();
bool
PlayChunk
()
noexcept
;
/**
* Plays all remaining chunks, until the tail of the pipe has
...
...
@@ -365,9 +365,9 @@ private:
* @return true if at least one chunk has been available,
* false if the tail of the pipe was already reached
*/
bool
Play
();
bool
Play
()
noexcept
;
void
Pause
();
void
Pause
()
noexcept
;
/**
* The OutputThread.
...
...
src/output/Finish.cxx
View file @
3907ddbc
...
...
@@ -38,7 +38,7 @@ AudioOutput::~AudioOutput()
}
void
audio_output_free
(
AudioOutput
*
ao
)
audio_output_free
(
AudioOutput
*
ao
)
noexcept
{
assert
(
!
ao
->
IsOpen
());
...
...
src/output/Internal.hxx
View file @
3907ddbc
...
...
@@ -163,8 +163,8 @@ public:
MixerListener
&
mixer_listener
,
const
ConfigBlock
&
block
);
void
BeginDestroy
();
void
FinishDestroy
();
void
BeginDestroy
()
noexcept
;
void
FinishDestroy
()
noexcept
;
const
char
*
GetName
()
const
{
return
name
;
...
...
@@ -177,7 +177,7 @@ public:
return
open
;
}
void
SetReplayGainMode
(
ReplayGainMode
_mode
)
{
void
SetReplayGainMode
(
ReplayGainMode
_mode
)
noexcept
{
source
.
SetReplayGainMode
(
_mode
);
}
...
...
@@ -204,14 +204,14 @@ public:
*/
void
Enable
();
void
Disable
();
void
Disable
()
noexcept
;
/**
* Throws #std::runtime_error on error.
*/
void
Open
(
AudioFormat
audio_format
,
const
MusicPipe
&
pipe
);
void
Close
(
bool
drain
);
void
Close
(
bool
drain
)
noexcept
;
private
:
/**
...
...
@@ -229,18 +229,18 @@ private:
*
* Mutex must not be locked.
*/
void
CloseOutput
(
bool
drain
);
void
CloseOutput
(
bool
drain
)
noexcept
;
/**
* Mutex must not be locked.
*/
void
CloseFilter
();
void
CloseFilter
()
noexcept
;
public
:
void
BeginPause
();
bool
IteratePause
();
void
BeginPause
()
noexcept
;
bool
IteratePause
()
noexcept
;
void
EndPause
()
{
void
EndPause
()
noexcept
{
pause
=
false
;
}
};
...
...
@@ -262,6 +262,6 @@ audio_output_new(EventLoop &event_loop,
AudioOutputClient
&
client
);
void
audio_output_free
(
AudioOutput
*
ao
);
audio_output_free
(
AudioOutput
*
ao
)
noexcept
;
#endif
src/output/OutputPlugin.cxx
View file @
3907ddbc
...
...
@@ -32,7 +32,7 @@ ao_plugin_init(EventLoop &event_loop,
}
void
ao_plugin_finish
(
AudioOutput
*
ao
)
ao_plugin_finish
(
AudioOutput
*
ao
)
noexcept
{
ao
->
plugin
.
finish
(
ao
);
}
...
...
@@ -45,7 +45,7 @@ ao_plugin_enable(AudioOutput &ao)
}
void
ao_plugin_disable
(
AudioOutput
&
ao
)
ao_plugin_disable
(
AudioOutput
&
ao
)
noexcept
{
if
(
ao
.
plugin
.
disable
!=
nullptr
)
ao
.
plugin
.
disable
(
&
ao
);
...
...
@@ -58,7 +58,7 @@ ao_plugin_open(AudioOutput &ao, AudioFormat &audio_format)
}
void
ao_plugin_close
(
AudioOutput
&
ao
)
ao_plugin_close
(
AudioOutput
&
ao
)
noexcept
{
ao
.
plugin
.
close
(
&
ao
);
}
...
...
@@ -92,7 +92,7 @@ ao_plugin_drain(AudioOutput &ao)
}
void
ao_plugin_cancel
(
AudioOutput
&
ao
)
ao_plugin_cancel
(
AudioOutput
&
ao
)
noexcept
{
if
(
ao
.
plugin
.
cancel
!=
nullptr
)
ao
.
plugin
.
cancel
(
&
ao
);
...
...
src/output/OutputPlugin.hxx
View file @
3907ddbc
...
...
@@ -168,19 +168,19 @@ ao_plugin_init(EventLoop &event_loop,
const
ConfigBlock
&
block
);
void
ao_plugin_finish
(
AudioOutput
*
ao
);
ao_plugin_finish
(
AudioOutput
*
ao
)
noexcept
;
void
ao_plugin_enable
(
AudioOutput
&
ao
);
void
ao_plugin_disable
(
AudioOutput
&
ao
);
ao_plugin_disable
(
AudioOutput
&
ao
)
noexcept
;
void
ao_plugin_open
(
AudioOutput
&
ao
,
AudioFormat
&
audio_format
);
void
ao_plugin_close
(
AudioOutput
&
ao
);
ao_plugin_close
(
AudioOutput
&
ao
)
noexcept
;
gcc_pure
std
::
chrono
::
steady_clock
::
duration
...
...
@@ -196,7 +196,7 @@ void
ao_plugin_drain
(
AudioOutput
&
ao
);
void
ao_plugin_cancel
(
AudioOutput
&
ao
);
ao_plugin_cancel
(
AudioOutput
&
ao
)
noexcept
;
bool
ao_plugin_pause
(
AudioOutput
&
ao
);
...
...
src/output/Source.hxx
View file @
3907ddbc
...
...
@@ -119,7 +119,7 @@ class AudioOutputSource {
ConstBuffer
<
uint8_t
>
pending_data
;
public
:
void
SetReplayGainMode
(
ReplayGainMode
_mode
)
{
void
SetReplayGainMode
(
ReplayGainMode
_mode
)
noexcept
{
replay_gain_mode
=
_mode
;
}
...
...
src/output/Thread.cxx
View file @
3907ddbc
...
...
@@ -48,7 +48,7 @@
#include <string.h>
void
AudioOutputControl
::
CommandFinished
()
AudioOutputControl
::
CommandFinished
()
noexcept
{
assert
(
command
!=
Command
::
NONE
);
command
=
Command
::
NONE
;
...
...
@@ -75,7 +75,7 @@ AudioOutput::Enable()
}
inline
void
AudioOutput
::
Disable
()
AudioOutput
::
Disable
()
noexcept
{
if
(
open
)
Close
(
false
);
...
...
@@ -89,7 +89,7 @@ AudioOutput::Disable()
}
void
AudioOutput
::
CloseFilter
()
AudioOutput
::
CloseFilter
()
noexcept
{
if
(
mixer
!=
nullptr
&&
mixer
->
IsPlugin
(
software_mixer_plugin
))
software_mixer_set_filter
(
*
mixer
,
nullptr
);
...
...
@@ -220,7 +220,7 @@ AudioOutputControl::InternalOpen(const AudioFormat audio_format,
}
void
AudioOutput
::
Close
(
bool
drain
)
AudioOutput
::
Close
(
bool
drain
)
noexcept
{
assert
(
open
);
...
...
@@ -236,7 +236,7 @@ AudioOutput::Close(bool drain)
}
inline
void
AudioOutput
::
CloseOutput
(
bool
drain
)
AudioOutput
::
CloseOutput
(
bool
drain
)
noexcept
{
if
(
drain
)
ao_plugin_drain
(
*
this
);
...
...
@@ -253,7 +253,7 @@ AudioOutput::CloseOutput(bool drain)
* was issued
*/
inline
bool
AudioOutputControl
::
WaitForDelay
()
AudioOutputControl
::
WaitForDelay
()
noexcept
{
while
(
true
)
{
const
auto
delay
=
ao_plugin_delay
(
*
output
);
...
...
@@ -284,7 +284,7 @@ try {
}
inline
bool
AudioOutputControl
::
PlayChunk
()
AudioOutputControl
::
PlayChunk
()
noexcept
{
if
(
tags
)
{
const
auto
*
tag
=
output
->
source
.
ReadTag
();
...
...
@@ -340,7 +340,7 @@ AudioOutputControl::PlayChunk()
}
inline
bool
AudioOutputControl
::
Play
()
AudioOutputControl
::
Play
()
noexcept
{
if
(
!
FillSourceOrClose
())
/* no chunk available */
...
...
@@ -380,7 +380,7 @@ AudioOutputControl::Play()
}
inline
void
AudioOutput
::
BeginPause
()
AudioOutput
::
BeginPause
()
noexcept
{
{
const
ScopeUnlock
unlock
(
mutex
);
...
...
@@ -391,7 +391,7 @@ AudioOutput::BeginPause()
}
inline
bool
AudioOutput
::
IteratePause
()
AudioOutput
::
IteratePause
()
noexcept
{
bool
success
;
...
...
@@ -411,7 +411,7 @@ AudioOutput::IteratePause()
}
inline
void
AudioOutputControl
::
Pause
()
AudioOutputControl
::
Pause
()
noexcept
{
output
->
BeginPause
();
CommandFinished
();
...
...
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