-
Notifications
You must be signed in to change notification settings - Fork 0
/
ip.h
109 lines (98 loc) · 3.01 KB
/
ip.h
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
100
101
102
103
104
105
106
107
108
109
/*
* Copyright 2008-2013 Various Authors
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef CMUS_IP_H
#define CMUS_IP_H
#include "keyval.h"
#include "sf.h"
#include "channelmap.h"
#ifndef __GNUC__
#include <fcntl.h>
#include <unistd.h>
#endif
enum {
/* no error */
IP_ERROR_SUCCESS,
/* system error (error code in errno) */
IP_ERROR_ERRNO,
/* file type not recognized */
IP_ERROR_UNRECOGNIZED_FILE_TYPE,
/* file type recognized, but not supported */
IP_ERROR_UNSUPPORTED_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,
/* wrong disc inserted */
IP_ERROR_WRONG_DISC,
/* could not read disc */
IP_ERROR_NO_DISC,
/* error parsing response line / headers */
IP_ERROR_HTTP_RESPONSE,
/* usually 404 */
IP_ERROR_HTTP_STATUS,
/* too many redirections */
IP_ERROR_HTTP_REDIRECT_LIMIT,
/* plugin does not have this option */
IP_ERROR_NOT_OPTION,
/* */
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;
char *icy_name;
char *icy_genre;
char *icy_url;
/* filled by plugin */
sample_format_t sf;
channel_position_t channel_map[CHANNELS_MAX];
void *private;
};
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);
long (*bitrate)(struct input_plugin_data *ip_data);
long (*bitrate_current)(struct input_plugin_data *ip_data);
char *(*codec)(struct input_plugin_data *ip_data);
char *(*codec_profile)(struct input_plugin_data *ip_data);
int (*set_option)(int key, const char *val);
int (*get_option)(int key, char **val);
};
/* symbols exported by plugin */
extern const struct input_plugin_ops ip_ops;
extern const int ip_priority;
extern const char * const ip_extensions[];
extern const char * const ip_mime_types[];
extern const char * const ip_options[];
#endif