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
f8722913
Commit
f8722913
authored
Oct 29, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output: removed audio_output.result
Since open() and play() close the device on error, we can simply check audio_output.open instead of audio_output.result after a call.
parent
7da0e005
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
25 deletions
+10
-25
audio.c
src/audio.c
+2
-4
output_control.c
src/output_control.c
+2
-6
output_internal.h
src/output_internal.h
+0
-11
output_thread.c
src/output_thread.c
+6
-4
No files found.
src/audio.c
View file @
f8722913
...
...
@@ -247,11 +247,9 @@ bool playAudio(const char *buffer, size_t length)
if
(
!
audio_output_is_open
(
ao
))
continue
;
if
(
audio_output_command_is_finished
(
ao
))
{
bool
success
=
audio_output_get_result
(
ao
);
if
(
success
)
if
(
audio_output_command_is_finished
(
ao
))
ret
=
true
;
}
else
{
else
{
finished
=
false
;
audio_output_signal
(
ao
);
}
...
...
src/output_control.c
View file @
f8722913
...
...
@@ -55,8 +55,6 @@ bool
audio_output_open
(
struct
audio_output
*
audioOutput
,
const
struct
audio_format
*
audioFormat
)
{
bool
ret
=
true
;
audioOutput
->
reopen_after
=
0
;
if
(
audioOutput
->
open
&&
...
...
@@ -83,12 +81,10 @@ audio_output_open(struct audio_output *audioOutput,
if
(
audioOutput
->
thread
==
0
)
audio_output_thread_start
(
audioOutput
);
if
(
!
audioOutput
->
open
)
{
if
(
!
audioOutput
->
open
)
ao_command
(
audioOutput
,
AO_COMMAND_OPEN
);
ret
=
audioOutput
->
result
;
}
return
ret
;
return
audioOutput
->
open
;
}
void
...
...
src/output_internal.h
View file @
f8722913
...
...
@@ -109,11 +109,6 @@ struct audio_output {
const
struct
tag
*
tag
;
}
args
;
/**
* Result value of the command. true means success.
*/
bool
result
;
};
/**
...
...
@@ -134,10 +129,4 @@ audio_output_command_is_finished(const struct audio_output *ao)
return
ao
->
command
==
AO_COMMAND_NONE
;
}
static
inline
bool
audio_output_get_result
(
const
struct
audio_output
*
ao
)
{
return
ao
->
result
;
}
#endif
src/output_thread.c
View file @
f8722913
...
...
@@ -63,12 +63,13 @@ static void ao_play(struct audio_output *ao)
{
const
char
*
data
=
ao
->
args
.
play
.
data
;
size_t
size
=
ao
->
args
.
play
.
size
;
bool
ret
;
if
(
!
audio_format_equals
(
&
ao
->
inAudioFormat
,
&
ao
->
outAudioFormat
))
convertAudioFormat
(
ao
,
&
data
,
&
size
);
ao
->
resul
t
=
ao
->
plugin
->
play
(
ao
->
data
,
data
,
size
);
if
(
!
ao
->
resul
t
)
{
re
t
=
ao
->
plugin
->
play
(
ao
->
data
,
data
,
size
);
if
(
!
re
t
)
{
ao
->
plugin
->
cancel
(
ao
->
data
);
ao
->
plugin
->
close
(
ao
->
data
);
ao
->
open
=
false
;
...
...
@@ -96,6 +97,7 @@ static void ao_pause(struct audio_output *ao)
static
void
*
audio_output_task
(
void
*
arg
)
{
struct
audio_output
*
ao
=
arg
;
bool
ret
;
while
(
1
)
{
switch
(
ao
->
command
)
{
...
...
@@ -104,11 +106,11 @@ static void *audio_output_task(void *arg)
case
AO_COMMAND_OPEN
:
assert
(
!
ao
->
open
);
ao
->
resul
t
=
ao
->
plugin
->
open
(
ao
->
data
,
re
t
=
ao
->
plugin
->
open
(
ao
->
data
,
&
ao
->
outAudioFormat
);
assert
(
!
ao
->
open
);
if
(
ao
->
resul
t
==
true
)
if
(
re
t
==
true
)
ao
->
open
=
true
;
else
ao
->
reopen_after
=
time
(
NULL
)
+
REOPEN_AFTER
;
...
...
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