2004-05-07 17:58:04 +02:00
|
|
|
/* the Music Player Daemon (MPD)
|
2007-04-05 05:22:33 +02:00
|
|
|
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
|
2004-05-07 17:58:04 +02:00
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
2008-11-02 14:12:52 +01:00
|
|
|
#ifndef MPD_PIPE_H
|
|
|
|
#define MPD_PIPE_H
|
2004-05-07 17:58:04 +02:00
|
|
|
|
2009-03-03 22:23:25 +01:00
|
|
|
struct music_chunk;
|
2009-03-06 00:42:03 +01:00
|
|
|
struct music_buffer;
|
2008-04-12 06:13:24 +02:00
|
|
|
|
2008-04-12 06:08:35 +02:00
|
|
|
/**
|
2009-03-06 00:42:03 +01:00
|
|
|
* A queue of #music_chunk objects. One party appends chunks at the
|
|
|
|
* tail, and the other consumes them from the head.
|
2008-04-15 07:57:22 +02:00
|
|
|
*/
|
2009-03-06 00:42:03 +01:00
|
|
|
struct music_pipe;
|
2008-04-12 06:13:51 +02:00
|
|
|
|
2008-04-12 06:12:53 +02:00
|
|
|
/**
|
2009-03-06 00:42:03 +01:00
|
|
|
* Creates a new #music_pipe object. It is empty.
|
2008-04-12 06:12:53 +02:00
|
|
|
*/
|
2009-03-06 00:42:03 +01:00
|
|
|
struct music_pipe *
|
|
|
|
music_pipe_new(void);
|
2008-04-12 06:11:41 +02:00
|
|
|
|
2008-04-12 06:12:42 +02:00
|
|
|
/**
|
2009-03-06 00:42:03 +01:00
|
|
|
* Frees the object. It must be empty now.
|
2008-04-12 06:12:42 +02:00
|
|
|
*/
|
2009-03-06 00:42:03 +01:00
|
|
|
void
|
|
|
|
music_pipe_free(struct music_pipe *mp);
|
2008-11-02 16:55:53 +01:00
|
|
|
|
2009-03-06 00:42:01 +01:00
|
|
|
/**
|
2009-03-06 00:42:03 +01:00
|
|
|
* Removes the first chunk from the head, and returns it.
|
2009-03-06 00:42:01 +01:00
|
|
|
*/
|
|
|
|
struct music_chunk *
|
2009-03-06 00:42:03 +01:00
|
|
|
music_pipe_shift(struct music_pipe *mp);
|
2009-03-06 00:42:01 +01:00
|
|
|
|
|
|
|
/**
|
2009-03-06 00:42:03 +01:00
|
|
|
* Clears the whole pipe and returns the chunks to the buffer.
|
2009-03-06 00:42:01 +01:00
|
|
|
*
|
2009-03-06 00:42:03 +01:00
|
|
|
* @param buffer the buffer object to return the chunks to
|
2009-03-06 00:42:01 +01:00
|
|
|
*/
|
|
|
|
void
|
2009-03-06 00:42:03 +01:00
|
|
|
music_pipe_clear(struct music_pipe *mp, struct music_buffer *buffer);
|
2009-03-06 00:42:01 +01:00
|
|
|
|
2009-01-17 13:09:29 +01:00
|
|
|
/**
|
2009-03-06 00:42:03 +01:00
|
|
|
* Pushes a chunk to the tail of the pipe.
|
2009-01-17 13:09:29 +01:00
|
|
|
*/
|
|
|
|
void
|
2009-03-06 00:42:03 +01:00
|
|
|
music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
|
2008-04-12 06:18:19 +02:00
|
|
|
|
2008-11-13 02:09:33 +01:00
|
|
|
/**
|
2009-03-06 00:42:03 +01:00
|
|
|
* Returns the number of chunks currently in this pipe.
|
2008-11-13 02:09:33 +01:00
|
|
|
*/
|
2009-03-06 00:42:03 +01:00
|
|
|
unsigned
|
|
|
|
music_pipe_size(const struct music_pipe *mp);
|
2008-11-13 02:06:58 +01:00
|
|
|
|
2004-05-07 17:58:04 +02:00
|
|
|
#endif
|