MPD
pipe.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2003-2010 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef MPD_PIPE_H
21 #define MPD_PIPE_H
22 
23 #include <glib.h>
24 #include <stdbool.h>
25 
26 #ifndef NDEBUG
27 struct audio_format;
28 #endif
29 
30 struct music_chunk;
31 struct music_buffer;
32 
37 struct music_pipe;
38 
42 G_GNUC_MALLOC
43 struct music_pipe *
44 music_pipe_new(void);
45 
49 void
50 music_pipe_free(struct music_pipe *mp);
51 
52 #ifndef NDEBUG
53 
58 bool
59 music_pipe_check_format(const struct music_pipe *pipe,
60  const struct audio_format *audio_format);
61 
65 bool
66 music_pipe_contains(const struct music_pipe *mp,
67  const struct music_chunk *chunk);
68 
69 #endif
70 
75 G_GNUC_PURE
76 const struct music_chunk *
77 music_pipe_peek(const struct music_pipe *mp);
78 
82 struct music_chunk *
83 music_pipe_shift(struct music_pipe *mp);
84 
90 void
91 music_pipe_clear(struct music_pipe *mp, struct music_buffer *buffer);
92 
96 void
97 music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
98 
102 G_GNUC_PURE
103 unsigned
104 music_pipe_size(const struct music_pipe *mp);
105 
106 G_GNUC_PURE
107 static inline bool
108 music_pipe_empty(const struct music_pipe *mp)
109 {
110  return music_pipe_size(mp) == 0;
111 }
112 
113 #endif