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
4ddc0a48
Commit
4ddc0a48
authored
Sep 07, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audio: don't pass "fd" to {en,dis}ableAudioDevice()
No protocol code in the audio output library.
parent
f7e414d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
18 deletions
+21
-18
audio.c
src/audio.c
+5
-12
audio.h
src/audio.h
+2
-2
command.c
src/command.c
+14
-4
No files found.
src/audio.c
View file @
4ddc0a48
...
...
@@ -19,9 +19,7 @@
#include "audio.h"
#include "audioOutput.h"
#include "log.h"
#include "command.h"
#include "path.h"
#include "ack.h"
#include "myfprintf.h"
#include "os_compat.h"
...
...
@@ -428,13 +426,10 @@ void sendMetadataToAudioDevice(const struct tag *tag)
}
}
int
enableAudioDevice
(
int
fd
,
unsigned
int
device
)
int
enableAudioDevice
(
unsigned
int
device
)
{
if
(
device
>=
audioOutputArraySize
)
{
commandError
(
fd
,
ACK_ERROR_ARG
,
"audio output device id %i "
"doesn't exist
\n
"
,
device
);
if
(
device
>=
audioOutputArraySize
)
return
-
1
;
}
if
(
!
(
audioDeviceStates
[
device
]
&
0x01
))
audioDeviceStates
[
device
]
=
DEVICE_ENABLE
;
...
...
@@ -442,13 +437,11 @@ int enableAudioDevice(int fd, unsigned int device)
return
0
;
}
int
disableAudioDevice
(
int
fd
,
unsigned
int
device
)
int
disableAudioDevice
(
unsigned
int
device
)
{
if
(
device
>=
audioOutputArraySize
)
{
commandError
(
fd
,
ACK_ERROR_ARG
,
"audio output device id %i "
"doesn't exist
\n
"
,
device
);
if
(
device
>=
audioOutputArraySize
)
return
-
1
;
}
if
(
audioDeviceStates
[
device
]
&
0x01
)
audioDeviceStates
[
device
]
=
DEVICE_DISABLE
;
...
...
src/audio.h
View file @
4ddc0a48
...
...
@@ -60,9 +60,9 @@ void sendMetadataToAudioDevice(const struct tag *tag);
/* these functions are called in the main parent process while the child
process is busy playing to the audio */
int
enableAudioDevice
(
int
fd
,
unsigned
int
device
);
int
enableAudioDevice
(
unsigned
int
device
);
int
disableAudioDevice
(
int
fd
,
unsigned
int
device
);
int
disableAudioDevice
(
unsigned
int
device
);
void
printAudioDevices
(
int
fd
);
...
...
src/command.c
View file @
4ddc0a48
...
...
@@ -1177,21 +1177,31 @@ static int handleCrossfade(int fd, mpd_unused int *permission,
static
int
handleEnableDevice
(
int
fd
,
mpd_unused
int
*
permission
,
mpd_unused
int
argc
,
char
*
argv
[])
{
int
device
;
int
device
,
ret
;
if
(
check_int
(
fd
,
&
device
,
argv
[
1
],
check_non_negative
,
argv
[
1
])
<
0
)
return
-
1
;
return
enableAudioDevice
(
fd
,
device
);
ret
=
enableAudioDevice
(
device
);
if
(
ret
==
-
1
)
commandError
(
fd
,
ACK_ERROR_NO_EXIST
,
"No such audio output"
);
return
ret
;
}
static
int
handleDisableDevice
(
int
fd
,
mpd_unused
int
*
permission
,
mpd_unused
int
argc
,
char
*
argv
[])
{
int
device
;
int
device
,
ret
;
if
(
check_int
(
fd
,
&
device
,
argv
[
1
],
check_non_negative
,
argv
[
1
])
<
0
)
return
-
1
;
return
disableAudioDevice
(
fd
,
device
);
ret
=
disableAudioDevice
(
device
);
if
(
ret
==
-
1
)
commandError
(
fd
,
ACK_ERROR_NO_EXIST
,
"No such audio output"
);
return
ret
;
}
static
int
handleDevices
(
int
fd
,
mpd_unused
int
*
permission
,
...
...
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