diff options
author | Max Kellermann <max@duempel.org> | 2009-03-09 19:15:54 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-09 19:15:54 +0100 |
commit | e1bd2c65d5ad75a79e7a2bac9f4b6b778951c786 (patch) | |
tree | dd615ddf17794c02d34830a929cdc23b6c89876f /src/pipe.c | |
parent | 9f79c05e431806c5023f6d1537c90b4decf413a1 (diff) | |
download | mpd-e1bd2c65d5ad75a79e7a2bac9f4b6b778951c786.tar.gz mpd-e1bd2c65d5ad75a79e7a2bac9f4b6b778951c786.tar.xz mpd-e1bd2c65d5ad75a79e7a2bac9f4b6b778951c786.zip |
music_pipe: added music_pipe_contains()
Diffstat (limited to 'src/pipe.c')
-rw-r--r-- | src/pipe.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pipe.c b/src/pipe.c index fe011f3c2..d0eaf9871 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -70,6 +70,7 @@ music_pipe_free(struct music_pipe *mp) } #ifndef NDEBUG + bool music_pipe_check_format(const struct music_pipe *pipe, const struct audio_format *audio_format) @@ -80,6 +81,26 @@ music_pipe_check_format(const struct music_pipe *pipe, return !audio_format_defined(&pipe->audio_format) || audio_format_equals(&pipe->audio_format, audio_format); } + +bool +music_pipe_contains(const struct music_pipe *mp, + const struct music_chunk *chunk) +{ + g_mutex_lock(mp->mutex); + + for (const struct music_chunk *i = mp->head; + i != NULL; i = i->next) { + if (i == chunk) { + g_mutex_unlock(mp->mutex); + return true; + } + } + + g_mutex_unlock(mp->mutex); + + return false; +} + #endif const struct music_chunk * |