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
06c7e551
Commit
06c7e551
authored
Aug 08, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Filtered: add methods SupportsEnableDisable(), SupportsPause()
parent
b3eb8489
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
4 deletions
+29
-4
Control.cxx
src/output/Control.cxx
+3
-4
Filtered.cxx
src/output/Filtered.cxx
+14
-0
Filtered.hxx
src/output/Filtered.hxx
+12
-0
No files found.
src/output/Control.cxx
View file @
06c7e551
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#include "config.h"
#include "config.h"
#include "Control.hxx"
#include "Control.hxx"
#include "Filtered.hxx"
#include "Filtered.hxx"
#include "OutputPlugin.hxx"
#include "Domain.hxx"
#include "Domain.hxx"
#include "mixer/MixerControl.hxx"
#include "mixer/MixerControl.hxx"
#include "notify.hxx"
#include "notify.hxx"
...
@@ -127,7 +126,7 @@ void
...
@@ -127,7 +126,7 @@ void
AudioOutputControl
::
EnableAsync
()
AudioOutputControl
::
EnableAsync
()
{
{
if
(
!
thread
.
IsDefined
())
{
if
(
!
thread
.
IsDefined
())
{
if
(
output
->
plugin
.
enable
==
nullptr
)
{
if
(
!
output
->
SupportsEnableDisable
()
)
{
/* don't bother to start the thread now if the
/* don't bother to start the thread now if the
device doesn't even have a enable() method;
device doesn't even have a enable() method;
just assign the variable and we're done */
just assign the variable and we're done */
...
@@ -145,7 +144,7 @@ void
...
@@ -145,7 +144,7 @@ void
AudioOutputControl
::
DisableAsync
()
noexcept
AudioOutputControl
::
DisableAsync
()
noexcept
{
{
if
(
!
thread
.
IsDefined
())
{
if
(
!
thread
.
IsDefined
())
{
if
(
output
->
plugin
.
disable
==
nullptr
)
if
(
!
output
->
SupportsEnableDisable
()
)
really_enabled
=
false
;
really_enabled
=
false
;
else
else
/* if there's no thread yet, the device cannot
/* if there's no thread yet, the device cannot
...
@@ -275,7 +274,7 @@ AudioOutputControl::LockPlay() noexcept
...
@@ -275,7 +274,7 @@ AudioOutputControl::LockPlay() noexcept
void
void
AudioOutputControl
::
LockPauseAsync
()
noexcept
AudioOutputControl
::
LockPauseAsync
()
noexcept
{
{
if
(
output
->
mixer
!=
nullptr
&&
output
->
plugin
.
pause
==
nullptr
)
if
(
output
->
mixer
!=
nullptr
&&
!
output
->
SupportsPause
()
)
/* the device has no pause mode: close the mixer,
/* the device has no pause mode: close the mixer,
unless its "global" flag is set (checked by
unless its "global" flag is set (checked by
mixer_auto_close()) */
mixer_auto_close()) */
...
...
src/output/Filtered.cxx
View file @
06c7e551
...
@@ -28,6 +28,20 @@
...
@@ -28,6 +28,20 @@
#include "util/RuntimeError.hxx"
#include "util/RuntimeError.hxx"
#include "util/StringBuffer.hxx"
#include "util/StringBuffer.hxx"
bool
FilteredAudioOutput
::
SupportsEnableDisable
()
const
noexcept
{
assert
((
plugin
.
enable
==
nullptr
)
==
(
plugin
.
disable
==
nullptr
));
return
plugin
.
enable
!=
nullptr
;
}
bool
FilteredAudioOutput
::
SupportsPause
()
const
noexcept
{
return
plugin
.
pause
!=
nullptr
;
}
void
void
FilteredAudioOutput
::
Enable
()
FilteredAudioOutput
::
Enable
()
{
{
...
...
src/output/Filtered.hxx
View file @
06c7e551
...
@@ -146,6 +146,18 @@ public:
...
@@ -146,6 +146,18 @@ public:
}
}
/**
/**
* Does the plugin support enabling/disabling a device?
*/
gcc_pure
bool
SupportsEnableDisable
()
const
noexcept
;
/**
* Does the plugin support pausing a device?
*/
gcc_pure
bool
SupportsPause
()
const
noexcept
;
/**
* Throws #std::runtime_error on error.
* Throws #std::runtime_error on error.
*/
*/
void
Enable
();
void
Enable
();
...
...
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