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
c594afee
Commit
c594afee
authored
Nov 05, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pipe: add helper function music_pipe_empty()
parent
32d10eed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
output_all.c
src/output_all.c
+2
-2
pipe.h
src/pipe.h
+6
-0
player_thread.c
src/player_thread.c
+2
-2
No files found.
src/output_all.c
View file @
c594afee
...
@@ -266,7 +266,7 @@ audio_output_all_open(const struct audio_format *audio_format,
...
@@ -266,7 +266,7 @@ audio_output_all_open(const struct audio_format *audio_format,
else
else
/* if the pipe hasn't been cleared, the the audio
/* if the pipe hasn't been cleared, the the audio
format must not have changed */
format must not have changed */
assert
(
music_pipe_
size
(
g_mp
)
==
0
||
assert
(
music_pipe_
empty
(
g_mp
)
||
audio_format_equals
(
audio_format
,
audio_format_equals
(
audio_format
,
&
input_audio_format
));
&
input_audio_format
));
...
@@ -378,7 +378,7 @@ audio_output_all_check(void)
...
@@ -378,7 +378,7 @@ audio_output_all_check(void)
assert
(
g_mp
!=
NULL
);
assert
(
g_mp
!=
NULL
);
while
((
chunk
=
music_pipe_peek
(
g_mp
))
!=
NULL
)
{
while
((
chunk
=
music_pipe_peek
(
g_mp
))
!=
NULL
)
{
assert
(
music_pipe_size
(
g_mp
)
>
0
);
assert
(
!
music_pipe_empty
(
g_mp
)
);
if
(
!
chunk_is_consumed
(
chunk
))
if
(
!
chunk_is_consumed
(
chunk
))
/* at least one output is not finished playing
/* at least one output is not finished playing
...
...
src/pipe.h
View file @
c594afee
...
@@ -99,4 +99,10 @@ music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
...
@@ -99,4 +99,10 @@ music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
unsigned
unsigned
music_pipe_size
(
const
struct
music_pipe
*
mp
);
music_pipe_size
(
const
struct
music_pipe
*
mp
);
static
inline
bool
music_pipe_empty
(
const
struct
music_pipe
*
mp
)
{
return
music_pipe_size
(
mp
)
==
0
;
}
#endif
#endif
src/player_thread.c
View file @
c594afee
...
@@ -736,7 +736,7 @@ static void do_play(void)
...
@@ -736,7 +736,7 @@ static void do_play(void)
if
(
player
.
paused
)
if
(
player
.
paused
)
notify_wait
(
&
pc
.
notify
);
notify_wait
(
&
pc
.
notify
);
else
if
(
music_pipe_size
(
player
.
pipe
)
>
0
)
{
else
if
(
!
music_pipe_empty
(
player
.
pipe
)
)
{
/* at least one music chunk is ready - send it
/* at least one music chunk is ready - send it
to the audio output */
to the audio output */
...
@@ -757,7 +757,7 @@ static void do_play(void)
...
@@ -757,7 +757,7 @@ static void do_play(void)
/* check the size of the pipe again, because
/* check the size of the pipe again, because
the decoder thread may have added something
the decoder thread may have added something
since we last checked */
since we last checked */
if
(
music_pipe_
size
(
player
.
pipe
)
==
0
)
if
(
music_pipe_
empty
(
player
.
pipe
)
)
break
;
break
;
}
else
{
}
else
{
/* the decoder is too busy and hasn't provided
/* the decoder is too busy and hasn't provided
...
...
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