wavpack: Pass correct sample count to format_samples()
[cmus.git] / ip.h
blob2762683f2ebc61bff4f305e36539fbf1938597a9
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 /* */
46 IP_ERROR_INTERNAL
49 struct input_plugin_data {
50 /* filled by ip-layer */
51 char *filename;
52 int fd;
54 unsigned int remote : 1;
55 unsigned int metadata_changed : 1;
57 /* shoutcast */
58 int counter;
59 int metaint;
60 char *metadata;
62 /* filled by plugin */
63 sample_format_t sf;
64 void *private;
67 struct input_plugin_ops {
68 int (*open)(struct input_plugin_data *ip_data);
69 int (*close)(struct input_plugin_data *ip_data);
70 int (*read)(struct input_plugin_data *ip_data, char *buffer, int count);
71 int (*seek)(struct input_plugin_data *ip_data, double offset);
72 int (*read_comments)(struct input_plugin_data *ip_data,
73 struct keyval **comments);
74 int (*duration)(struct input_plugin_data *ip_data);
77 #endif