summaryrefslogtreecommitdiff
path: root/apps/buffering.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/buffering.h')
-rw-r--r--apps/buffering.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/apps/buffering.h b/apps/buffering.h
index 34d6d641c7..2e4cfd3968 100644
--- a/apps/buffering.h
+++ b/apps/buffering.h
@@ -28,14 +28,13 @@
28 28
29 29
30enum data_type { 30enum data_type {
31 TYPE_UNKNOWN = 0, /* invalid type indicator */
32 TYPE_ID3,
31 TYPE_CODEC, 33 TYPE_CODEC,
32 TYPE_PACKET_AUDIO, 34 TYPE_PACKET_AUDIO,
33 TYPE_ATOMIC_AUDIO, 35 TYPE_ATOMIC_AUDIO,
34 TYPE_ID3,
35 TYPE_CUESHEET, 36 TYPE_CUESHEET,
36 TYPE_BITMAP, 37 TYPE_BITMAP,
37 TYPE_BUFFER,
38 TYPE_UNKNOWN,
39}; 38};
40 39
41/* Error return values */ 40/* Error return values */
@@ -63,6 +62,7 @@ bool buffering_reset(char *buf, size_t buflen);
63 * bufclose : Close an open handle 62 * bufclose : Close an open handle
64 * bufseek : Set handle reading index, relatively to the start of the file 63 * bufseek : Set handle reading index, relatively to the start of the file
65 * bufadvance: Move handle reading index, relatively to current position 64 * bufadvance: Move handle reading index, relatively to current position
65 * bufftell : Return the handle's file read position
66 * bufread : Copy data from a handle to a buffer 66 * bufread : Copy data from a handle to a buffer
67 * bufgetdata: Obtain a pointer for linear access to a "size" amount of data 67 * bufgetdata: Obtain a pointer for linear access to a "size" amount of data
68 * bufgettail: Out-of-band get the last size bytes of a handle. 68 * bufgettail: Out-of-band get the last size bytes of a handle.
@@ -81,28 +81,40 @@ int bufalloc(const void *src, size_t size, enum data_type type);
81bool bufclose(int handle_id); 81bool bufclose(int handle_id);
82int bufseek(int handle_id, size_t newpos); 82int bufseek(int handle_id, size_t newpos);
83int bufadvance(int handle_id, off_t offset); 83int bufadvance(int handle_id, off_t offset);
84off_t bufftell(int handle_id);
84ssize_t bufread(int handle_id, size_t size, void *dest); 85ssize_t bufread(int handle_id, size_t size, void *dest);
85ssize_t bufgetdata(int handle_id, size_t size, void **data); 86ssize_t bufgetdata(int handle_id, size_t size, void **data);
86ssize_t bufgettail(int handle_id, size_t size, void **data); 87ssize_t bufgettail(int handle_id, size_t size, void **data);
87ssize_t bufcuttail(int handle_id, size_t size); 88ssize_t bufcuttail(int handle_id, size_t size);
88 89
89
90/*************************************************************************** 90/***************************************************************************
91 * SECONDARY FUNCTIONS 91 * SECONDARY FUNCTIONS
92 * =================== 92 * ===================
93 * 93 *
94 * buf_handle_data_type: return the handle's data type
95 * buf_is_handle: is the handle valid?
96 * buf_pin_handle: Disallow/allow handle movement. Handle may still be removed.
94 * buf_handle_offset: Get the offset of the first buffered byte from the file 97 * buf_handle_offset: Get the offset of the first buffered byte from the file
95 * buf_request_buffer_handle: Request buffering of a handle 98 * buf_request_buffer_handle: Request buffering of a handle
96 * buf_set_base_handle: Tell the buffering thread which handle is currently read 99 * buf_set_base_handle: Tell the buffering thread which handle is currently read
100 * buf_length: Total size of ringbuffer
97 * buf_used: Total amount of buffer space used (including allocated space) 101 * buf_used: Total amount of buffer space used (including allocated space)
102 * buf_back_off_storage: tell buffering thread to take it easy
98 ****************************************************************************/ 103 ****************************************************************************/
99 104
105enum data_type buf_handle_data_type(int handle_id);
106ssize_t buf_handle_remaining(int handle_id);
107bool buf_is_handle(int handle_id);
100ssize_t buf_handle_offset(int handle_id); 108ssize_t buf_handle_offset(int handle_id);
101void buf_request_buffer_handle(int handle_id); 109void buf_request_buffer_handle(int handle_id);
102void buf_set_base_handle(int handle_id); 110void buf_set_base_handle(int handle_id);
111size_t buf_length(void);
103size_t buf_used(void); 112size_t buf_used(void);
104 113bool buf_pin_handle(int handle_id, bool pin);
105 114bool buf_signal_handle(int handle_id, bool signal);
115#ifdef HAVE_IO_PRIORITY
116void buf_back_off_storage(bool back_off);
117#endif
106 118
107/* Settings */ 119/* Settings */
108enum { 120enum {
@@ -110,6 +122,7 @@ enum {
110 BUFFERING_SET_CHUNKSIZE, 122 BUFFERING_SET_CHUNKSIZE,
111}; 123};
112void buf_set_watermark(size_t bytes); 124void buf_set_watermark(size_t bytes);
125size_t buf_get_watermark(void);
113 126
114/* Debugging */ 127/* Debugging */
115struct buffering_debug { 128struct buffering_debug {