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
5eef1468
Commit
5eef1468
authored
May 22, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Internal: move several flags to struct AudioOutputControl
parent
2e65686f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
47 deletions
+37
-47
Control.cxx
src/output/Control.cxx
+12
-15
Control.hxx
src/output/Control.hxx
+24
-2
Init.cxx
src/output/Init.cxx
+0
-4
Internal.hxx
src/output/Internal.hxx
+0
-25
Thread.cxx
src/output/Thread.cxx
+1
-1
No files found.
src/output/Control.cxx
View file @
5eef1468
...
...
@@ -25,6 +25,7 @@
#include "mixer/MixerControl.hxx"
#include "notify.hxx"
#include "filter/plugins/ReplayGainFilterPlugin.hxx"
#include "config/Block.hxx"
#include "Log.hxx"
#include <stdexcept>
...
...
@@ -47,7 +48,9 @@ AudioOutputControl::AudioOutputControl(AudioOutput *_output)
void
AudioOutputControl
::
Configure
(
const
ConfigBlock
&
block
)
{
(
void
)
block
;
tags
=
block
.
GetBlockValue
(
"tags"
,
true
);
always_on
=
block
.
GetBlockValue
(
"always_on"
,
false
);
enabled
=
block
.
GetBlockValue
(
"enabled"
,
true
);
}
const
char
*
...
...
@@ -69,20 +72,14 @@ AudioOutputControl::GetMixer() const
}
bool
AudioOutputControl
::
IsEnabled
()
const
{
return
output
->
IsEnabled
();
}
bool
AudioOutputControl
::
LockSetEnabled
(
bool
new_value
)
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
if
(
new_value
==
output
->
enabled
)
if
(
new_value
==
enabled
)
return
false
;
output
->
enabled
=
new_value
;
enabled
=
new_value
;
return
true
;
}
...
...
@@ -90,7 +87,7 @@ bool
AudioOutputControl
::
LockToggleEnabled
()
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
return
output
->
enabled
=
!
output
->
enabled
;
return
enabled
=
!
enabled
;
}
bool
...
...
@@ -170,10 +167,10 @@ AudioOutputControl::DisableAsync()
void
AudioOutputControl
::
EnableDisableAsync
()
{
if
(
output
->
enabled
==
output
->
really_enabled
)
if
(
enabled
==
output
->
really_enabled
)
return
;
if
(
output
->
enabled
)
if
(
enabled
)
EnableAsync
();
else
DisableAsync
();
...
...
@@ -188,7 +185,7 @@ AudioOutputControl::Open(const AudioFormat audio_format, const MusicPipe &mp)
fail_timer
.
Reset
();
if
(
output
->
open
&&
audio_format
==
request
.
audio_format
)
{
assert
(
request
.
pipe
==
&
mp
||
(
output
->
always_on
&&
output
->
pause
));
assert
(
request
.
pipe
==
&
mp
||
(
always_on
&&
output
->
pause
));
if
(
!
output
->
pause
)
/* already open, already the right parameters
...
...
@@ -240,7 +237,7 @@ AudioOutputControl::LockUpdate(const AudioFormat audio_format,
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
if
(
output
->
enabled
&&
output
->
really_enabled
)
{
if
(
enabled
&&
output
->
really_enabled
)
{
if
(
force
||
!
fail_timer
.
IsDefined
()
||
fail_timer
.
Check
(
REOPEN_AFTER
*
1000
))
{
return
Open
(
audio_format
,
mp
);
...
...
@@ -326,7 +323,7 @@ AudioOutputControl::LockAllowPlay()
void
AudioOutputControl
::
LockRelease
()
{
if
(
output
->
always_on
)
if
(
always_on
)
LockPauseAsync
();
else
LockCloseWait
();
...
...
src/output/Control.hxx
View file @
5eef1468
...
...
@@ -120,6 +120,24 @@ class AudioOutputControl {
}
command
=
Command
::
NONE
;
/**
* Will this output receive tags from the decoder? The
* default is true, but it may be configured to false to
* suppress sending tags to the output.
*/
bool
tags
;
/**
* Shall this output always play something (i.e. silence),
* even when playback is stopped?
*/
bool
always_on
;
/**
* Has the user enabled this device?
*/
bool
enabled
=
true
;
/**
* When this flag is set, the output thread will not do any
* playback. It will wait until the flag is cleared.
*
...
...
@@ -172,8 +190,12 @@ public:
gcc_pure
Mixer
*
GetMixer
()
const
;
gcc_pure
bool
IsEnabled
()
const
;
/**
* Caller must lock the mutex.
*/
bool
IsEnabled
()
const
{
return
enabled
;
}
/**
* @return true if the value has been modified
...
...
src/output/Init.cxx
View file @
5eef1468
...
...
@@ -171,10 +171,6 @@ AudioOutput::Configure(const ConfigBlock &block)
config_audio_format
.
Clear
();
}
tags
=
block
.
GetBlockValue
(
"tags"
,
true
);
always_on
=
block
.
GetBlockValue
(
"always_on"
,
false
);
enabled
=
block
.
GetBlockValue
(
"enabled"
,
true
);
/* set up the filter chain */
prepared_filter
=
filter_chain_new
();
...
...
src/output/Internal.hxx
View file @
5eef1468
...
...
@@ -55,24 +55,6 @@ struct AudioOutput {
Mixer
*
mixer
=
nullptr
;
/**
* Will this output receive tags from the decoder? The
* default is true, but it may be configured to false to
* suppress sending tags to the output.
*/
bool
tags
;
/**
* Shall this output always play something (i.e. silence),
* even when playback is stopped?
*/
bool
always_on
;
/**
* Has the user enabled this device?
*/
bool
enabled
=
true
;
/**
* Is this device actually enabled, i.e. the "enable" method
* has succeeded?
*/
...
...
@@ -191,13 +173,6 @@ public:
/**
* Caller must lock the mutex.
*/
bool
IsEnabled
()
const
{
return
enabled
;
}
/**
* Caller must lock the mutex.
*/
bool
IsOpen
()
const
{
return
open
;
}
...
...
src/output/Thread.cxx
View file @
5eef1468
...
...
@@ -270,7 +270,7 @@ try {
inline
bool
AudioOutputControl
::
PlayChunk
()
{
if
(
output
->
tags
)
{
if
(
tags
)
{
const
auto
*
tag
=
output
->
source
.
ReadTag
();
if
(
tag
!=
nullptr
)
{
const
ScopeUnlock
unlock
(
mutex
);
...
...
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