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
cf376b4b
Commit
cf376b4b
authored
Oct 29, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output: moved audioDeviceStates to audio_output.enabled
parent
2f76db4c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
20 deletions
+12
-20
audio.c
src/audio.c
+6
-20
output_init.c
src/output_init.c
+1
-0
output_internal.h
src/output_internal.h
+5
-0
No files found.
src/audio.c
View file @
cf376b4b
...
@@ -39,12 +39,6 @@ static struct audio_format input_audio_format;
...
@@ -39,12 +39,6 @@ static struct audio_format input_audio_format;
static
struct
audio_output
*
audioOutputArray
;
static
struct
audio_output
*
audioOutputArray
;
static
unsigned
int
audioOutputArraySize
;
static
unsigned
int
audioOutputArraySize
;
/**
* A flag for each audio device: true = to be enabled, false = to be
* disabled.
*/
static
bool
*
audioDeviceStates
;
static
unsigned
int
audio_output_count
(
void
)
static
unsigned
int
audio_output_count
(
void
)
{
{
unsigned
int
nr
=
0
;
unsigned
int
nr
=
0
;
...
@@ -64,8 +58,6 @@ void initAudioDriver(void)
...
@@ -64,8 +58,6 @@ void initAudioDriver(void)
unsigned
int
i
;
unsigned
int
i
;
audioOutputArraySize
=
audio_output_count
();
audioOutputArraySize
=
audio_output_count
();
audioDeviceStates
=
xmalloc
(
sizeof
(
audioDeviceStates
[
0
])
*
audioOutputArraySize
);
audioOutputArray
=
xmalloc
(
sizeof
(
struct
audio_output
)
*
audioOutputArraySize
);
audioOutputArray
=
xmalloc
(
sizeof
(
struct
audio_output
)
*
audioOutputArraySize
);
for
(
i
=
0
;
i
<
audioOutputArraySize
;
i
++
)
for
(
i
=
0
;
i
<
audioOutputArraySize
;
i
++
)
...
@@ -98,7 +90,6 @@ void initAudioDriver(void)
...
@@ -98,7 +90,6 @@ void initAudioDriver(void)
"names: %s
\n
"
,
output
->
name
);
"names: %s
\n
"
,
output
->
name
);
}
}
}
}
audioDeviceStates
[
i
]
=
true
;
}
}
}
}
...
@@ -237,7 +228,7 @@ static void syncAudioDeviceStates(void)
...
@@ -237,7 +228,7 @@ static void syncAudioDeviceStates(void)
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
audioOutput
=
&
audioOutputArray
[
i
];
audioOutput
=
&
audioOutputArray
[
i
];
if
(
audio
DeviceStates
[
i
]
)
if
(
audio
Output
->
enabled
)
audio_output_open
(
audioOutput
,
&
input_audio_format
);
audio_output_open
(
audioOutput
,
&
input_audio_format
);
else
if
(
audio_output_is_open
(
audioOutput
))
{
else
if
(
audio_output_is_open
(
audioOutput
))
{
audio_output_cancel
(
audioOutput
);
audio_output_cancel
(
audioOutput
);
...
@@ -275,11 +266,6 @@ bool playAudio(const char *buffer, size_t length)
...
@@ -275,11 +266,6 @@ bool playAudio(const char *buffer, size_t length)
bool
success
=
audio_output_get_result
(
ao
);
bool
success
=
audio_output_get_result
(
ao
);
if
(
success
)
if
(
success
)
ret
=
true
;
ret
=
true
;
else
/* device should already be
closed if the play func
returned an error */
audioDeviceStates
[
i
]
=
true
;
}
else
{
}
else
{
finished
=
false
;
finished
=
false
;
audio_output_signal
(
ao
);
audio_output_signal
(
ao
);
...
@@ -371,7 +357,7 @@ int enableAudioDevice(unsigned int device)
...
@@ -371,7 +357,7 @@ int enableAudioDevice(unsigned int device)
if
(
device
>=
audioOutputArraySize
)
if
(
device
>=
audioOutputArraySize
)
return
-
1
;
return
-
1
;
audio
DeviceStates
[
device
]
=
true
;
audio
OutputArray
[
device
].
enabled
=
true
;
idle_add
(
IDLE_OUTPUT
);
idle_add
(
IDLE_OUTPUT
);
return
0
;
return
0
;
...
@@ -382,7 +368,7 @@ int disableAudioDevice(unsigned int device)
...
@@ -382,7 +368,7 @@ int disableAudioDevice(unsigned int device)
if
(
device
>=
audioOutputArraySize
)
if
(
device
>=
audioOutputArraySize
)
return
-
1
;
return
-
1
;
audio
DeviceStates
[
device
]
=
false
;
audio
OutputArray
[
device
].
enabled
=
false
;
idle_add
(
IDLE_OUTPUT
);
idle_add
(
IDLE_OUTPUT
);
return
0
;
return
0
;
...
@@ -399,7 +385,7 @@ void printAudioDevices(struct client *client)
...
@@ -399,7 +385,7 @@ void printAudioDevices(struct client *client)
"outputenabled: %i
\n
"
,
"outputenabled: %i
\n
"
,
i
,
i
,
audioOutputArray
[
i
].
name
,
audioOutputArray
[
i
].
name
,
audio
DeviceStates
[
i
]
);
audio
OutputArray
[
i
].
enabled
);
}
}
}
}
...
@@ -410,7 +396,7 @@ void saveAudioDevicesState(FILE *fp)
...
@@ -410,7 +396,7 @@ void saveAudioDevicesState(FILE *fp)
assert
(
audioOutputArraySize
!=
0
);
assert
(
audioOutputArraySize
!=
0
);
for
(
i
=
0
;
i
<
audioOutputArraySize
;
i
++
)
{
for
(
i
=
0
;
i
<
audioOutputArraySize
;
i
++
)
{
fprintf
(
fp
,
AUDIO_DEVICE_STATE
"%d:%s
\n
"
,
fprintf
(
fp
,
AUDIO_DEVICE_STATE
"%d:%s
\n
"
,
audio
DeviceStates
[
i
]
,
audio
OutputArray
[
i
].
enabled
,
audioOutputArray
[
i
].
name
);
audioOutputArray
[
i
].
name
);
}
}
}
}
...
@@ -440,7 +426,7 @@ void readAudioDevicesState(FILE *fp)
...
@@ -440,7 +426,7 @@ void readAudioDevicesState(FILE *fp)
if
(
!
strcmp
(
name
,
audioOutputArray
[
i
].
name
))
{
if
(
!
strcmp
(
name
,
audioOutputArray
[
i
].
name
))
{
/* devices default to on */
/* devices default to on */
if
(
!
atoi
(
c
))
if
(
!
atoi
(
c
))
audio
DeviceStates
[
i
]
=
false
;
audio
OutputArray
[
i
].
enabled
=
false
;
break
;
break
;
}
}
}
}
...
...
src/output_init.c
View file @
cf376b4b
...
@@ -85,6 +85,7 @@ int audio_output_init(struct audio_output *ao, ConfigParam * param)
...
@@ -85,6 +85,7 @@ int audio_output_init(struct audio_output *ao, ConfigParam * param)
ao
->
name
=
name
;
ao
->
name
=
name
;
ao
->
plugin
=
plugin
;
ao
->
plugin
=
plugin
;
ao
->
enabled
=
true
;
ao
->
open
=
false
;
ao
->
open
=
false
;
ao
->
convBuffer
=
NULL
;
ao
->
convBuffer
=
NULL
;
...
...
src/output_internal.h
View file @
cf376b4b
...
@@ -41,6 +41,11 @@ struct audio_output {
...
@@ -41,6 +41,11 @@ struct audio_output {
void
*
data
;
void
*
data
;
/**
/**
* Has the user enabled this device?
*/
bool
enabled
;
/**
* Is the device (already) open and functional?
* Is the device (already) open and functional?
*/
*/
bool
open
;
bool
open
;
...
...
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