MPD

src/pipe.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2010 The Music Player Daemon Project
00003  * http://www.musicpd.org
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along
00016  * with this program; if not, write to the Free Software Foundation, Inc.,
00017  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018  */
00019 
00020 #ifndef MPD_PIPE_H
00021 #define MPD_PIPE_H
00022 
00023 #include <stdbool.h>
00024 
00025 #ifndef NDEBUG
00026 struct audio_format;
00027 #endif
00028 
00029 struct music_chunk;
00030 struct music_buffer;
00031 
00036 struct music_pipe;
00037 
00041 struct music_pipe *
00042 music_pipe_new(void);
00043 
00047 void
00048 music_pipe_free(struct music_pipe *mp);
00049 
00050 #ifndef NDEBUG
00051 
00056 bool
00057 music_pipe_check_format(const struct music_pipe *pipe,
00058                         const struct audio_format *audio_format);
00059 
00063 bool
00064 music_pipe_contains(const struct music_pipe *mp,
00065                     const struct music_chunk *chunk);
00066 
00067 #endif
00068 
00073 const struct music_chunk *
00074 music_pipe_peek(const struct music_pipe *mp);
00075 
00079 struct music_chunk *
00080 music_pipe_shift(struct music_pipe *mp);
00081 
00087 void
00088 music_pipe_clear(struct music_pipe *mp, struct music_buffer *buffer);
00089 
00093 void
00094 music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
00095 
00099 unsigned
00100 music_pipe_size(const struct music_pipe *mp);
00101 
00102 static inline bool
00103 music_pipe_empty(const struct music_pipe *mp)
00104 {
00105         return music_pipe_size(mp) == 0;
00106 }
00107 
00108 #endif