]>
Commit | Line | Data |
---|---|---|
48e2f01c | 1 | /* |
2 | * Copyright (C) 2013 nu774 | |
3 | * For conditions of distribution and use, see copyright notice in COPYING | |
4 | */ | |
5 | #ifndef WAV_READER_H | |
6 | #define WAV_READER_H | |
7 | ||
8 | #include "lpcm.h" | |
9 | ||
10 | enum wav_error_code { | |
11 | WAV_IO_ERROR = 1, | |
12 | WAV_NO_MEMORY, | |
13 | WAV_INVALID_FORMAT, | |
14 | WAV_UNSUPPORTED_FORMAT | |
15 | }; | |
16 | ||
17 | typedef int (*wav_read_callback)(void *cookie, void *data, uint32_t size); | |
18 | typedef int (*wav_seek_callback)(void *cookie, int64_t off, int whence); | |
68543176 | 19 | typedef int64_t (*wav_tell_callback)(void *cookie); |
48e2f01c | 20 | |
21 | typedef struct wav_io_context_t { | |
22 | wav_read_callback read; | |
23 | wav_seek_callback seek; | |
68543176 | 24 | wav_tell_callback tell; |
48e2f01c | 25 | } wav_io_context_t; |
26 | ||
27 | typedef struct wav_reader_t wav_reader_t; | |
28 | ||
29 | wav_reader_t *wav_open(wav_io_context_t *io_ctx, void *io_cookie, | |
30 | int ignore_length); | |
68543176 | 31 | wav_reader_t *raw_open(wav_io_context_t *io_ctx, void *io_cookie, |
32 | const pcm_sample_description_t *desc); | |
48e2f01c | 33 | const pcm_sample_description_t *wav_get_format(wav_reader_t *reader); |
34 | int wav_read_frames(wav_reader_t *reader, void *buffer, unsigned nframes); | |
35 | int64_t wav_get_length(wav_reader_t *reader); | |
36 | int64_t wav_get_position(wav_reader_t *reader); | |
37 | void wav_teardown(wav_reader_t **reader); | |
38 | ||
39 | #endif |