1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 Nicolas Pennequin
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
23 #include <sys/types.h>
27 /* default point to start buffer refill */
28 #define AUDIO_DEFAULT_WATERMARK (1024*512)
29 /* amount of data to read in one read() call */
30 #define AUDIO_DEFAULT_FILECHUNK (1024*32)
31 /* point at which the file buffer will fight for CPU time */
32 #define AUDIO_FILEBUF_CRITICAL (1024*128)
33 /* amount of guess-space to allow for codecs that must hunt and peck
34 * for their correct seeek target, 32k seems a good size */
35 #define AUDIO_REBUFFER_GUESS_SIZE (1024*32)
54 struct event_queue buffering_queue
;
55 struct queue_sender_list buffering_queue_sender_list
;
57 bool buffering_init(char *filebuf
, size_t filebuflen
);
59 int bufopen(char *file
, size_t offset
, enum data_type type
);
60 int bufalloc(void *src
, size_t size
, enum data_type type
);
61 int bufclose(int handle_id
);
62 int bufseek(int handle_id
, size_t newpos
);
63 int bufadvance(int handle_id
, off_t offset
);
64 ssize_t
bufread(int handle_id
, size_t size
, char *dest
);
65 ssize_t
bufgetdata(int handle_id
, size_t size
, unsigned char **data
);
66 ssize_t
get_offset(int handle_id
, void *ptr
);