Commit 39d35219 authored by Max Kellermann's avatar Max Kellermann

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.
parent b13cd03f
...@@ -61,6 +61,12 @@ music_pipe_free(struct music_pipe *mp) ...@@ -61,6 +61,12 @@ music_pipe_free(struct music_pipe *mp)
g_free(mp); g_free(mp);
} }
const struct music_chunk *
music_pipe_peek(const struct music_pipe *mp)
{
return mp->head;
}
struct music_chunk * struct music_chunk *
music_pipe_shift(struct music_pipe *mp) music_pipe_shift(struct music_pipe *mp)
{ {
......
...@@ -41,6 +41,13 @@ void ...@@ -41,6 +41,13 @@ void
music_pipe_free(struct music_pipe *mp); 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. * Removes the first chunk from the head, and returns it.
*/ */
struct music_chunk * struct music_chunk *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment