1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/*
* Copyright 2004-2005 Timo Hirvonen
*
* 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.
*/
#ifndef _IP_H
#define _IP_H
#include "comment.h"
#include "sf.h"
enum {
/* no error */
IP_ERROR_SUCCESS,
/* system error (error code in errno) */
IP_ERROR_ERRNO,
/* file type not supported */
IP_ERROR_UNRECOGNIZED_FILE_TYPE,
/* function not supported (usually seek) */
IP_ERROR_FUNCTION_NOT_SUPPORTED,
/* input plugin detected corrupted file */
IP_ERROR_FILE_FORMAT,
/* malformed uri */
IP_ERROR_INVALID_URI,
/* sample format not supported */
IP_ERROR_SAMPLE_FORMAT,
/* error parsing response line / headers */
IP_ERROR_HTTP_RESPONSE,
/* usually 404 */
IP_ERROR_HTTP_STATUS,
/* */
IP_ERROR_INTERNAL
};
/*
struct input_plugin_data {
// filled by ip-layer
char *filename;
int fd;
unsigned int remote : 1;
unsigned int metadata_changed : 1;
// shoutcast
int counter;
int metaint;
char *metadata;
// filled by plugin
sample_format_t sf;
void * private_ipd;
};
*/
struct input_plugin_data {
// filled by ip-layer
// QString filename;
char *filename;
int fd;
unsigned int remote : 1;
unsigned int metadata_changed : 1;
// shoutcast
int counter;
int metaint;
char *metadata;
// filled by plugin
sample_format_t sf;
void * private_ipd;
};
struct input_plugin_ops {
int (*open)(struct input_plugin_data *ip_data);
int (*close)(struct input_plugin_data *ip_data);
int (*read)(struct input_plugin_data *ip_data, char *buffer, int count);
int (*seek)(struct input_plugin_data *ip_data, double offset);
int (*read_comments)(struct input_plugin_data *ip_data,
struct keyval **comments);
int (*duration)(struct input_plugin_data *ip_data);
};
#endif
|