diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-13 15:26:53 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-13 15:26:53 +0000 |
commit | d94cba6d0f797a2f34db9bb83296a351678c3ab0 (patch) | |
tree | 33b0942df8cea42a738b3fcf85d464395ffcd511 /apps/playback.h | |
parent | 7dad7d3a6a7b9c2a972d0426488eed503f39cf72 (diff) | |
download | rockbox-d94cba6d0f797a2f34db9bb83296a351678c3ab0.tar.gz rockbox-d94cba6d0f797a2f34db9bb83296a351678c3ab0.zip |
Forward seeking fixed. Some comments added.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6700 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.h')
-rw-r--r-- | apps/playback.h | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/apps/playback.h b/apps/playback.h index 18f92488fa..4cdece75c9 100644 --- a/apps/playback.h +++ b/apps/playback.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #ifndef _AUDIO_H | 20 | #ifndef _AUDIO_H |
21 | #define _AUDIO_H | 21 | #define _AUDIO_H |
22 | 22 | ||
23 | /* Supported file types. */ | ||
23 | #define AFMT_MPA_L1 0x0001 // MPEG Audio layer 1 | 24 | #define AFMT_MPA_L1 0x0001 // MPEG Audio layer 1 |
24 | #define AFMT_MPA_L2 0x0002 // MPEG Audio layer 2 | 25 | #define AFMT_MPA_L2 0x0002 // MPEG Audio layer 2 |
25 | #define AFMT_MPA_L3 0x0004 // MPEG Audio layer 3 | 26 | #define AFMT_MPA_L3 0x0004 // MPEG Audio layer 3 |
@@ -36,6 +37,7 @@ | |||
36 | #define AFMT_UNKNOWN 0x1000 // Unknown file format | 37 | #define AFMT_UNKNOWN 0x1000 // Unknown file format |
37 | #define AFMT_WAVPACK 0x2000 // WavPack | 38 | #define AFMT_WAVPACK 0x2000 // WavPack |
38 | 39 | ||
40 | /* File buffer configuration keys. */ | ||
39 | #define CODEC_SET_FILEBUF_WATERMARK 1 | 41 | #define CODEC_SET_FILEBUF_WATERMARK 1 |
40 | #define CODEC_SET_FILEBUF_CHUNKSIZE 2 | 42 | #define CODEC_SET_FILEBUF_CHUNKSIZE 2 |
41 | #define CODEC_SET_FILEBUF_LIMIT 3 | 43 | #define CODEC_SET_FILEBUF_LIMIT 3 |
@@ -43,32 +45,56 @@ | |||
43 | /* Not yet implemented. */ | 45 | /* Not yet implemented. */ |
44 | #define CODEC_SET_AUDIOBUF_WATERMARK 4 | 46 | #define CODEC_SET_AUDIOBUF_WATERMARK 4 |
45 | 47 | ||
48 | /* Codec Interface */ | ||
46 | struct codec_api { | 49 | struct codec_api { |
47 | off_t filesize; | 50 | off_t filesize; /* Total file length */ |
48 | off_t curpos; | 51 | off_t curpos; /* Current buffer position */ |
49 | size_t bitspersampe; | ||
50 | 52 | ||
51 | /* For gapless mp3 */ | 53 | /* For gapless mp3 */ |
52 | struct mp3entry *id3; | 54 | struct mp3entry *id3; /* TAG metadata pointer */ |
53 | struct mp3info *mp3data; | 55 | struct mp3info *mp3data; /* MP3 metadata pointer */ |
54 | bool *taginfo_ready; | 56 | bool *taginfo_ready; /* Is metadata read */ |
55 | 57 | ||
58 | /* Codec should periodically check if stop_codec is set to true. | ||
59 | In case it's, codec must return with PLUGIN_OK status immediately. */ | ||
56 | bool stop_codec; | 60 | bool stop_codec; |
61 | /* Codec should periodically check if reload_codec is set to true. | ||
62 | In case it's, codec should reload itself without exiting. */ | ||
57 | bool reload_codec; | 63 | bool reload_codec; |
64 | /* If seek_time != 0, codec should seek to that song position (in ms) | ||
65 | if codec supports seeking. */ | ||
58 | int seek_time; | 66 | int seek_time; |
59 | 67 | ||
68 | /* Returns buffer to malloc array. Only codeclib should need this. */ | ||
60 | void* (*get_codec_memory)(size_t *size); | 69 | void* (*get_codec_memory)(size_t *size); |
70 | /* Insert PCM data into audio buffer for playback. Playback will start | ||
71 | automatically. */ | ||
61 | bool (*audiobuffer_insert)(char *data, size_t length); | 72 | bool (*audiobuffer_insert)(char *data, size_t length); |
73 | /* Set song position in WPS (value in ms). */ | ||
62 | void (*set_elapsed)(unsigned int value); | 74 | void (*set_elapsed)(unsigned int value); |
63 | 75 | ||
76 | /* Read next <size> amount bytes from file buffer to <ptr>. | ||
77 | Will return number of bytes read or 0 if end of file. */ | ||
64 | size_t (*read_filebuf)(void *ptr, size_t size); | 78 | size_t (*read_filebuf)(void *ptr, size_t size); |
79 | /* Request pointer to file buffer which can be used to read | ||
80 | <realsize> amount of data. <reqsize> tells the buffer system | ||
81 | how much data it should try to allocate. If <realsize> is 0, | ||
82 | end of file is reached. */ | ||
65 | void* (*request_buffer)(size_t *realsize, size_t reqsize); | 83 | void* (*request_buffer)(size_t *realsize, size_t reqsize); |
84 | /* Advance file buffer position by <amount> amount of bytes. */ | ||
66 | void (*advance_buffer)(size_t amount); | 85 | void (*advance_buffer)(size_t amount); |
86 | /* Advance file buffer to a pointer location inside file buffer. */ | ||
67 | void (*advance_buffer_loc)(void *ptr); | 87 | void (*advance_buffer_loc)(void *ptr); |
88 | /* Seek file buffer to position <newpos> beginning of file. */ | ||
68 | bool (*seek_buffer)(off_t newpos); | 89 | bool (*seek_buffer)(off_t newpos); |
90 | /* Calculate mp3 seek position from given time data in ms. */ | ||
69 | off_t (*mp3_get_filepos)(int newtime); | 91 | off_t (*mp3_get_filepos)(int newtime); |
92 | /* Request file change from file buffer. Returns true is next | ||
93 | track is available and changed. If return value is false, | ||
94 | codec should exit immediately with PLUGIN_OK status. */ | ||
70 | bool (*request_next_track)(void); | 95 | bool (*request_next_track)(void); |
71 | 96 | ||
97 | /* Configure different codec buffer parameters. */ | ||
72 | void (*configure)(int setting, void *value); | 98 | void (*configure)(int setting, void *value); |
73 | }; | 99 | }; |
74 | 100 | ||