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
4484411a
Commit
4484411a
authored
Dec 29, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Internal: add various trivial getter methods
parent
61a151c8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
13 deletions
+38
-13
MixerAll.cxx
src/mixer/MixerAll.cxx
+2
-2
Finish.cxx
src/output/Finish.cxx
+1
-1
Internal.hxx
src/output/Internal.hxx
+24
-0
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+8
-8
OutputPrint.cxx
src/output/OutputPrint.cxx
+1
-1
OutputState.cxx
src/output/OutputState.cxx
+2
-1
No files found.
src/mixer/MixerAll.cxx
View file @
4484411a
...
...
@@ -45,7 +45,7 @@ output_mixer_get_volume(const AudioOutput &ao)
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"Failed to read mixer for '%s'"
,
ao
.
name
);
ao
.
GetName
()
);
return
-
1
;
}
}
...
...
@@ -88,7 +88,7 @@ output_mixer_set_volume(AudioOutput &ao, unsigned volume)
}
catch
(
const
std
::
runtime_error
&
e
)
{
FormatError
(
e
,
"Failed to set mixer for '%s'"
,
ao
.
name
);
ao
.
GetName
()
);
return
false
;
}
}
...
...
src/output/Finish.cxx
View file @
4484411a
...
...
@@ -42,7 +42,7 @@ AudioOutput::~AudioOutput()
void
audio_output_free
(
AudioOutput
*
ao
)
{
assert
(
!
ao
->
open
);
assert
(
!
ao
->
IsOpen
()
);
assert
(
!
ao
->
fail_timer
.
IsDefined
());
assert
(
!
ao
->
thread
.
IsDefined
());
...
...
src/output/Internal.hxx
View file @
4484411a
...
...
@@ -288,15 +288,39 @@ public:
void
BeginDestroy
();
void
FinishDestroy
();
const
char
*
GetName
()
const
{
return
name
;
}
/**
* Caller must lock the mutex.
*/
bool
IsEnabled
()
const
{
return
enabled
;
}
/**
* Caller must lock the mutex.
*/
bool
IsOpen
()
const
{
return
open
;
}
/**
* Caller must lock the mutex.
*/
bool
IsCommandFinished
()
const
{
return
command
==
Command
::
NONE
;
}
/**
* Caller must lock the mutex.
*/
const
std
::
exception_ptr
&
GetLastError
()
const
{
return
last_error
;
}
/**
* Waits for command completion.
*
* Caller must lock the mutex.
...
...
src/output/MultipleOutputs.cxx
View file @
4484411a
...
...
@@ -76,9 +76,9 @@ MultipleOutputs::Configure(EventLoop &event_loop,
auto
output
=
LoadOutput
(
event_loop
,
replay_gain_config
,
mixer_listener
,
client
,
*
param
);
if
(
FindByName
(
output
->
name
)
!=
nullptr
)
if
(
FindByName
(
output
->
GetName
()
)
!=
nullptr
)
throw
FormatRuntimeError
(
"output devices with identical "
"names: %s"
,
output
->
name
);
"names: %s"
,
output
->
GetName
()
);
outputs
.
push_back
(
output
);
}
...
...
@@ -97,7 +97,7 @@ AudioOutput *
MultipleOutputs
::
FindByName
(
const
char
*
name
)
const
{
for
(
auto
i
:
outputs
)
if
(
strcmp
(
i
->
name
,
name
)
==
0
)
if
(
strcmp
(
i
->
GetName
()
,
name
)
==
0
)
return
i
;
return
nullptr
;
...
...
@@ -217,13 +217,13 @@ MultipleOutputs::Open(const AudioFormat audio_format,
for
(
auto
ao
:
outputs
)
{
const
ScopeLock
lock
(
ao
->
mutex
);
if
(
ao
->
enabled
)
if
(
ao
->
IsEnabled
()
)
enabled
=
true
;
if
(
ao
->
open
)
if
(
ao
->
IsOpen
()
)
ret
=
true
;
else
if
(
ao
->
last_error
&&
!
first_error
)
first_error
=
ao
->
last_error
;
else
if
(
!
first_error
)
first_error
=
ao
->
GetLastError
()
;
}
if
(
!
enabled
)
{
...
...
@@ -265,7 +265,7 @@ MultipleOutputs::ClearTailChunk(const MusicChunk *chunk,
/* this mutex will be unlocked by the caller when it's
ready */
ao
->
mutex
.
lock
();
locked
[
i
]
=
ao
->
open
;
locked
[
i
]
=
ao
->
IsOpen
()
;
if
(
!
locked
[
i
])
{
ao
->
mutex
.
unlock
();
...
...
src/output/OutputPrint.cxx
View file @
4484411a
...
...
@@ -37,6 +37,6 @@ printAudioDevices(Response &r, const MultipleOutputs &outputs)
r
.
Format
(
"outputid: %i
\n
"
"outputname: %s
\n
"
"outputenabled: %i
\n
"
,
i
,
ao
.
name
,
ao
.
enabled
);
i
,
ao
.
GetName
(),
ao
.
IsEnabled
()
);
}
}
src/output/OutputState.cxx
View file @
4484411a
...
...
@@ -45,7 +45,8 @@ audio_output_state_save(BufferedOutputStream &os,
const
AudioOutput
&
ao
=
outputs
.
Get
(
i
);
const
ScopeLock
lock
(
ao
.
mutex
);
os
.
Format
(
AUDIO_DEVICE_STATE
"%d:%s
\n
"
,
ao
.
enabled
,
ao
.
name
);
os
.
Format
(
AUDIO_DEVICE_STATE
"%d:%s
\n
"
,
ao
.
IsEnabled
(),
ao
.
GetName
());
}
}
...
...
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