00001 /* 00002 * Copyright (C) 2003-2009 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_INPUT_STREAM_H 00021 #define MPD_INPUT_STREAM_H 00022 00023 #include <stddef.h> 00024 #include <stdbool.h> 00025 #include <sys/types.h> 00026 00027 struct input_stream; 00028 00029 struct input_stream { 00033 const struct input_plugin *plugin; 00034 00038 void *data; 00039 00044 bool ready; 00045 00049 bool seekable; 00050 00054 int error; 00055 00059 off_t size; 00060 00064 off_t offset; 00065 00069 char *mime; 00070 }; 00071 00075 void input_stream_global_init(void); 00076 00080 void input_stream_global_finish(void); 00081 00089 bool 00090 input_stream_open(struct input_stream *is, const char *url); 00091 00097 void 00098 input_stream_close(struct input_stream *is); 00099 00108 bool 00109 input_stream_seek(struct input_stream *is, off_t offset, int whence); 00110 00114 bool input_stream_eof(struct input_stream *is); 00115 00122 struct tag * 00123 input_stream_tag(struct input_stream *is); 00124 00133 int input_stream_buffer(struct input_stream *is); 00134 00144 size_t 00145 input_stream_read(struct input_stream *is, void *ptr, size_t size); 00146 00147 #endif