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.
This commit is contained in:
Max Kellermann 2009-03-07 19:56:31 +01:00
parent b13cd03f75
commit 39d3521956
2 changed files with 13 additions and 0 deletions

View File

@ -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)
{

View File

@ -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.
*/