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
9e715089
Commit
9e715089
authored
Aug 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commands: new command "toggleoutput"
parent
1a852bc3
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
0 deletions
+70
-0
NEWS
NEWS
+2
-0
protocol.xml
doc/protocol.xml
+14
-0
AllCommands.cxx
src/AllCommands.cxx
+1
-0
OutputCommand.cxx
src/OutputCommand.cxx
+27
-0
OutputCommand.hxx
src/OutputCommand.hxx
+7
-0
OutputCommands.cxx
src/OutputCommands.cxx
+16
-0
OutputCommands.hxx
src/OutputCommands.hxx
+3
-0
No files found.
NEWS
View file @
9e715089
ver 0.18 (2012/??/??)
* protocol:
- new command "toggleoutput"
* innput:
- soup: plugin removed
* decoder:
...
...
doc/protocol.xml
View file @
9e715089
...
...
@@ -1876,6 +1876,20 @@ OK
</para>
</listitem>
</varlistentry>
<varlistentry
id=
"command_toggleoutput"
>
<term>
<cmdsynopsis>
<command>
toggleoutput
</command>
<arg
choice=
"req"
><replaceable>
ID
</replaceable></arg>
</cmdsynopsis>
</term>
<listitem>
<para>
Turns an output on or off, depending on the current
state.
</para>
</listitem>
</varlistentry>
<varlistentry
id=
"command_outputs"
>
<term>
<cmdsynopsis>
...
...
src/AllCommands.cxx
View file @
9e715089
...
...
@@ -159,6 +159,7 @@ static const struct command commands[] = {
{
"swap"
,
PERMISSION_CONTROL
,
2
,
2
,
handle_swap
},
{
"swapid"
,
PERMISSION_CONTROL
,
2
,
2
,
handle_swapid
},
{
"tagtypes"
,
PERMISSION_READ
,
0
,
0
,
handle_tagtypes
},
{
"toggleoutput"
,
PERMISSION_ADMIN
,
1
,
1
,
handle_toggleoutput
},
{
"unsubscribe"
,
PERMISSION_READ
,
1
,
1
,
handle_unsubscribe
},
{
"update"
,
PERMISSION_CONTROL
,
0
,
1
,
handle_update
},
{
"urlhandlers"
,
PERMISSION_READ
,
0
,
0
,
handle_urlhandlers
},
...
...
src/OutputCommand.cxx
View file @
9e715089
...
...
@@ -84,3 +84,30 @@ audio_output_disable_index(unsigned idx)
return
true
;
}
bool
audio_output_toggle_index
(
unsigned
idx
)
{
struct
audio_output
*
ao
;
if
(
idx
>=
audio_output_count
())
return
false
;
ao
=
audio_output_get
(
idx
);
const
bool
enabled
=
ao
->
enabled
=
!
ao
->
enabled
;
idle_add
(
IDLE_OUTPUT
);
if
(
!
enabled
)
{
Mixer
*
mixer
=
ao
->
mixer
;
if
(
mixer
!=
nullptr
)
{
mixer_close
(
mixer
);
idle_add
(
IDLE_MIXER
);
}
}
ao
->
player_control
->
UpdateAudio
();
++
audio_output_state_version
;
return
true
;
}
src/OutputCommand.hxx
View file @
9e715089
...
...
@@ -41,4 +41,11 @@ audio_output_enable_index(unsigned idx);
bool
audio_output_disable_index
(
unsigned
idx
);
/**
* Toggles an audio output. Returns false if the specified output
* does not exist.
*/
bool
audio_output_toggle_index
(
unsigned
idx
);
#endif
src/OutputCommands.cxx
View file @
9e715089
...
...
@@ -65,6 +65,22 @@ handle_disableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[])
}
enum
command_return
handle_toggleoutput
(
Client
*
client
,
gcc_unused
int
argc
,
char
*
argv
[])
{
unsigned
device
;
if
(
!
check_unsigned
(
client
,
&
device
,
argv
[
1
]))
return
COMMAND_RETURN_ERROR
;
if
(
!
audio_output_toggle_index
(
device
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No such audio output"
);
return
COMMAND_RETURN_ERROR
;
}
return
COMMAND_RETURN_OK
;
}
enum
command_return
handle_devices
(
Client
*
client
,
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
{
...
...
src/OutputCommands.hxx
View file @
9e715089
...
...
@@ -31,6 +31,9 @@ enum command_return
handle_disableoutput
(
Client
*
client
,
int
argc
,
char
*
argv
[]);
enum
command_return
handle_toggleoutput
(
Client
*
client
,
int
argc
,
char
*
argv
[]);
enum
command_return
handle_devices
(
Client
*
client
,
int
argc
,
char
*
argv
[]);
#endif
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