configure.ac: Move OggVorbis Encoder to Encoder Plugins.
[mpd-mk.git] / src / pipe.h
blob676412bb5dcc45616fb9a7535e3f7b4fe226e5a5
1 /*
2 * Copyright (C) 2003-2010 The Music Player Daemon Project
3 * http://www.musicpd.org
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.
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.
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.
20 #ifndef MPD_PIPE_H
21 #define MPD_PIPE_H
23 #ifndef NDEBUG
24 #include <stdbool.h>
26 struct audio_format;
27 #endif
29 struct music_chunk;
30 struct music_buffer;
32 /**
33 * A queue of #music_chunk objects. One party appends chunks at the
34 * tail, and the other consumes them from the head.
36 struct music_pipe;
38 /**
39 * Creates a new #music_pipe object. It is empty.
41 struct music_pipe *
42 music_pipe_new(void);
44 /**
45 * Frees the object. It must be empty now.
47 void
48 music_pipe_free(struct music_pipe *mp);
50 #ifndef NDEBUG
52 /**
53 * Checks if the audio format if the chunk is equal to the specified
54 * audio_format.
56 bool
57 music_pipe_check_format(const struct music_pipe *pipe,
58 const struct audio_format *audio_format);
60 /**
61 * Checks if the specified chunk is enqueued in the music pipe.
63 bool
64 music_pipe_contains(const struct music_pipe *mp,
65 const struct music_chunk *chunk);
67 #endif
69 /**
70 * Returns the first #music_chunk from the pipe. Returns NULL if the
71 * pipe is empty.
73 const struct music_chunk *
74 music_pipe_peek(const struct music_pipe *mp);
76 /**
77 * Removes the first chunk from the head, and returns it.
79 struct music_chunk *
80 music_pipe_shift(struct music_pipe *mp);
82 /**
83 * Clears the whole pipe and returns the chunks to the buffer.
85 * @param buffer the buffer object to return the chunks to
87 void
88 music_pipe_clear(struct music_pipe *mp, struct music_buffer *buffer);
90 /**
91 * Pushes a chunk to the tail of the pipe.
93 void
94 music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
96 /**
97 * Returns the number of chunks currently in this pipe.
99 unsigned
100 music_pipe_size(const struct music_pipe *mp);
102 #endif