2 * Copyright 2004 Timo Hirvonen
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
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 */
46 /* -1 if file not seekable */
48 unsigned int joint_stereo
: 1;
49 unsigned int dual_channel
: 1;
55 NOMAD_ERROR_FILE_FORMAT
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
);