From 39d352195608f0f5ffa9f3762dbdebf4e44bccdc Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 7 Mar 2009 19:56:31 +0100 Subject: music_pipe: added music_pipe_peek() music_pipe_peek() is similar to music_pipe_shift(), but doesn't remove the chunk. This allows it to be used with a "const" music_pipe. --- src/pipe.c | 6 ++++++ src/pipe.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/pipe.c b/src/pipe.c index d02a00a04..320c5c3a3 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -61,6 +61,12 @@ music_pipe_free(struct music_pipe *mp) g_free(mp); } +const struct music_chunk * +music_pipe_peek(const struct music_pipe *mp) +{ + return mp->head; +} + struct music_chunk * music_pipe_shift(struct music_pipe *mp) { diff --git a/src/pipe.h b/src/pipe.h index f1a231542..7ed6c917d 100644 --- a/src/pipe.h +++ b/src/pipe.h @@ -40,6 +40,13 @@ music_pipe_new(void); void music_pipe_free(struct music_pipe *mp); +/** + * Returns the first #music_chunk from the pipe. Returns NULL if the + * pipe is empty. + */ +const struct music_chunk * +music_pipe_peek(const struct music_pipe *mp); + /** * Removes the first chunk from the head, and returns it. */ -- cgit v1.2.3