Handle streams separately in tree_add_track()
[cmus.git] / ip.h
blobabfb462632e73c1b4ca7ba19975a6773b5e0dc18
1 /*
2 * Copyright 2004-2005 Timo Hirvonen
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 * 02111-1307, USA.
20 #ifndef _IP_H
21 #define _IP_H
23 #include "comment.h"
24 #include "sf.h"
26 enum {
27 /* no error */
28 IP_ERROR_SUCCESS,
29 /* system error (error code in errno) */
30 IP_ERROR_ERRNO,
31 /* file type not supported */
32 IP_ERROR_UNRECOGNIZED_FILE_TYPE,
33 /* function not supported (usually seek) */
34 IP_ERROR_FUNCTION_NOT_SUPPORTED,
35 /* input plugin detected corrupted file */
36 IP_ERROR_FILE_FORMAT,
37 /* malformed uri */
38 IP_ERROR_INVALID_URI,
39 /* sample format not supported */
40 IP_ERROR_SAMPLE_FORMAT,
41 /* error parsing response line / headers */
42 IP_ERROR_HTTP_RESPONSE,
43 /* usually 404 */
44 IP_ERROR_HTTP_STATUS,
45 /* too many redirections */
46 IP_ERROR_HTTP_REDIRECT_LIMIT,
47 /* */
48 IP_ERROR_INTERNAL
51 struct input_plugin_data {
52 /* filled by ip-layer */
53 char *filename;
54 int fd;
56 unsigned int remote : 1;
57 unsigned int metadata_changed : 1;
59 /* shoutcast */
60 int counter;
61 int metaint;
62 char *metadata;
64 /* filled by plugin */
65 sample_format_t sf;
66 void *private;
69 struct input_plugin_ops {
70 int (*open)(struct input_plugin_data *ip_data);
71 int (*close)(struct input_plugin_data *ip_data);
72 int (*read)(struct input_plugin_data *ip_data, char *buffer, int count);
73 int (*seek)(struct input_plugin_data *ip_data, double offset);
74 int (*read_comments)(struct input_plugin_data *ip_data,
75 struct keyval **comments);
76 int (*duration)(struct input_plugin_data *ip_data);
79 /* symbols exported by plugin */
80 extern const struct input_plugin_ops ip_ops;
81 extern const char * const ip_extensions[];
82 extern const char * const ip_mime_types[];
84 #endif