fixes build system in german (utf-8) locale
[cmus.git] / nomad.h
blob3f8e06d23e57bfff236ef3d5c915e518f7fba958
1 /*
2 * Copyright 2004 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 _NOMAD_H
21 #define _NOMAD_H
23 #include <mad.h>
24 #include <sys/types.h>
26 #define INPUT_BUFFER_SIZE (5 * 8192)
28 /* default callbacks use read, lseek, close */
29 struct nomad_callbacks {
30 ssize_t (*read)(void *datasource, void *buffer, size_t count);
31 off_t (*lseek)(void *datasource, off_t offset, int whence);
32 int (*close)(void *datasource);
35 /* always 16-bit signed little-endian */
36 struct nomad_info {
37 double duration;
38 int sample_rate;
39 int channels;
40 int nr_frames;
41 int layer;
42 /* -1 if fast = 1 */
43 int vbr;
44 /* -1 if fast = 1 */
45 int avg_bitrate;
46 /* -1 if file not seekable */
47 int filesize;
48 unsigned int joint_stereo : 1;
49 unsigned int dual_channel : 1;
52 enum {
53 NOMAD_ERROR_SUCCESS,
54 NOMAD_ERROR_ERRNO,
55 NOMAD_ERROR_FILE_FORMAT
58 struct nomad;
60 /* -NOMAD_ERROR_ERRNO -NOMAD_ERROR_FILE_FORMAT */
61 int nomad_open(struct nomad **nomadp, int fd, int fast);
62 int nomad_open_callbacks(struct nomad **nomadp, void *datasource, int fast,
63 struct nomad_callbacks *cbs);
65 void nomad_close(struct nomad *nomad);
66 void nomad_info(struct nomad *nomad, struct nomad_info *info);
68 /* -NOMAD_ERROR_ERRNO */
69 int nomad_read(struct nomad *nomad, char *buffer, int count);
71 /* -NOMAD_ERROR_ERRNO */
72 int nomad_time_seek(struct nomad *nomad, double pos);
74 double nomad_time_tell(struct nomad *nomad);
75 double nomad_time_total(struct nomad *nomad);
77 #endif