summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bavin <pondlife@pondlife.me>2008-03-28 12:51:33 +0000
committerSteve Bavin <pondlife@pondlife.me>2008-03-28 12:51:33 +0000
commit135cc757bda4714aca2831f7d75b7a4c1c4f7763 (patch)
tree2925838c63fdff85082f7717b78e273523a4f838
parent3d0b7c69016dc0dc1a4a81131340ac3024ecd356 (diff)
downloadrockbox-135cc757bda4714aca2831f7d75b7a4c1c4f7763.tar.gz
rockbox-135cc757bda4714aca2831f7d75b7a4c1c4f7763.zip
Revert my earlier const madness, we'll keep the parameter lists simple.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16863 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/buffering.c60
-rw-r--r--apps/buffering.h34
-rw-r--r--apps/codecs.h20
-rw-r--r--apps/pcmbuf.c6
-rw-r--r--apps/pcmbuf.h2
-rw-r--r--apps/playback.c101
-rw-r--r--apps/playback.h6
-rw-r--r--apps/plugin.h46
-rw-r--r--apps/plugins/test_codec.c16
-rw-r--r--apps/settings.c46
-rw-r--r--apps/settings.h28
-rw-r--r--firmware/export/audio.h10
-rw-r--r--firmware/export/id3.h2
-rw-r--r--firmware/id3.c2
-rw-r--r--firmware/mpeg.c8
-rw-r--r--uisimulator/common/stubs.c2
16 files changed, 193 insertions, 196 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index d891382d81..938cc95620 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -190,7 +190,7 @@ static struct event_queue buffering_queue;
190static struct queue_sender_list buffering_queue_sender_list; 190static struct queue_sender_list buffering_queue_sender_list;
191 191
192 192
193static void call_buffering_callbacks(const enum callback_event ev, const int value); 193static void call_buffering_callbacks(enum callback_event ev, int value);
194 194
195 195
196/* 196/*
@@ -225,8 +225,8 @@ buf_ridx == buf_widx means the buffer is empty.
225 only potential side effect is to allocate space for the cur_handle 225 only potential side effect is to allocate space for the cur_handle
226 if it returns NULL. 226 if it returns NULL.
227 */ 227 */
228static struct memory_handle *add_handle(const size_t data_size, const bool can_wrap, 228static struct memory_handle *add_handle(size_t data_size, bool can_wrap,
229 const bool alloc_all) 229 bool alloc_all)
230{ 230{
231 /* gives each handle a unique id */ 231 /* gives each handle a unique id */
232 static int cur_handle_id = 0; 232 static int cur_handle_id = 0;
@@ -363,7 +363,7 @@ static bool rm_handle(const struct memory_handle *h)
363 363
364/* Return a pointer to the memory handle of given ID. 364/* Return a pointer to the memory handle of given ID.
365 NULL if the handle wasn't found */ 365 NULL if the handle wasn't found */
366static struct memory_handle *find_handle(const int handle_id) 366static struct memory_handle *find_handle(int handle_id)
367{ 367{
368 if (handle_id < 0) 368 if (handle_id < 0)
369 return NULL; 369 return NULL;
@@ -407,7 +407,7 @@ static struct memory_handle *find_handle(const int handle_id)
407 found in the linked list for adjustment. This function has no side 407 found in the linked list for adjustment. This function has no side
408 effects if NULL is returned. */ 408 effects if NULL is returned. */
409static bool move_handle(struct memory_handle **h, size_t *delta, 409static bool move_handle(struct memory_handle **h, size_t *delta,
410 const size_t data_size, const bool can_wrap) 410 size_t data_size, bool can_wrap)
411{ 411{
412 struct memory_handle *dest; 412 struct memory_handle *dest;
413 const struct memory_handle *src; 413 const struct memory_handle *src;
@@ -559,7 +559,7 @@ static inline bool buffer_is_low(void)
559 559
560/* Buffer data for the given handle. 560/* Buffer data for the given handle.
561 Return whether or not the buffering should continue explicitly. */ 561 Return whether or not the buffering should continue explicitly. */
562static bool buffer_handle(const int handle_id) 562static bool buffer_handle(int handle_id)
563{ 563{
564 logf("buffer_handle(%d)", handle_id); 564 logf("buffer_handle(%d)", handle_id);
565 struct memory_handle *h = find_handle(handle_id); 565 struct memory_handle *h = find_handle(handle_id);
@@ -667,7 +667,7 @@ static bool buffer_handle(const int handle_id)
667 667
668/* Reset writing position and data buffer of a handle to its current offset. 668/* Reset writing position and data buffer of a handle to its current offset.
669 Use this after having set the new offset to use. */ 669 Use this after having set the new offset to use. */
670static void reset_handle(const int handle_id) 670static void reset_handle(int handle_id)
671{ 671{
672 logf("reset_handle(%d)", handle_id); 672 logf("reset_handle(%d)", handle_id);
673 673
@@ -687,7 +687,7 @@ static void reset_handle(const int handle_id)
687} 687}
688 688
689/* Seek to a nonbuffered part of a handle by rebuffering the data. */ 689/* Seek to a nonbuffered part of a handle by rebuffering the data. */
690static void rebuffer_handle(const int handle_id, const size_t newpos) 690static void rebuffer_handle(int handle_id, size_t newpos)
691{ 691{
692 struct memory_handle *h = find_handle(handle_id); 692 struct memory_handle *h = find_handle(handle_id);
693 if (!h) 693 if (!h)
@@ -725,7 +725,7 @@ static void rebuffer_handle(const int handle_id, const size_t newpos)
725 h->ridx = h->data; 725 h->ridx = h->data;
726} 726}
727 727
728static bool close_handle(const int handle_id) 728static bool close_handle(int handle_id)
729{ 729{
730 struct memory_handle *h = find_handle(handle_id); 730 struct memory_handle *h = find_handle(handle_id);
731 731
@@ -830,7 +830,7 @@ static bool fill_buffer(void)
830/* Given a file descriptor to a bitmap file, write the bitmap data to the 830/* Given a file descriptor to a bitmap file, write the bitmap data to the
831 buffer, with a struct bitmap and the actual data immediately following. 831 buffer, with a struct bitmap and the actual data immediately following.
832 Return value is the total size (struct + data). */ 832 Return value is the total size (struct + data). */
833static int load_bitmap(const int fd) 833static int load_bitmap(int fd)
834{ 834{
835 int rc; 835 int rc;
836 struct bitmap *bmp = (struct bitmap *)&buffer[buf_widx]; 836 struct bitmap *bmp = (struct bitmap *)&buffer[buf_widx];
@@ -873,7 +873,7 @@ management functions for all the actual handle management work.
873 return value: <0 if the file cannot be opened, or one file already 873 return value: <0 if the file cannot be opened, or one file already
874 queued to be opened, otherwise the handle for the file in the buffer 874 queued to be opened, otherwise the handle for the file in the buffer
875*/ 875*/
876int bufopen(const char *file, const size_t offset, const enum data_type type) 876int bufopen(const char *file, size_t offset, enum data_type type)
877{ 877{
878 size_t adjusted_offset = offset; 878 size_t adjusted_offset = offset;
879 879
@@ -957,7 +957,7 @@ int bufopen(const char *file, const size_t offset, const enum data_type type)
957 requested amount of data can entirely fit in the buffer without wrapping. 957 requested amount of data can entirely fit in the buffer without wrapping.
958 Return value is the handle id for success or <0 for failure. 958 Return value is the handle id for success or <0 for failure.
959*/ 959*/
960int bufalloc(const void *src, const size_t size, const enum data_type type) 960int bufalloc(const void *src, size_t size, enum data_type type)
961{ 961{
962 struct memory_handle *h = add_handle(size, false, true); 962 struct memory_handle *h = add_handle(size, false, true);
963 963
@@ -992,7 +992,7 @@ int bufalloc(const void *src, const size_t size, const enum data_type type)
992} 992}
993 993
994/* Close the handle. Return true for success and false for failure */ 994/* Close the handle. Return true for success and false for failure */
995bool bufclose(const int handle_id) 995bool bufclose(int handle_id)
996{ 996{
997 logf("bufclose(%d)", handle_id); 997 logf("bufclose(%d)", handle_id);
998 998
@@ -1006,7 +1006,7 @@ bool bufclose(const int handle_id)
1006 -1 if the handle wasn't found 1006 -1 if the handle wasn't found
1007 -2 if the new requested position was beyond the end of the file 1007 -2 if the new requested position was beyond the end of the file
1008*/ 1008*/
1009int bufseek(const int handle_id, const size_t newpos) 1009int bufseek(int handle_id, size_t newpos)
1010{ 1010{
1011 struct memory_handle *h = find_handle(handle_id); 1011 struct memory_handle *h = find_handle(handle_id);
1012 if (!h) 1012 if (!h)
@@ -1028,7 +1028,7 @@ int bufseek(const int handle_id, const size_t newpos)
1028 1028
1029/* Advance the reading index in a handle (relatively to its current position). 1029/* Advance the reading index in a handle (relatively to its current position).
1030 Return 0 for success and < 0 for failure */ 1030 Return 0 for success and < 0 for failure */
1031int bufadvance(const int handle_id, const off_t offset) 1031int bufadvance(int handle_id, off_t offset)
1032{ 1032{
1033 const struct memory_handle *h = find_handle(handle_id); 1033 const struct memory_handle *h = find_handle(handle_id);
1034 if (!h) 1034 if (!h)
@@ -1042,8 +1042,8 @@ int bufadvance(const int handle_id, const off_t offset)
1042 * actual amount of data available for reading. This function explicitly 1042 * actual amount of data available for reading. This function explicitly
1043 * does not check the validity of the input handle. It does do range checks 1043 * does not check the validity of the input handle. It does do range checks
1044 * on size and returns a valid (and explicit) amount of data for reading */ 1044 * on size and returns a valid (and explicit) amount of data for reading */
1045static struct memory_handle *prep_bufdata(const int handle_id, size_t *size, 1045static struct memory_handle *prep_bufdata(int handle_id, size_t *size,
1046 const bool guardbuf_limit) 1046 bool guardbuf_limit)
1047{ 1047{
1048 struct memory_handle *h = find_handle(handle_id); 1048 struct memory_handle *h = find_handle(handle_id);
1049 if (!h) 1049 if (!h)
@@ -1096,7 +1096,7 @@ static struct memory_handle *prep_bufdata(const int handle_id, size_t *size,
1096 Return the number of bytes copied or < 0 for failure (handle not found). 1096 Return the number of bytes copied or < 0 for failure (handle not found).
1097 The caller is blocked until the requested amount of data is available. 1097 The caller is blocked until the requested amount of data is available.
1098*/ 1098*/
1099ssize_t bufread(const int handle_id, const size_t size, void *dest) 1099ssize_t bufread(int handle_id, size_t size, void *dest)
1100{ 1100{
1101 const struct memory_handle *h; 1101 const struct memory_handle *h;
1102 size_t adjusted_size = size; 1102 size_t adjusted_size = size;
@@ -1129,7 +1129,7 @@ ssize_t bufread(const int handle_id, const size_t size, void *dest)
1129 The guard buffer may be used to provide the requested size. This means it's 1129 The guard buffer may be used to provide the requested size. This means it's
1130 unsafe to request more than the size of the guard buffer. 1130 unsafe to request more than the size of the guard buffer.
1131*/ 1131*/
1132ssize_t bufgetdata(const int handle_id, const size_t size, void **data) 1132ssize_t bufgetdata(int handle_id, size_t size, void **data)
1133{ 1133{
1134 const struct memory_handle *h; 1134 const struct memory_handle *h;
1135 size_t adjusted_size = size; 1135 size_t adjusted_size = size;
@@ -1154,7 +1154,7 @@ ssize_t bufgetdata(const int handle_id, const size_t size, void **data)
1154 return adjusted_size; 1154 return adjusted_size;
1155} 1155}
1156 1156
1157ssize_t bufgettail(const int handle_id, const size_t size, void **data) 1157ssize_t bufgettail(int handle_id, size_t size, void **data)
1158{ 1158{
1159 size_t tidx; 1159 size_t tidx;
1160 1160
@@ -1184,7 +1184,7 @@ ssize_t bufgettail(const int handle_id, const size_t size, void **data)
1184 return size; 1184 return size;
1185} 1185}
1186 1186
1187ssize_t bufcuttail(const int handle_id, const size_t size) 1187ssize_t bufcuttail(int handle_id, size_t size)
1188{ 1188{
1189 struct memory_handle *h; 1189 struct memory_handle *h;
1190 size_t adjusted_size = size; 1190 size_t adjusted_size = size;
@@ -1228,7 +1228,7 @@ management functions for all the actual handle management work.
1228*/ 1228*/
1229 1229
1230/* Get a handle offset from a pointer */ 1230/* Get a handle offset from a pointer */
1231ssize_t buf_get_offset(const int handle_id, void *ptr) 1231ssize_t buf_get_offset(int handle_id, void *ptr)
1232{ 1232{
1233 const struct memory_handle *h = find_handle(handle_id); 1233 const struct memory_handle *h = find_handle(handle_id);
1234 if (!h) 1234 if (!h)
@@ -1237,7 +1237,7 @@ ssize_t buf_get_offset(const int handle_id, void *ptr)
1237 return (size_t)ptr - (size_t)&buffer[h->ridx]; 1237 return (size_t)ptr - (size_t)&buffer[h->ridx];
1238} 1238}
1239 1239
1240ssize_t buf_handle_offset(const int handle_id) 1240ssize_t buf_handle_offset(int handle_id)
1241{ 1241{
1242 const struct memory_handle *h = find_handle(handle_id); 1242 const struct memory_handle *h = find_handle(handle_id);
1243 if (!h) 1243 if (!h)
@@ -1245,13 +1245,13 @@ ssize_t buf_handle_offset(const int handle_id)
1245 return h->offset; 1245 return h->offset;
1246} 1246}
1247 1247
1248void buf_request_buffer_handle(const int handle_id) 1248void buf_request_buffer_handle(int handle_id)
1249{ 1249{
1250 LOGFQUEUE("buffering >| Q_START_FILL %d",handle_id); 1250 LOGFQUEUE("buffering >| Q_START_FILL %d",handle_id);
1251 queue_send(&buffering_queue, Q_START_FILL, handle_id); 1251 queue_send(&buffering_queue, Q_START_FILL, handle_id);
1252} 1252}
1253 1253
1254void buf_set_base_handle(const int handle_id) 1254void buf_set_base_handle(int handle_id)
1255{ 1255{
1256 LOGFQUEUE("buffering > Q_BASE_HANDLE %d", handle_id); 1256 LOGFQUEUE("buffering > Q_BASE_HANDLE %d", handle_id);
1257 queue_post(&buffering_queue, Q_BASE_HANDLE, handle_id); 1257 queue_post(&buffering_queue, Q_BASE_HANDLE, handle_id);
@@ -1263,13 +1263,13 @@ size_t buf_used(void)
1263 return BUF_USED; 1263 return BUF_USED;
1264} 1264}
1265 1265
1266void buf_set_watermark(const size_t bytes) 1266void buf_set_watermark(size_t bytes)
1267{ 1267{
1268 LOGFQUEUE("buffering > Q_SET_WATERMARK %ld", (long)bytes); 1268 LOGFQUEUE("buffering > Q_SET_WATERMARK %ld", (long)bytes);
1269 queue_post(&buffering_queue, Q_SET_WATERMARK, bytes); 1269 queue_post(&buffering_queue, Q_SET_WATERMARK, bytes);
1270} 1270}
1271 1271
1272bool register_buffering_callback(const buffering_callback func) 1272bool register_buffering_callback(buffering_callback func)
1273{ 1273{
1274 int i; 1274 int i;
1275 if (buffer_callback_count >= MAX_BUF_CALLBACKS) 1275 if (buffer_callback_count >= MAX_BUF_CALLBACKS)
@@ -1288,7 +1288,7 @@ bool register_buffering_callback(const buffering_callback func)
1288 return false; 1288 return false;
1289} 1289}
1290 1290
1291void unregister_buffering_callback(const buffering_callback func) 1291void unregister_buffering_callback(buffering_callback func)
1292{ 1292{
1293 int i; 1293 int i;
1294 for (i = 0; i < MAX_BUF_CALLBACKS; i++) 1294 for (i = 0; i < MAX_BUF_CALLBACKS; i++)
@@ -1302,7 +1302,7 @@ void unregister_buffering_callback(const buffering_callback func)
1302 return; 1302 return;
1303} 1303}
1304 1304
1305static void call_buffering_callbacks(const enum callback_event ev, const int value) 1305static void call_buffering_callbacks(enum callback_event ev, int value)
1306{ 1306{
1307 logf("call_buffering_callbacks()"); 1307 logf("call_buffering_callbacks()");
1308 int i; 1308 int i;
@@ -1471,7 +1471,7 @@ void buffering_init(void)
1471} 1471}
1472 1472
1473/* Initialise the buffering subsystem */ 1473/* Initialise the buffering subsystem */
1474bool buffering_reset(char *buf, const size_t buflen) 1474bool buffering_reset(char *buf, size_t buflen)
1475{ 1475{
1476 if (!buf || !buflen) 1476 if (!buf || !buflen)
1477 return false; 1477 return false;
diff --git a/apps/buffering.h b/apps/buffering.h
index abe8f608c6..bc61ec5e6d 100644
--- a/apps/buffering.h
+++ b/apps/buffering.h
@@ -56,7 +56,7 @@ enum callback_event {
56void buffering_init(void); 56void buffering_init(void);
57 57
58/* Reset the buffering system */ 58/* Reset the buffering system */
59bool buffering_reset(char *buf, const size_t buflen); 59bool buffering_reset(char *buf, size_t buflen);
60 60
61 61
62/*************************************************************************** 62/***************************************************************************
@@ -80,15 +80,15 @@ bool buffering_reset(char *buf, const size_t buflen);
80 80
81#define BUF_MAX_HANDLES 256 81#define BUF_MAX_HANDLES 256
82 82
83int bufopen(const char *file, size_t offset, const enum data_type type); 83int bufopen(const char *file, size_t offset, enum data_type type);
84int bufalloc(const void *src, const size_t size, const enum data_type type); 84int bufalloc(const void *src, size_t size, enum data_type type);
85bool bufclose(const int handle_id); 85bool bufclose(int handle_id);
86int bufseek(const int handle_id, const size_t newpos); 86int bufseek(int handle_id, size_t newpos);
87int bufadvance(const int handle_id, const off_t offset); 87int bufadvance(int handle_id, off_t offset);
88ssize_t bufread(const int handle_id, size_t size, void *dest); 88ssize_t bufread(int handle_id, size_t size, void *dest);
89ssize_t bufgetdata(const int handle_id, size_t size, void **data); 89ssize_t bufgetdata(int handle_id, size_t size, void **data);
90ssize_t bufgettail(const int handle_id, const size_t size, void **data); 90ssize_t bufgettail(int handle_id, size_t size, void **data);
91ssize_t bufcuttail(const int handle_id, size_t size); 91ssize_t bufcuttail(int handle_id, size_t size);
92 92
93 93
94/*************************************************************************** 94/***************************************************************************
@@ -102,10 +102,10 @@ ssize_t bufcuttail(const int handle_id, size_t size);
102 * buf_used: Total amount of buffer space used (including allocated space) 102 * buf_used: Total amount of buffer space used (including allocated space)
103 ****************************************************************************/ 103 ****************************************************************************/
104 104
105ssize_t buf_get_offset(const int handle_id, void *ptr); 105ssize_t buf_get_offset(int handle_id, void *ptr);
106ssize_t buf_handle_offset(const int handle_id); 106ssize_t buf_handle_offset(int handle_id);
107void buf_request_buffer_handle(const int handle_id); 107void buf_request_buffer_handle(int handle_id);
108void buf_set_base_handle(const int handle_id); 108void buf_set_base_handle(int handle_id);
109size_t buf_used(void); 109size_t buf_used(void);
110 110
111 111
@@ -123,9 +123,9 @@ size_t buf_used(void);
123 ****************************************************************************/ 123 ****************************************************************************/
124 124
125#define MAX_BUF_CALLBACKS 4 125#define MAX_BUF_CALLBACKS 4
126typedef void (*buffering_callback)(const enum callback_event ev, const int value); 126typedef void (*buffering_callback)(enum callback_event ev, int value);
127bool register_buffering_callback(const buffering_callback func); 127bool register_buffering_callback(buffering_callback func);
128void unregister_buffering_callback(const buffering_callback func); 128void unregister_buffering_callback(buffering_callback func);
129 129
130/* Settings */ 130/* Settings */
131enum { 131enum {
diff --git a/apps/codecs.h b/apps/codecs.h
index 85b73a4953..fb5675fd84 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -126,28 +126,28 @@ struct codec_api {
126 void* (*get_codec_memory)(size_t *size); 126 void* (*get_codec_memory)(size_t *size);
127 /* Insert PCM data into audio buffer for playback. Playback will start 127 /* Insert PCM data into audio buffer for playback. Playback will start
128 automatically. */ 128 automatically. */
129 bool (*pcmbuf_insert)(const void *ch1, const void *ch2, const int count); 129 bool (*pcmbuf_insert)(const void *ch1, const void *ch2, int count);
130 /* Set song position in WPS (value in ms). */ 130 /* Set song position in WPS (value in ms). */
131 void (*set_elapsed)(const unsigned int value); 131 void (*set_elapsed)(unsigned int value);
132 132
133 /* Read next <size> amount bytes from file buffer to <ptr>. 133 /* Read next <size> amount bytes from file buffer to <ptr>.
134 Will return number of bytes read or 0 if end of file. */ 134 Will return number of bytes read or 0 if end of file. */
135 size_t (*read_filebuf)(void *ptr, const size_t size); 135 size_t (*read_filebuf)(void *ptr, size_t size);
136 /* Request pointer to file buffer which can be used to read 136 /* Request pointer to file buffer which can be used to read
137 <realsize> amount of data. <reqsize> tells the buffer system 137 <realsize> amount of data. <reqsize> tells the buffer system
138 how much data it should try to allocate. If <realsize> is 0, 138 how much data it should try to allocate. If <realsize> is 0,
139 end of file is reached. */ 139 end of file is reached. */
140 void* (*request_buffer)(size_t *realsize, const size_t reqsize); 140 void* (*request_buffer)(size_t *realsize, size_t reqsize);
141 /* Advance file buffer position by <amount> amount of bytes. */ 141 /* Advance file buffer position by <amount> amount of bytes. */
142 void (*advance_buffer)(const size_t amount); 142 void (*advance_buffer)(size_t amount);
143 /* Advance file buffer to a pointer location inside file buffer. */ 143 /* Advance file buffer to a pointer location inside file buffer. */
144 void (*advance_buffer_loc)(void *ptr); 144 void (*advance_buffer_loc)(void *ptr);
145 /* Seek file buffer to position <newpos> beginning of file. */ 145 /* Seek file buffer to position <newpos> beginning of file. */
146 bool (*seek_buffer)(const size_t newpos); 146 bool (*seek_buffer)(size_t newpos);
147 /* Codec should call this function when it has done the seeking. */ 147 /* Codec should call this function when it has done the seeking. */
148 void (*seek_complete)(void); 148 void (*seek_complete)(void);
149 /* Calculate mp3 seek position from given time data in ms. */ 149 /* Calculate mp3 seek position from given time data in ms. */
150 off_t (*mp3_get_filepos)(const int newtime); 150 off_t (*mp3_get_filepos)(int newtime);
151 /* Request file change from file buffer. Returns true is next 151 /* Request file change from file buffer. Returns true is next
152 track is available and changed. If return value is false, 152 track is available and changed. If return value is false,
153 codec should exit immediately with PLUGIN_OK status. */ 153 codec should exit immediately with PLUGIN_OK status. */
@@ -155,12 +155,12 @@ struct codec_api {
155 /* Free the buffer area of the current codec after its loaded */ 155 /* Free the buffer area of the current codec after its loaded */
156 void (*discard_codec)(void); 156 void (*discard_codec)(void);
157 157
158 void (*set_offset)(const size_t value); 158 void (*set_offset)(size_t value);
159 /* Configure different codec buffer parameters. */ 159 /* Configure different codec buffer parameters. */
160 void (*configure)(const int setting, const intptr_t value); 160 void (*configure)(int setting, intptr_t value);
161 161
162 /* kernel/ system */ 162 /* kernel/ system */
163 void (*PREFIX(sleep))(const int ticks); 163 void (*PREFIX(sleep))(int ticks);
164 void (*yield)(void); 164 void (*yield)(void);
165 165
166#if NUM_CORES > 1 166#if NUM_CORES > 1
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c
index b9587d08dd..8f16c90523 100644
--- a/apps/pcmbuf.c
+++ b/apps/pcmbuf.c
@@ -82,7 +82,7 @@ static char *fadebuf IDATA_ATTR;
82static char *voicebuf IDATA_ATTR; 82static char *voicebuf IDATA_ATTR;
83 83
84static void (*pcmbuf_event_handler)(void) IDATA_ATTR; 84static void (*pcmbuf_event_handler)(void) IDATA_ATTR;
85static void (*position_callback)(const size_t size) IDATA_ATTR; 85static void (*position_callback)(size_t size) IDATA_ATTR;
86 86
87/* Crossfade related state */ 87/* Crossfade related state */
88static bool crossfade_enabled; 88static bool crossfade_enabled;
@@ -188,7 +188,7 @@ static void pcmbuf_callback(unsigned char** start, size_t* size)
188 } 188 }
189} 189}
190 190
191void pcmbuf_set_position_callback(void (*callback)(const size_t size)) 191void pcmbuf_set_position_callback(void (*callback)(size_t size))
192{ 192{
193 position_callback = callback; 193 position_callback = callback;
194} 194}
@@ -938,7 +938,7 @@ void pcmbuf_write_complete(int count)
938} 938}
939 939
940#if 0 940#if 0
941bool pcmbuf_insert_buffer(char *buf, const int count) 941bool pcmbuf_insert_buffer(char *buf, int count)
942{ 942{
943 size_t length = (size_t)(unsigned int)count << 2; 943 size_t length = (size_t)(unsigned int)count << 2;
944 944
diff --git a/apps/pcmbuf.h b/apps/pcmbuf.h
index 9263285a6b..06362452c0 100644
--- a/apps/pcmbuf.h
+++ b/apps/pcmbuf.h
@@ -63,7 +63,7 @@ bool pcmbuf_is_lowdata(void);
63void pcmbuf_play_start(void); 63void pcmbuf_play_start(void);
64bool pcmbuf_crossfade_init(bool manual_skip); 64bool pcmbuf_crossfade_init(bool manual_skip);
65void pcmbuf_set_event_handler(void (*callback)(void)); 65void pcmbuf_set_event_handler(void (*callback)(void));
66void pcmbuf_set_position_callback(void (*callback)(const size_t size)); 66void pcmbuf_set_position_callback(void (*callback)(size_t size));
67size_t pcmbuf_free(void); 67size_t pcmbuf_free(void);
68unsigned int pcmbuf_get_latency(void); 68unsigned int pcmbuf_get_latency(void);
69void pcmbuf_set_low_latency(bool state); 69void pcmbuf_set_low_latency(bool state);
diff --git a/apps/playback.c b/apps/playback.c
index de58e8b40d..880c9acf7e 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -249,7 +249,7 @@ static size_t buffer_margin = 0; /* Buffer margin aka anti-skip buffer (A/C-) *
249 249
250/* Multiple threads */ 250/* Multiple threads */
251/* Set the watermark to trigger buffer fill (A/C) FIXME */ 251/* Set the watermark to trigger buffer fill (A/C) FIXME */
252static void set_filebuf_watermark(const int seconds, const size_t max); 252static void set_filebuf_watermark(int seconds, size_t max);
253 253
254/* Audio thread */ 254/* Audio thread */
255static struct event_queue audio_queue NOCACHEBSS_ATTR; 255static struct event_queue audio_queue NOCACHEBSS_ATTR;
@@ -277,7 +277,7 @@ static struct event_queue pcmbuf_queue NOCACHEBSS_ATTR;
277/* Function to be called by pcm buffer callbacks. 277/* Function to be called by pcm buffer callbacks.
278 * Permissible Context(s): Audio interrupt 278 * Permissible Context(s): Audio interrupt
279 */ 279 */
280static void pcmbuf_callback_queue_post(const long id, intptr_t data) 280static void pcmbuf_callback_queue_post(long id, intptr_t data)
281{ 281{
282 /* No lock since we're already in audio interrupt context */ 282 /* No lock since we're already in audio interrupt context */
283 queue_post(&pcmbuf_queue, id, data); 283 queue_post(&pcmbuf_queue, id, data);
@@ -313,7 +313,7 @@ static void pcmbuf_queue_clear(void)
313 313
314/* --- Helper functions --- */ 314/* --- Helper functions --- */
315 315
316static struct mp3entry *bufgetid3(const int handle_id) 316static struct mp3entry *bufgetid3(int handle_id)
317{ 317{
318 if (handle_id < 0) 318 if (handle_id < 0)
319 return NULL; 319 return NULL;
@@ -384,7 +384,7 @@ void audio_hard_stop(void)
384#endif 384#endif
385} 385}
386 386
387bool audio_restore_playback(const int type) 387bool audio_restore_playback(int type)
388{ 388{
389 switch (type) 389 switch (type)
390 { 390 {
@@ -401,7 +401,7 @@ bool audio_restore_playback(const int type)
401 } 401 }
402} 402}
403 403
404unsigned char *audio_get_buffer(const bool talk_buf, size_t *buffer_size) 404unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size)
405{ 405{
406 unsigned char *buf, *end; 406 unsigned char *buf, *end;
407 407
@@ -621,7 +621,7 @@ bool audio_has_changed_track(void)
621 return false; 621 return false;
622} 622}
623 623
624void audio_play(const long offset) 624void audio_play(long offset)
625{ 625{
626 logf("audio_play"); 626 logf("audio_play");
627 627
@@ -710,7 +710,7 @@ void audio_pre_ff_rewind(void)
710 queue_post(&audio_queue, Q_AUDIO_PRE_FF_REWIND, 0); 710 queue_post(&audio_queue, Q_AUDIO_PRE_FF_REWIND, 0);
711} 711}
712 712
713void audio_ff_rewind(const long newpos) 713void audio_ff_rewind(long newpos)
714{ 714{
715 LOGFQUEUE("audio > audio Q_AUDIO_FF_REWIND"); 715 LOGFQUEUE("audio > audio Q_AUDIO_FF_REWIND");
716 queue_post(&audio_queue, Q_AUDIO_FF_REWIND, newpos); 716 queue_post(&audio_queue, Q_AUDIO_FF_REWIND, newpos);
@@ -753,7 +753,7 @@ int audio_get_file_pos(void)
753} 753}
754 754
755#ifndef HAVE_FLASH_STORAGE 755#ifndef HAVE_FLASH_STORAGE
756void audio_set_buffer_margin(const int setting) 756void audio_set_buffer_margin(int setting)
757{ 757{
758 static const int lookup[] = {5, 15, 30, 60, 120, 180, 300, 600}; 758 static const int lookup[] = {5, 15, 30, 60, 120, 180, 300, 600};
759 buffer_margin = lookup[setting]; 759 buffer_margin = lookup[setting];
@@ -763,7 +763,7 @@ void audio_set_buffer_margin(const int setting)
763#endif 763#endif
764 764
765/* Take necessary steps to enable or disable the crossfade setting */ 765/* Take necessary steps to enable or disable the crossfade setting */
766void audio_set_crossfade(const int enable) 766void audio_set_crossfade(int enable)
767{ 767{
768 size_t offset; 768 size_t offset;
769 bool was_playing; 769 bool was_playing;
@@ -805,7 +805,7 @@ void audio_set_crossfade(const int enable)
805 805
806/* --- Routines called from multiple threads --- */ 806/* --- Routines called from multiple threads --- */
807 807
808static void set_filebuf_watermark(const int seconds, const size_t max) 808static void set_filebuf_watermark(int seconds, size_t max)
809{ 809{
810 size_t bytes; 810 size_t bytes;
811 811
@@ -817,7 +817,7 @@ static void set_filebuf_watermark(const int seconds, const size_t max)
817 buf_set_watermark(bytes); 817 buf_set_watermark(bytes);
818} 818}
819 819
820const char *get_codec_filename(const int cod_spec) 820const char *get_codec_filename(int cod_spec)
821{ 821{
822 const char *fname; 822 const char *fname;
823 823
@@ -838,11 +838,10 @@ const char *get_codec_filename(const int cod_spec)
838 afmt, fname ? fname : "<unknown>"); 838 afmt, fname ? fname : "<unknown>");
839#else /* !HAVE_RECORDING */ 839#else /* !HAVE_RECORDING */
840 /* Always decoder */ 840 /* Always decoder */
841 int afmt = cod_spec; 841 if ((unsigned)cod_spec >= AFMT_NUM_CODECS)
842 if ((unsigned)afmt >= AFMT_NUM_CODECS) 842 cod_spec = AFMT_UNKNOWN;
843 afmt = AFMT_UNKNOWN; 843 fname = audio_formats[cod_spec].codec_root_fn;
844 fname = audio_formats[afmt].codec_root_fn; 844 logf("Codec: %d - %s", cod_spec, fname ? fname : "<unknown>");
845 logf("Codec: %d - %s", afmt, fname ? fname : "<unknown>");
846#endif /* HAVE_RECORDING */ 845#endif /* HAVE_RECORDING */
847 846
848 return fname; 847 return fname;
@@ -850,14 +849,13 @@ const char *get_codec_filename(const int cod_spec)
850 849
851/* --- Codec thread --- */ 850/* --- Codec thread --- */
852static bool codec_pcmbuf_insert_callback( 851static bool codec_pcmbuf_insert_callback(
853 const void *ch1, const void *ch2, const int count) 852 const void *ch1, const void *ch2, int count)
854{ 853{
855 const char *src[2] = { ch1, ch2 }; 854 const char *src[2] = { ch1, ch2 };
856 855
857 int remaining = count; 856 while (count > 0)
858 while (remaining > 0)
859 { 857 {
860 int out_count = dsp_output_count(ci.dsp, remaining); 858 int out_count = dsp_output_count(ci.dsp, count);
861 int inp_count; 859 int inp_count;
862 char *dest; 860 char *dest;
863 861
@@ -881,8 +879,8 @@ static bool codec_pcmbuf_insert_callback(
881 return true; 879 return true;
882 880
883 /* Input size has grown, no error, just don't write more than length */ 881 /* Input size has grown, no error, just don't write more than length */
884 if (inp_count > remaining) 882 if (inp_count > count)
885 inp_count = remaining; 883 inp_count = count;
886 884
887 out_count = dsp_process(ci.dsp, dest, src, inp_count); 885 out_count = dsp_process(ci.dsp, dest, src, inp_count);
888 886
@@ -891,7 +889,7 @@ static bool codec_pcmbuf_insert_callback(
891 889
892 pcmbuf_write_complete(out_count); 890 pcmbuf_write_complete(out_count);
893 891
894 remaining -= inp_count; 892 count -= inp_count;
895 } 893 }
896 894
897 return true; 895 return true;
@@ -907,8 +905,8 @@ static void* codec_get_memory_callback(size_t *size)
907 "elapsed" value of the previous (to the codec, but current to the 905 "elapsed" value of the previous (to the codec, but current to the
908 user/PCM/WPS) track, so that the progressbar reaches the end. 906 user/PCM/WPS) track, so that the progressbar reaches the end.
909 During that transition, the WPS will display prevtrack_id3. */ 907 During that transition, the WPS will display prevtrack_id3. */
910static void codec_pcmbuf_position_callback(const size_t size) ICODE_ATTR; 908static void codec_pcmbuf_position_callback(size_t size) ICODE_ATTR;
911static void codec_pcmbuf_position_callback(const size_t size) 909static void codec_pcmbuf_position_callback(size_t size)
912{ 910{
913 /* This is called from an ISR, so be quick */ 911 /* This is called from an ISR, so be quick */
914 unsigned int time = size * 1000 / 4 / NATIVE_FREQUENCY + 912 unsigned int time = size * 1000 / 4 / NATIVE_FREQUENCY +
@@ -923,7 +921,7 @@ static void codec_pcmbuf_position_callback(const size_t size)
923 prevtrack_id3.elapsed = time; 921 prevtrack_id3.elapsed = time;
924} 922}
925 923
926static void codec_set_elapsed_callback(const unsigned int value) 924static void codec_set_elapsed_callback(unsigned int value)
927{ 925{
928 unsigned int latency; 926 unsigned int latency;
929 if (ci.seek_time) 927 if (ci.seek_time)
@@ -943,7 +941,7 @@ static void codec_set_elapsed_callback(const unsigned int value)
943 } 941 }
944} 942}
945 943
946static void codec_set_offset_callback(const size_t value) 944static void codec_set_offset_callback(size_t value)
947{ 945{
948 unsigned int latency; 946 unsigned int latency;
949 947
@@ -957,14 +955,14 @@ static void codec_set_offset_callback(const size_t value)
957 curtrack_id3.offset = value - latency; 955 curtrack_id3.offset = value - latency;
958} 956}
959 957
960static void codec_advance_buffer_counters(const size_t amount) 958static void codec_advance_buffer_counters(size_t amount)
961{ 959{
962 bufadvance(CUR_TI->audio_hid, amount); 960 bufadvance(CUR_TI->audio_hid, amount);
963 ci.curpos += amount; 961 ci.curpos += amount;
964} 962}
965 963
966/* copy up-to size bytes into ptr and return the actual size copied */ 964/* copy up-to size bytes into ptr and return the actual size copied */
967static size_t codec_filebuf_callback(void *ptr, const size_t size) 965static size_t codec_filebuf_callback(void *ptr, size_t size)
968{ 966{
969 ssize_t copy_n; 967 ssize_t copy_n;
970 968
@@ -984,7 +982,7 @@ static size_t codec_filebuf_callback(void *ptr, const size_t size)
984 return copy_n; 982 return copy_n;
985} /* codec_filebuf_callback */ 983} /* codec_filebuf_callback */
986 984
987static void* codec_request_buffer_callback(size_t *realsize, const size_t reqsize) 985static void* codec_request_buffer_callback(size_t *realsize, size_t reqsize)
988{ 986{
989 size_t copy_n = reqsize; 987 size_t copy_n = reqsize;
990 ssize_t ret; 988 ssize_t ret;
@@ -1023,7 +1021,7 @@ static int get_codec_base_type(int type)
1023 return type; 1021 return type;
1024} 1022}
1025 1023
1026static void codec_advance_buffer_callback(const size_t amount) 1024static void codec_advance_buffer_callback(size_t amount)
1027{ 1025{
1028 codec_advance_buffer_counters(amount); 1026 codec_advance_buffer_counters(amount);
1029 codec_set_offset_callback(ci.curpos); 1027 codec_set_offset_callback(ci.curpos);
@@ -1090,7 +1088,7 @@ static int codec_get_file_pos(void)
1090 return pos; 1088 return pos;
1091} 1089}
1092 1090
1093static off_t codec_mp3_get_filepos_callback(const int newtime) 1091static off_t codec_mp3_get_filepos_callback(int newtime)
1094{ 1092{
1095 off_t newpos; 1093 off_t newpos;
1096 1094
@@ -1116,7 +1114,7 @@ static void codec_seek_complete_callback(void)
1116 ci.seek_time = 0; 1114 ci.seek_time = 0;
1117} 1115}
1118 1116
1119static bool codec_seek_buffer_callback(const size_t newpos) 1117static bool codec_seek_buffer_callback(size_t newpos)
1120{ 1118{
1121 logf("codec_seek_buffer_callback"); 1119 logf("codec_seek_buffer_callback");
1122 1120
@@ -1130,7 +1128,7 @@ static bool codec_seek_buffer_callback(const size_t newpos)
1130 } 1128 }
1131} 1129}
1132 1130
1133static void codec_configure_callback(const int setting, const intptr_t value) 1131static void codec_configure_callback(int setting, intptr_t value)
1134{ 1132{
1135 switch (setting) { 1133 switch (setting) {
1136 case CODEC_SET_FILEBUF_WATERMARK: 1134 case CODEC_SET_FILEBUF_WATERMARK:
@@ -1180,7 +1178,7 @@ static inline void codec_crossfade_track_change(void)
1180 codec_track_changed(); 1178 codec_track_changed();
1181} 1179}
1182 1180
1183static void codec_track_skip_done(const bool was_manual) 1181static void codec_track_skip_done(bool was_manual)
1184{ 1182{
1185 /* Manual track change (always crossfade or flush audio). */ 1183 /* Manual track change (always crossfade or flush audio). */
1186 if (was_manual) 1184 if (was_manual)
@@ -1487,7 +1485,7 @@ static void audio_update_trackinfo(void)
1487 ci.taginfo_ready = &CUR_TI->taginfo_ready; 1485 ci.taginfo_ready = &CUR_TI->taginfo_ready;
1488} 1486}
1489 1487
1490static void buffering_audio_callback(const enum callback_event ev, const int value) 1488static void buffering_audio_callback(enum callback_event ev, int value)
1491{ 1489{
1492 (void)value; 1490 (void)value;
1493 logf("buffering_audio_callback"); 1491 logf("buffering_audio_callback");
@@ -1551,7 +1549,7 @@ static bool audio_release_tracks(void)
1551 return true; 1549 return true;
1552} 1550}
1553 1551
1554static bool audio_loadcodec(const bool start_play) 1552static bool audio_loadcodec(bool start_play)
1555{ 1553{
1556 int prev_track; 1554 int prev_track;
1557 char codec_path[MAX_PATH]; /* Full path to codec */ 1555 char codec_path[MAX_PATH]; /* Full path to codec */
@@ -1669,7 +1667,7 @@ static void audio_set_elapsed(struct mp3entry* id3)
1669 1667
1670/* Load one track by making the appropriate bufopen calls. Return true if 1668/* Load one track by making the appropriate bufopen calls. Return true if
1671 everything required was loaded correctly, false if not. */ 1669 everything required was loaded correctly, false if not. */
1672static bool audio_load_track(const int offset, const bool start_play) 1670static bool audio_load_track(int offset, bool start_play)
1673{ 1671{
1674 const char *trackname; 1672 const char *trackname;
1675 char msgbuf[80]; 1673 char msgbuf[80];
@@ -1716,9 +1714,8 @@ static bool audio_load_track(const int offset, const bool start_play)
1716 1714
1717 tracks[track_widx].filesize = filesize(fd); 1715 tracks[track_widx].filesize = filesize(fd);
1718 1716
1719 int adjusted_offset = offset; 1717 if ((unsigned)offset > tracks[track_widx].filesize)
1720 if ((unsigned)adjusted_offset > tracks[track_widx].filesize) 1718 offset = 0;
1721 adjusted_offset = 0;
1722 1719
1723 /* Set default values */ 1720 /* Set default values */
1724 if (start_play) 1721 if (start_play)
@@ -1830,17 +1827,17 @@ static bool audio_load_track(const int offset, const bool start_play)
1830 case AFMT_MPA_L1: 1827 case AFMT_MPA_L1:
1831 case AFMT_MPA_L2: 1828 case AFMT_MPA_L2:
1832 case AFMT_MPA_L3: 1829 case AFMT_MPA_L3:
1833 if (adjusted_offset > 0) { 1830 if (offset > 0) {
1834 file_offset = adjusted_offset; 1831 file_offset = offset;
1835 track_id3->offset = adjusted_offset; 1832 track_id3->offset = offset;
1836 audio_set_elapsed(track_id3); 1833 audio_set_elapsed(track_id3);
1837 } 1834 }
1838 break; 1835 break;
1839 1836
1840 case AFMT_WAVPACK: 1837 case AFMT_WAVPACK:
1841 if (offset > 0) { 1838 if (offset > 0) {
1842 file_offset = adjusted_offset; 1839 file_offset = offset;
1843 track_id3->offset = adjusted_offset; 1840 track_id3->offset = offset;
1844 track_id3->elapsed = track_id3->length / 2; 1841 track_id3->elapsed = track_id3->length / 2;
1845 } 1842 }
1846 break; 1843 break;
@@ -1853,8 +1850,8 @@ static bool audio_load_track(const int offset, const bool start_play)
1853 case AFMT_AAC: 1850 case AFMT_AAC:
1854 case AFMT_MPC: 1851 case AFMT_MPC:
1855 case AFMT_APE: 1852 case AFMT_APE:
1856 if (adjusted_offset > 0) 1853 if (offset > 0)
1857 track_id3->offset = adjusted_offset; 1854 track_id3->offset = offset;
1858 break; 1855 break;
1859 1856
1860 case AFMT_NSF: 1857 case AFMT_NSF:
@@ -1893,7 +1890,7 @@ static bool audio_load_track(const int offset, const bool start_play)
1893 return true; 1890 return true;
1894} 1891}
1895 1892
1896static void audio_fill_file_buffer(const bool start_play, const size_t offset) 1893static void audio_fill_file_buffer(bool start_play, size_t offset)
1897{ 1894{
1898 struct queue_event ev; 1895 struct queue_event ev;
1899 bool had_next_track = audio_next_track() != NULL; 1896 bool had_next_track = audio_next_track() != NULL;
@@ -2195,7 +2192,7 @@ static void audio_stop_playback(void)
2195 memset(&curtrack_id3, 0, sizeof(struct mp3entry)); 2192 memset(&curtrack_id3, 0, sizeof(struct mp3entry));
2196} 2193}
2197 2194
2198static void audio_play_start(const size_t offset) 2195static void audio_play_start(size_t offset)
2199{ 2196{
2200 int i; 2197 int i;
2201 2198
@@ -2288,7 +2285,7 @@ static void audio_new_playlist(void)
2288} 2285}
2289 2286
2290/* Called on manual track skip */ 2287/* Called on manual track skip */
2291static void audio_initiate_track_change(const long direction) 2288static void audio_initiate_track_change(long direction)
2292{ 2289{
2293 logf("audio_initiate_track_change(%ld)", direction); 2290 logf("audio_initiate_track_change(%ld)", direction);
2294 2291
@@ -2300,7 +2297,7 @@ static void audio_initiate_track_change(const long direction)
2300} 2297}
2301 2298
2302/* Called on manual dir skip */ 2299/* Called on manual dir skip */
2303static void audio_initiate_dir_change(const long direction) 2300static void audio_initiate_dir_change(long direction)
2304{ 2301{
2305 playlist_end = false; 2302 playlist_end = false;
2306 dir_skip = true; 2303 dir_skip = true;
diff --git a/apps/playback.h b/apps/playback.h
index b65c572145..9951cc2a0d 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -38,13 +38,13 @@
38#define MAX_TRACK_MASK (MAX_TRACK-1) 38#define MAX_TRACK_MASK (MAX_TRACK-1)
39 39
40/* Functions */ 40/* Functions */
41const char *get_codec_filename(const int cod_spec); 41const char *get_codec_filename(int cod_spec);
42void voice_wait(void); 42void voice_wait(void);
43void audio_wait_for_init(void); 43void audio_wait_for_init(void);
44int audio_track_count(void); 44int audio_track_count(void);
45long audio_filebufused(void); 45long audio_filebufused(void);
46void audio_pre_ff_rewind(void); 46void audio_pre_ff_rewind(void);
47void audio_set_crossfade(const int type); 47void audio_set_crossfade(int type);
48 48
49void audio_hard_stop(void); /* Stops audio from serving playback */ 49void audio_hard_stop(void); /* Stops audio from serving playback */
50 50
@@ -53,7 +53,7 @@ enum
53 AUDIO_WANT_PLAYBACK = 0, 53 AUDIO_WANT_PLAYBACK = 0,
54 AUDIO_WANT_VOICE, 54 AUDIO_WANT_VOICE,
55}; 55};
56bool audio_restore_playback(const int type); /* Restores the audio buffer to handle the requested playback */ 56bool audio_restore_playback(int type); /* Restores the audio buffer to handle the requested playback */
57 57
58#ifdef HAVE_ALBUMART 58#ifdef HAVE_ALBUMART
59int audio_current_aa_hid(void); 59int audio_current_aa_hid(void);
diff --git a/apps/plugin.h b/apps/plugin.h
index 148c84a58e..1753272952 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -521,13 +521,13 @@ struct plugin_api {
521 int (*playlist_amount)(void); 521 int (*playlist_amount)(void);
522 int (*playlist_resume)(void); 522 int (*playlist_resume)(void);
523 int (*playlist_start)(int start_index, int offset); 523 int (*playlist_start)(int start_index, int offset);
524 void (*PREFIX(audio_play))(const long offset); 524 void (*PREFIX(audio_play))(long offset);
525 void (*audio_stop)(void); 525 void (*audio_stop)(void);
526 void (*audio_pause)(void); 526 void (*audio_pause)(void);
527 void (*audio_resume)(void); 527 void (*audio_resume)(void);
528 void (*audio_next)(void); 528 void (*audio_next)(void);
529 void (*audio_prev)(void); 529 void (*audio_prev)(void);
530 void (*audio_ff_rewind)(const long newtime); 530 void (*audio_ff_rewind)(long newtime);
531 struct mp3entry* (*audio_next_track)(void); 531 struct mp3entry* (*audio_next_track)(void);
532 int (*audio_status)(void); 532 int (*audio_status)(void);
533 bool (*audio_has_changed_track)(void); 533 bool (*audio_has_changed_track)(void);
@@ -570,15 +570,15 @@ struct plugin_api {
570 bool (*option_screen)(struct settings_list *setting, 570 bool (*option_screen)(struct settings_list *setting,
571 bool use_temp_var, unsigned char* option_title); 571 bool use_temp_var, unsigned char* option_title);
572 bool (*set_option)(const char* string, const void* variable, 572 bool (*set_option)(const char* string, const void* variable,
573 const enum optiontype type, const struct opt_items* options, 573 enum optiontype type, const struct opt_items* options,
574 const int numoptions, void (*function)(int)); 574 int numoptions, void (*function)(int));
575 bool (*set_bool_options)(const char* string, const bool* variable, 575 bool (*set_bool_options)(const char* string, const bool* variable,
576 const char* yes_str, const int yes_voice, 576 const char* yes_str, int yes_voice,
577 const char* no_str, const int no_voice, 577 const char* no_str, int no_voice,
578 void (*function)(bool)); 578 void (*function)(bool));
579 bool (*set_int)(const unsigned char* string, const char* unit, const int voice_unit, 579 bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
580 const int* variable, void (*function)(int), const int step, 580 const int* variable, void (*function)(int), int step,
581 const int min, const int max, 581 int min, int max,
582 void (*formatter)(char*, size_t, int, const char*) ); 582 void (*formatter)(char*, size_t, int, const char*) );
583 bool (*set_bool)(const char* string, const bool* variable ); 583 bool (*set_bool)(const char* string, const bool* variable );
584 584
@@ -684,20 +684,20 @@ struct plugin_api {
684 684
685#if (CONFIG_CODEC == SWCODEC) 685#if (CONFIG_CODEC == SWCODEC)
686 /* buffering API */ 686 /* buffering API */
687 int (*bufopen)(const char *file, size_t offset, const enum data_type type); 687 int (*bufopen)(const char *file, size_t offset, enum data_type type);
688 int (*bufalloc)(const void *src, const size_t size, const enum data_type type); 688 int (*bufalloc)(const void *src, size_t size, enum data_type type);
689 bool (*bufclose)(const int handle_id); 689 bool (*bufclose)(int handle_id);
690 int (*bufseek)(const int handle_id, const size_t newpos); 690 int (*bufseek)(int handle_id, size_t newpos);
691 int (*bufadvance)(const int handle_id, const off_t offset); 691 int (*bufadvance)(int handle_id, off_t offset);
692 ssize_t (*bufread)(const int handle_id, size_t size, void *dest); 692 ssize_t (*bufread)(int handle_id, size_t size, void *dest);
693 ssize_t (*bufgetdata)(const int handle_id, size_t size, void **data); 693 ssize_t (*bufgetdata)(int handle_id, size_t size, void **data);
694 ssize_t (*bufgettail)(const int handle_id, const size_t size, void **data); 694 ssize_t (*bufgettail)(int handle_id, size_t size, void **data);
695 ssize_t (*bufcuttail)(const int handle_id, size_t size); 695 ssize_t (*bufcuttail)(int handle_id, size_t size);
696 696
697 ssize_t (*buf_get_offset)(const int handle_id, void *ptr); 697 ssize_t (*buf_get_offset)(int handle_id, void *ptr);
698 ssize_t (*buf_handle_offset)(const int handle_id); 698 ssize_t (*buf_handle_offset)(int handle_id);
699 void (*buf_request_buffer_handle)(const int handle_id); 699 void (*buf_request_buffer_handle)(int handle_id);
700 void (*buf_set_base_handle)(const int handle_id); 700 void (*buf_set_base_handle)(int handle_id);
701 size_t (*buf_used)(void); 701 size_t (*buf_used)(void);
702#endif 702#endif
703 703
diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c
index 7390318152..f33d83fb15 100644
--- a/apps/plugins/test_codec.c
+++ b/apps/plugins/test_codec.c
@@ -197,7 +197,7 @@ static void* get_codec_memory(size_t *size)
197} 197}
198 198
199/* Null output */ 199/* Null output */
200static bool pcmbuf_insert_null(const void *ch1, const void *ch2, const int count) 200static bool pcmbuf_insert_null(const void *ch1, const void *ch2, int count)
201{ 201{
202 /* Always successful - just discard data */ 202 /* Always successful - just discard data */
203 (void)ch1; 203 (void)ch1;
@@ -310,7 +310,7 @@ static bool pcmbuf_insert_wav(const void *ch1, const void *ch2, int count)
310 310
311 311
312/* Set song position in WPS (value in ms). */ 312/* Set song position in WPS (value in ms). */
313static void set_elapsed(const unsigned int value) 313static void set_elapsed(unsigned int value)
314{ 314{
315 elapsed = value; 315 elapsed = value;
316} 316}
@@ -318,7 +318,7 @@ static void set_elapsed(const unsigned int value)
318 318
319/* Read next <size> amount bytes from file buffer to <ptr>. 319/* Read next <size> amount bytes from file buffer to <ptr>.
320 Will return number of bytes read or 0 if end of file. */ 320 Will return number of bytes read or 0 if end of file. */
321static size_t read_filebuf(void *ptr, const size_t size) 321static size_t read_filebuf(void *ptr, size_t size)
322{ 322{
323 if (ci.curpos > (off_t)track.filesize) 323 if (ci.curpos > (off_t)track.filesize)
324 { 324 {
@@ -336,7 +336,7 @@ static size_t read_filebuf(void *ptr, const size_t size)
336 <realsize> amount of data. <reqsize> tells the buffer system 336 <realsize> amount of data. <reqsize> tells the buffer system
337 how much data it should try to allocate. If <realsize> is 0, 337 how much data it should try to allocate. If <realsize> is 0,
338 end of file is reached. */ 338 end of file is reached. */
339static void* request_buffer(size_t *realsize, const size_t reqsize) 339static void* request_buffer(size_t *realsize, size_t reqsize)
340{ 340{
341 *realsize = MIN(track.filesize-ci.curpos,reqsize); 341 *realsize = MIN(track.filesize-ci.curpos,reqsize);
342 342
@@ -345,7 +345,7 @@ static void* request_buffer(size_t *realsize, const size_t reqsize)
345 345
346 346
347/* Advance file buffer position by <amount> amount of bytes. */ 347/* Advance file buffer position by <amount> amount of bytes. */
348static void advance_buffer(const size_t amount) 348static void advance_buffer(size_t amount)
349{ 349{
350 ci.curpos += amount; 350 ci.curpos += amount;
351} 351}
@@ -359,7 +359,7 @@ static void advance_buffer_loc(void *ptr)
359 359
360 360
361/* Seek file buffer to position <newpos> beginning of file. */ 361/* Seek file buffer to position <newpos> beginning of file. */
362static bool seek_buffer(const size_t newpos) 362static bool seek_buffer(size_t newpos)
363{ 363{
364 ci.curpos = newpos; 364 ci.curpos = newpos;
365 return true; 365 return true;
@@ -374,7 +374,7 @@ static void seek_complete(void)
374 374
375 375
376/* Calculate mp3 seek position from given time data in ms. */ 376/* Calculate mp3 seek position from given time data in ms. */
377static off_t mp3_get_filepos(const int newtime) 377static off_t mp3_get_filepos(int newtime)
378{ 378{
379 /* We don't ask the codec to seek, so no need to implement this. */ 379 /* We don't ask the codec to seek, so no need to implement this. */
380 (void)newtime; 380 (void)newtime;
@@ -399,7 +399,7 @@ static void discard_codec(void)
399} 399}
400 400
401 401
402static void set_offset(const size_t value) 402static void set_offset(size_t value)
403{ 403{
404 /* ??? */ 404 /* ??? */
405 (void)value; 405 (void)value;
diff --git a/apps/settings.c b/apps/settings.c
index 6e1aa3eaec..56d59f419f 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -114,7 +114,7 @@ long lasttime = 0;
114#define NVRAM_FILE ROCKBOX_DIR "/nvram.bin" 114#define NVRAM_FILE ROCKBOX_DIR "/nvram.bin"
115static char nvram_buffer[NVRAM_BLOCK_SIZE]; 115static char nvram_buffer[NVRAM_BLOCK_SIZE];
116 116
117static bool read_nvram_data(char* buf, const int max_len) 117static bool read_nvram_data(char* buf, int max_len)
118{ 118{
119 unsigned crc32 = 0xffffffff; 119 unsigned crc32 = 0xffffffff;
120 int var_count = 0, i = 0, buf_pos = 0; 120 int var_count = 0, i = 0, buf_pos = 0;
@@ -164,7 +164,7 @@ static bool read_nvram_data(char* buf, const int max_len)
164 } 164 }
165 return true; 165 return true;
166} 166}
167static bool write_nvram_data(char* buf, const int max_len) 167static bool write_nvram_data(char* buf, int max_len)
168{ 168{
169 unsigned crc32 = 0xffffffff; 169 unsigned crc32 = 0xffffffff;
170 int i = 0, buf_pos = 0; 170 int i = 0, buf_pos = 0;
@@ -222,7 +222,7 @@ static bool write_nvram_data(char* buf, const int max_len)
222/* 222/*
223 * load settings from disk or RTC RAM 223 * load settings from disk or RTC RAM
224 */ 224 */
225void settings_load(const int which) 225void settings_load(int which)
226{ 226{
227 DEBUGF( "reload_all_settings()\n" ); 227 DEBUGF( "reload_all_settings()\n" );
228 if (which&SETTINGS_RTC) 228 if (which&SETTINGS_RTC)
@@ -234,7 +234,7 @@ void settings_load(const int which)
234 } 234 }
235} 235}
236 236
237static bool cfg_string_to_int(const int setting_id, int* out, const char* str) 237static bool cfg_string_to_int(int setting_id, int* out, const char* str)
238{ 238{
239 const char* start = settings[setting_id].cfg_vals; 239 const char* start = settings[setting_id].cfg_vals;
240 char* end = NULL; 240 char* end = NULL;
@@ -265,7 +265,7 @@ static bool cfg_string_to_int(const int setting_id, int* out, const char* str)
265 return false; 265 return false;
266} 266}
267 267
268bool settings_load_config(const char* file, const bool apply) 268bool settings_load_config(const char* file, bool apply)
269{ 269{
270 int fd; 270 int fd;
271 char line[128]; 271 char line[128];
@@ -363,7 +363,7 @@ bool settings_load_config(const char* file, const bool apply)
363 363
364/** Writing to a config file and saving settings **/ 364/** Writing to a config file and saving settings **/
365 365
366bool cfg_int_to_string(const int setting_id, const int val, char* buf, const int buf_len) 366bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len)
367{ 367{
368 int flags = settings[setting_id].flags; 368 int flags = settings[setting_id].flags;
369 const char* start = settings[setting_id].cfg_vals; 369 const char* start = settings[setting_id].cfg_vals;
@@ -420,7 +420,7 @@ bool cfg_int_to_string(const int setting_id, const int val, char* buf, const int
420} 420}
421 421
422 422
423static bool is_changed(const int setting_id) 423static bool is_changed(int setting_id)
424{ 424{
425 const struct settings_list *setting = &settings[setting_id]; 425 const struct settings_list *setting = &settings[setting_id];
426 switch (setting->flags&F_T_MASK) 426 switch (setting->flags&F_T_MASK)
@@ -454,7 +454,7 @@ static bool is_changed(const int setting_id)
454 return true; 454 return true;
455} 455}
456 456
457static bool settings_write_config(const char* filename, const int options) 457static bool settings_write_config(const char* filename, int options)
458{ 458{
459 int i; 459 int i;
460 int fd; 460 int fd;
@@ -609,7 +609,7 @@ int settings_save(void)
609 return 0; 609 return 0;
610} 610}
611 611
612bool settings_save_config(const int options) 612bool settings_save_config(int options)
613{ 613{
614 char filename[MAX_PATH]; 614 char filename[MAX_PATH];
615 char *folder; 615 char *folder;
@@ -719,7 +719,7 @@ void sound_settings_apply(void)
719#endif 719#endif
720} 720}
721 721
722void settings_apply(const bool read_disk) 722void settings_apply(bool read_disk)
723{ 723{
724 char buf[64]; 724 char buf[64];
725#if CONFIG_CODEC == SWCODEC 725#if CONFIG_CODEC == SWCODEC
@@ -1009,8 +1009,8 @@ bool set_bool(const char* string, const bool* variable )
1009 1009
1010 1010
1011bool set_bool_options(const char* string, const bool* variable, 1011bool set_bool_options(const char* string, const bool* variable,
1012 const char* yes_str, const int yes_voice, 1012 const char* yes_str, int yes_voice,
1013 const char* no_str, const int no_voice, 1013 const char* no_str, int no_voice,
1014 void (*function)(bool)) 1014 void (*function)(bool))
1015{ 1015{
1016 struct opt_items names[] = { 1016 struct opt_items names[] = {
@@ -1026,12 +1026,12 @@ bool set_bool_options(const char* string, const bool* variable,
1026 1026
1027bool set_int(const unsigned char* string, 1027bool set_int(const unsigned char* string,
1028 const char* unit, 1028 const char* unit,
1029 const int voice_unit, 1029 int voice_unit,
1030 const int* variable, 1030 const int* variable,
1031 void (*function)(int), 1031 void (*function)(int),
1032 const int step, 1032 int step,
1033 const int min, 1033 int min,
1034 const int max, 1034 int max,
1035 void (*formatter)(char*, size_t, int, const char*) ) 1035 void (*formatter)(char*, size_t, int, const char*) )
1036{ 1036{
1037 return set_int_ex(string, unit, voice_unit, variable, function, 1037 return set_int_ex(string, unit, voice_unit, variable, function,
@@ -1040,12 +1040,12 @@ bool set_int(const unsigned char* string,
1040 1040
1041bool set_int_ex(const unsigned char* string, 1041bool set_int_ex(const unsigned char* string,
1042 const char* unit, 1042 const char* unit,
1043 const int voice_unit, 1043 int voice_unit,
1044 const int* variable, 1044 const int* variable,
1045 void (*function)(int), 1045 void (*function)(int),
1046 const int step, 1046 int step,
1047 const int min, 1047 int min,
1048 const int max, 1048 int max,
1049 void (*formatter)(char*, size_t, int, const char*), 1049 void (*formatter)(char*, size_t, int, const char*),
1050 int32_t (*get_talk_id)(int, int)) 1050 int32_t (*get_talk_id)(int, int))
1051{ 1051{
@@ -1076,9 +1076,9 @@ static int32_t set_option_get_talk_id(int value, int unit)
1076 (void)unit; 1076 (void)unit;
1077 return set_option_options[value].voice_id; 1077 return set_option_options[value].voice_id;
1078} 1078}
1079bool set_option(const char* string, const void* variable, const enum optiontype type, 1079bool set_option(const char* string, const void* variable, enum optiontype type,
1080 const struct opt_items* options, 1080 const struct opt_items* options,
1081 const int numoptions, void (*function)(int)) 1081 int numoptions, void (*function)(int))
1082{ 1082{
1083 int temp; 1083 int temp;
1084 struct settings_list item; 1084 struct settings_list item;
@@ -1108,7 +1108,7 @@ bool set_option(const char* string, const void* variable, const enum optiontype
1108} 1108}
1109 1109
1110 1110
1111void set_file(const char* filename, char* setting, const int maxlen) 1111void set_file(const char* filename, char* setting, int maxlen)
1112{ 1112{
1113 char* fptr = strrchr(filename,'/'); 1113 char* fptr = strrchr(filename,'/');
1114 int len; 1114 int len;
diff --git a/apps/settings.h b/apps/settings.h
index 3523bca0dd..d3fd0683b7 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -195,8 +195,8 @@ extern unsigned char vp_dummy[VIRT_SIZE];
195#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */ 195#define SETTINGS_RTC 1 /* only the settings from the RTC nonvolatile RAM */
196#define SETTINGS_HD 2 /* only the settings from the disk sector */ 196#define SETTINGS_HD 2 /* only the settings from the disk sector */
197#define SETTINGS_ALL 3 /* both */ 197#define SETTINGS_ALL 3 /* both */
198void settings_load(const int which); 198void settings_load(int which);
199bool settings_load_config(const char* file, const bool apply); 199bool settings_load_config(const char* file, bool apply);
200 200
201void status_save(void); 201void status_save(void);
202int settings_save(void); 202int settings_save(void);
@@ -213,40 +213,40 @@ enum {
213 SETTINGS_SAVE_EQPRESET, 213 SETTINGS_SAVE_EQPRESET,
214#endif 214#endif
215}; 215};
216bool settings_save_config(const int options); 216bool settings_save_config(int options);
217 217
218void settings_reset(void); 218void settings_reset(void);
219void sound_settings_apply(void); 219void sound_settings_apply(void);
220void settings_apply(const bool read_disk); 220void settings_apply(bool read_disk);
221void settings_apply_pm_range(void); 221void settings_apply_pm_range(void);
222void settings_display(void); 222void settings_display(void);
223 223
224enum optiontype { INT, BOOL }; 224enum optiontype { INT, BOOL };
225 225
226const struct settings_list* find_setting(const void* variable, int *id); 226const struct settings_list* find_setting(const void* variable, int *id);
227bool cfg_int_to_string(const int setting_id, const int val, char* buf, const int buf_len); 227bool cfg_int_to_string(int setting_id, int val, char* buf, int buf_len);
228bool set_bool_options(const char* string, const bool* variable, 228bool set_bool_options(const char* string, const bool* variable,
229 const char* yes_str, const int yes_voice, 229 const char* yes_str, int yes_voice,
230 const char* no_str, const int no_voice, 230 const char* no_str, int no_voice,
231 void (*function)(bool)); 231 void (*function)(bool));
232 232
233bool set_bool(const char* string, const bool* variable); 233bool set_bool(const char* string, const bool* variable);
234bool set_int(const unsigned char* string, const char* unit, const int voice_unit, 234bool set_int(const unsigned char* string, const char* unit, int voice_unit,
235 const int* variable, 235 const int* variable,
236 void (*function)(int), const int step, const int min, const int max, 236 void (*function)(int), int step, int min, int max,
237 void (*formatter)(char*, size_t, int, const char*) ); 237 void (*formatter)(char*, size_t, int, const char*) );
238 238
239/* use this one if you need to create a lang from the value (i.e with TALK_ID()) */ 239/* use this one if you need to create a lang from the value (i.e with TALK_ID()) */
240bool set_int_ex(const unsigned char* string, const char* unit, const int voice_unit, 240bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit,
241 const int* variable, 241 const int* variable,
242 void (*function)(int), const int step, const int min, const int max, 242 void (*function)(int), int step, int min, int max,
243 void (*formatter)(char*, size_t, int, const char*), 243 void (*formatter)(char*, size_t, int, const char*),
244 int32_t (*get_talk_id)(int, int)); 244 int32_t (*get_talk_id)(int, int));
245 245
246void set_file(const char* filename, char* setting, const int maxlen); 246void set_file(const char* filename, char* setting, int maxlen);
247 247
248bool set_option(const char* string, const void* variable, const enum optiontype type, 248bool set_option(const char* string, const void* variable, enum optiontype type,
249 const struct opt_items* options, const int numoptions, void (*function)(int)); 249 const struct opt_items* options, int numoptions, void (*function)(int));
250 250
251 251
252 252
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index 49ff4c168a..5cd0d0fc9e 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -77,21 +77,21 @@ struct audio_debug
77}; 77};
78 78
79void audio_init(void); 79void audio_init(void);
80void audio_play(const long offset); 80void audio_play(long offset);
81void audio_stop(void); 81void audio_stop(void);
82void audio_pause(void); 82void audio_pause(void);
83void audio_resume(void); 83void audio_resume(void);
84void audio_next(void); 84void audio_next(void);
85void audio_prev(void); 85void audio_prev(void);
86int audio_status(void); 86int audio_status(void);
87void audio_ff_rewind(const long newtime); 87void audio_ff_rewind(long newtime);
88void audio_flush_and_reload_tracks(void); 88void audio_flush_and_reload_tracks(void);
89struct mp3entry* audio_current_track(void); 89struct mp3entry* audio_current_track(void);
90struct mp3entry* audio_next_track(void); 90struct mp3entry* audio_next_track(void);
91bool audio_has_changed_track(void); 91bool audio_has_changed_track(void);
92void audio_get_debugdata(struct audio_debug *dbgdata); 92void audio_get_debugdata(struct audio_debug *dbgdata);
93#ifndef HAVE_FLASH_STORAGE 93#ifndef HAVE_FLASH_STORAGE
94void audio_set_buffer_margin(const int seconds); 94void audio_set_buffer_margin(int seconds);
95#endif 95#endif
96unsigned int audio_error(void); 96unsigned int audio_error(void);
97void audio_error_clear(void); 97void audio_error_clear(void);
@@ -100,7 +100,7 @@ void audio_beep(int duration);
100void audio_init_playback(void); 100void audio_init_playback(void);
101 101
102/* Required call when audio buffer is required for some other purpose */ 102/* Required call when audio buffer is required for some other purpose */
103unsigned char *audio_get_buffer(const bool talk_buf, size_t *buffer_size); 103unsigned char *audio_get_buffer(bool talk_buf, size_t *buffer_size);
104/* only implemented in playback.c, but called from firmware */ 104/* only implemented in playback.c, but called from firmware */
105 105
106/* channel modes */ 106/* channel modes */
@@ -196,7 +196,7 @@ unsigned long audio_recorded_time(void);
196unsigned long audio_num_recorded_bytes(void); 196unsigned long audio_num_recorded_bytes(void);
197 197
198#if CONFIG_CODEC == SWCODEC 198#if CONFIG_CODEC == SWCODEC
199/* SWCODEC recoring functions */ 199/* SWCODEC recording functions */
200/* playback.c */ 200/* playback.c */
201bool audio_load_encoder(int afmt); 201bool audio_load_encoder(int afmt);
202void audio_remove_encoder(void); 202void audio_remove_encoder(void);
diff --git a/firmware/export/id3.h b/firmware/export/id3.h
index 0035fae19a..8b2d02ea30 100644
--- a/firmware/export/id3.h
+++ b/firmware/export/id3.h
@@ -231,7 +231,7 @@ enum {
231 231
232bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename); 232bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename);
233bool mp3info(struct mp3entry *entry, const char *filename); 233bool mp3info(struct mp3entry *entry, const char *filename);
234char* id3_get_num_genre(const unsigned int genre_num); 234char* id3_get_num_genre(unsigned int genre_num);
235char* id3_get_codec(const struct mp3entry* id3); 235char* id3_get_codec(const struct mp3entry* id3);
236int getid3v2len(int fd); 236int getid3v2len(int fd);
237void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig); 237void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig);
diff --git a/firmware/id3.c b/firmware/id3.c
index 6afe2ac304..d63acbb8aa 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -185,7 +185,7 @@ static const char* const genres[] = {
185 "Synthpop" 185 "Synthpop"
186}; 186};
187 187
188char* id3_get_num_genre(const unsigned int genre_num) 188char* id3_get_num_genre(unsigned int genre_num)
189{ 189{
190 if (genre_num < sizeof(genres)/sizeof(char*)) 190 if (genre_num < sizeof(genres)/sizeof(char*))
191 return (char*)genres[genre_num]; 191 return (char*)genres[genre_num];
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 78824cfe36..de3b347f77 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -210,7 +210,7 @@ unsigned shadow_codec_reg0;
210#endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */ 210#endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
211 211
212#ifdef HAVE_RECORDING 212#ifdef HAVE_RECORDING
213const unsigned char empty_id3_header[] = 213static const unsigned char empty_id3_header[] =
214{ 214{
215 'I', 'D', '3', 0x03, 0x00, 0x00, 215 'I', 'D', '3', 0x03, 0x00, 0x00,
216 0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */ 216 0x00, 0x00, 0x1f, 0x76 /* Size is 4096 minus 10 bytes for the header */
@@ -533,7 +533,7 @@ static void recalculate_watermark(int bitrate)
533} 533}
534 534
535#ifndef HAVE_FLASH_STORAGE 535#ifndef HAVE_FLASH_STORAGE
536void audio_set_buffer_margin(const int seconds) 536void audio_set_buffer_margin(int seconds)
537{ 537{
538 low_watermark_margin = seconds; 538 low_watermark_margin = seconds;
539} 539}
@@ -2627,7 +2627,7 @@ void audio_set_recording_options(struct audio_recording_options *options)
2627#endif /* SIMULATOR */ 2627#endif /* SIMULATOR */
2628#endif /* CONFIG_CODEC == MAS3587F */ 2628#endif /* CONFIG_CODEC == MAS3587F */
2629 2629
2630void audio_play(const long offset) 2630void audio_play(long offset)
2631{ 2631{
2632#ifdef SIMULATOR 2632#ifdef SIMULATOR
2633 char* trackname; 2633 char* trackname;
@@ -2768,7 +2768,7 @@ void audio_prev(void)
2768#endif /* SIMULATOR */ 2768#endif /* SIMULATOR */
2769} 2769}
2770 2770
2771void audio_ff_rewind(const long newtime) 2771void audio_ff_rewind(long newtime)
2772{ 2772{
2773#ifndef SIMULATOR 2773#ifndef SIMULATOR
2774 queue_post(&mpeg_queue, MPEG_FF_REWIND, newtime); 2774 queue_post(&mpeg_queue, MPEG_FF_REWIND, newtime);
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index 81f3697802..c40d10082c 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -33,7 +33,7 @@
33extern char having_new_lcd; 33extern char having_new_lcd;
34 34
35#if CONFIG_CODEC != SWCODEC 35#if CONFIG_CODEC != SWCODEC
36void audio_set_buffer_margin(const int seconds) 36void audio_set_buffer_margin(int seconds)
37{ 37{
38 (void)seconds; 38 (void)seconds;
39} 39}