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 #define SEEK_IDX_INTERVAL 15
30 /* default callbacks use read, lseek, close */
31 struct nomad_callbacks
{
32 ssize_t (*read
)(void *datasource
, void *buffer
, size_t count
);
33 off_t (*lseek
)(void *datasource
, off_t offset
, int whence
);
34 int (*close
)(void *datasource
);
37 /* always 16-bit signed little-endian */
48 /* -1 if file not seekable */
50 unsigned int joint_stereo
: 1;
51 unsigned int dual_channel
: 1;
57 NOMAD_ERROR_FILE_FORMAT
62 /* -NOMAD_ERROR_ERRNO -NOMAD_ERROR_FILE_FORMAT */
63 int nomad_open(struct nomad
**nomadp
, int fd
, int fast
);
64 int nomad_open_callbacks(struct nomad
**nomadp
, void *datasource
, int fast
,
65 struct nomad_callbacks
*cbs
);
67 void nomad_close(struct nomad
*nomad
);
68 void nomad_info(struct nomad
*nomad
, struct nomad_info
*info
);
70 /* -NOMAD_ERROR_ERRNO */
71 int nomad_read(struct nomad
*nomad
, char *buffer
, int count
);
73 /* -NOMAD_ERROR_ERRNO */
74 int nomad_time_seek(struct nomad
*nomad
, double pos
);
76 double nomad_time_tell(struct nomad
*nomad
);
77 double nomad_time_total(struct nomad
*nomad
);