MPD 0.17~git
src/pipe.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2003-2011 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 <glib.h>
00024 #include <stdbool.h>
00025 
00026 #ifndef NDEBUG
00027 struct audio_format;
00028 #endif
00029 
00030 struct music_chunk;
00031 struct music_buffer;
00032 
00037 struct music_pipe;
00038 
00042 G_GNUC_MALLOC
00043 struct music_pipe *
00044 music_pipe_new(void);
00045 
00049 void
00050 music_pipe_free(struct music_pipe *mp);
00051 
00052 #ifndef NDEBUG
00053 
00058 bool
00059 music_pipe_check_format(const struct music_pipe *pipe,
00060                         const struct audio_format *audio_format);
00061 
00065 bool
00066 music_pipe_contains(const struct music_pipe *mp,
00067                     const struct music_chunk *chunk);
00068 
00069 #endif
00070 
00075 G_GNUC_PURE
00076 const struct music_chunk *
00077 music_pipe_peek(const struct music_pipe *mp);
00078 
00082 struct music_chunk *
00083 music_pipe_shift(struct music_pipe *mp);
00084 
00090 void
00091 music_pipe_clear(struct music_pipe *mp, struct music_buffer *buffer);
00092 
00096 void
00097 music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
00098 
00102 G_GNUC_PURE
00103 unsigned
00104 music_pipe_size(const struct music_pipe *mp);
00105 
00106 G_GNUC_PURE
00107 static inline bool
00108 music_pipe_empty(const struct music_pipe *mp)
00109 {
00110         return music_pipe_size(mp) == 0;
00111 }
00112 
00113 #endif