diff options
-rw-r--r-- | apps/buffering.c | 74 | ||||
-rw-r--r-- | apps/buffering.h | 34 | ||||
-rw-r--r-- | apps/plugin.h | 32 | ||||
-rw-r--r-- | firmware/export/id3.h | 4 | ||||
-rw-r--r-- | firmware/id3.c | 4 |
5 files changed, 75 insertions, 73 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 0cb428c947..d49669777b 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -182,7 +182,7 @@ enum { | |||
182 | }; | 182 | }; |
183 | 183 | ||
184 | /* Buffering thread */ | 184 | /* Buffering thread */ |
185 | void buffering_thread(void); | 185 | static void buffering_thread(void); |
186 | static long buffering_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)]; | 186 | static long buffering_stack[(DEFAULT_STACK_SIZE + 0x2000)/sizeof(long)]; |
187 | static const char buffering_thread_name[] = "buffering"; | 187 | static const char buffering_thread_name[] = "buffering"; |
188 | static struct thread_entry *buffering_thread_p; | 188 | static struct thread_entry *buffering_thread_p; |
@@ -190,7 +190,7 @@ static struct event_queue buffering_queue; | |||
190 | static struct queue_sender_list buffering_queue_sender_list; | 190 | static struct queue_sender_list buffering_queue_sender_list; |
191 | 191 | ||
192 | 192 | ||
193 | static void call_buffering_callbacks(enum callback_event ev, int value); | 193 | static void call_buffering_callbacks(const enum callback_event ev, const int value); |
194 | 194 | ||
195 | 195 | ||
196 | /* | 196 | /* |
@@ -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. */ |
409 | static bool move_handle(struct memory_handle **h, size_t *delta, | 409 | static bool move_handle(struct memory_handle **h, size_t *delta, |
410 | const size_t data_size, bool can_wrap) | 410 | const size_t data_size, const 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; |
@@ -492,7 +492,7 @@ static bool move_handle(struct memory_handle **h, size_t *delta, | |||
492 | if (overlap > 0) { | 492 | if (overlap > 0) { |
493 | size_t first_part = size_to_move - overlap; | 493 | size_t first_part = size_to_move - overlap; |
494 | memmove(dest, src, first_part); | 494 | memmove(dest, src, first_part); |
495 | memmove(buffer, (char *)src + first_part, overlap); | 495 | memmove(buffer, (const char *)src + first_part, overlap); |
496 | } else { | 496 | } else { |
497 | memmove(dest, src, size_to_move); | 497 | memmove(dest, src, size_to_move); |
498 | } | 498 | } |
@@ -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. */ |
562 | static bool buffer_handle(int handle_id) | 562 | static bool buffer_handle(const 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(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. */ |
670 | static void reset_handle(int handle_id) | 670 | static void reset_handle(const 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(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. */ |
690 | static void rebuffer_handle(int handle_id, size_t newpos) | 690 | static void rebuffer_handle(const int handle_id, const 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(int handle_id, size_t newpos) | |||
725 | h->ridx = h->data; | 725 | h->ridx = h->data; |
726 | } | 726 | } |
727 | 727 | ||
728 | static bool close_handle(int handle_id) | 728 | static bool close_handle(const 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 | ||
@@ -774,7 +774,7 @@ static void shrink_handle(struct memory_handle *h) | |||
774 | /* when moving an mp3entry we need to readjust its pointers. */ | 774 | /* when moving an mp3entry we need to readjust its pointers. */ |
775 | adjust_mp3entry((struct mp3entry *)&buffer[h->data], | 775 | adjust_mp3entry((struct mp3entry *)&buffer[h->data], |
776 | (void *)&buffer[h->data], | 776 | (void *)&buffer[h->data], |
777 | (void *)&buffer[olddata]); | 777 | (const void *)&buffer[olddata]); |
778 | } else if (h->type == TYPE_BITMAP) { | 778 | } else if (h->type == TYPE_BITMAP) { |
779 | /* adjust the bitmap's pointer */ | 779 | /* adjust the bitmap's pointer */ |
780 | struct bitmap *bmp = (struct bitmap *)&buffer[h->data]; | 780 | struct bitmap *bmp = (struct bitmap *)&buffer[h->data]; |
@@ -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 | */ |
876 | int bufopen(const char *file, size_t offset, enum data_type type) | 876 | int bufopen(const char *file, size_t offset, const enum data_type type) |
877 | { | 877 | { |
878 | int fd = open(file, O_RDONLY); | 878 | int fd = open(file, O_RDONLY); |
879 | if (fd < 0) | 879 | if (fd < 0) |
@@ -955,7 +955,7 @@ int bufopen(const char *file, size_t offset, enum data_type type) | |||
955 | requested amount of data can entirely fit in the buffer without wrapping. | 955 | requested amount of data can entirely fit in the buffer without wrapping. |
956 | Return value is the handle id for success or <0 for failure. | 956 | Return value is the handle id for success or <0 for failure. |
957 | */ | 957 | */ |
958 | int bufalloc(const void *src, size_t size, enum data_type type) | 958 | int bufalloc(const void *src, const size_t size, const enum data_type type) |
959 | { | 959 | { |
960 | struct memory_handle *h = add_handle(size, false, true); | 960 | struct memory_handle *h = add_handle(size, false, true); |
961 | 961 | ||
@@ -966,7 +966,7 @@ int bufalloc(const void *src, size_t size, enum data_type type) | |||
966 | if (type == TYPE_ID3 && size == sizeof(struct mp3entry)) { | 966 | if (type == TYPE_ID3 && size == sizeof(struct mp3entry)) { |
967 | /* specially take care of struct mp3entry */ | 967 | /* specially take care of struct mp3entry */ |
968 | copy_mp3entry((struct mp3entry *)&buffer[buf_widx], | 968 | copy_mp3entry((struct mp3entry *)&buffer[buf_widx], |
969 | (struct mp3entry *)src); | 969 | (const struct mp3entry *)src); |
970 | } else { | 970 | } else { |
971 | memcpy(&buffer[buf_widx], src, size); | 971 | memcpy(&buffer[buf_widx], src, size); |
972 | } | 972 | } |
@@ -990,7 +990,7 @@ int bufalloc(const void *src, size_t size, enum data_type type) | |||
990 | } | 990 | } |
991 | 991 | ||
992 | /* Close the handle. Return true for success and false for failure */ | 992 | /* Close the handle. Return true for success and false for failure */ |
993 | bool bufclose(int handle_id) | 993 | bool bufclose(const int handle_id) |
994 | { | 994 | { |
995 | logf("bufclose(%d)", handle_id); | 995 | logf("bufclose(%d)", handle_id); |
996 | 996 | ||
@@ -1004,7 +1004,7 @@ bool bufclose(int handle_id) | |||
1004 | -1 if the handle wasn't found | 1004 | -1 if the handle wasn't found |
1005 | -2 if the new requested position was beyond the end of the file | 1005 | -2 if the new requested position was beyond the end of the file |
1006 | */ | 1006 | */ |
1007 | int bufseek(int handle_id, size_t newpos) | 1007 | int bufseek(const int handle_id, const size_t newpos) |
1008 | { | 1008 | { |
1009 | struct memory_handle *h = find_handle(handle_id); | 1009 | struct memory_handle *h = find_handle(handle_id); |
1010 | if (!h) | 1010 | if (!h) |
@@ -1026,7 +1026,7 @@ int bufseek(int handle_id, size_t newpos) | |||
1026 | 1026 | ||
1027 | /* Advance the reading index in a handle (relatively to its current position). | 1027 | /* Advance the reading index in a handle (relatively to its current position). |
1028 | Return 0 for success and < 0 for failure */ | 1028 | Return 0 for success and < 0 for failure */ |
1029 | int bufadvance(int handle_id, off_t offset) | 1029 | int bufadvance(const int handle_id, const off_t offset) |
1030 | { | 1030 | { |
1031 | const struct memory_handle *h = find_handle(handle_id); | 1031 | const struct memory_handle *h = find_handle(handle_id); |
1032 | if (!h) | 1032 | if (!h) |
@@ -1094,7 +1094,7 @@ static struct memory_handle *prep_bufdata(const int handle_id, size_t *size, | |||
1094 | Return the number of bytes copied or < 0 for failure (handle not found). | 1094 | Return the number of bytes copied or < 0 for failure (handle not found). |
1095 | The caller is blocked until the requested amount of data is available. | 1095 | The caller is blocked until the requested amount of data is available. |
1096 | */ | 1096 | */ |
1097 | ssize_t bufread(int handle_id, size_t size, void *dest) | 1097 | ssize_t bufread(const int handle_id, size_t size, void *dest) |
1098 | { | 1098 | { |
1099 | const struct memory_handle *h; | 1099 | const struct memory_handle *h; |
1100 | 1100 | ||
@@ -1126,7 +1126,7 @@ ssize_t bufread(int handle_id, size_t size, void *dest) | |||
1126 | The guard buffer may be used to provide the requested size. This means it's | 1126 | The guard buffer may be used to provide the requested size. This means it's |
1127 | unsafe to request more than the size of the guard buffer. | 1127 | unsafe to request more than the size of the guard buffer. |
1128 | */ | 1128 | */ |
1129 | ssize_t bufgetdata(int handle_id, size_t size, void **data) | 1129 | ssize_t bufgetdata(const int handle_id, size_t size, void **data) |
1130 | { | 1130 | { |
1131 | const struct memory_handle *h; | 1131 | const struct memory_handle *h; |
1132 | 1132 | ||
@@ -1141,7 +1141,7 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data) | |||
1141 | size_t copy_n = h->ridx + size - buffer_len; | 1141 | size_t copy_n = h->ridx + size - buffer_len; |
1142 | /* prep_bufdata ensures size <= buffer_len - h->ridx + GUARD_BUFSIZE, | 1142 | /* prep_bufdata ensures size <= buffer_len - h->ridx + GUARD_BUFSIZE, |
1143 | so copy_n <= GUARD_BUFSIZE */ | 1143 | so copy_n <= GUARD_BUFSIZE */ |
1144 | memcpy(guard_buffer, (unsigned char *)buffer, copy_n); | 1144 | memcpy(guard_buffer, (const unsigned char *)buffer, copy_n); |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | if (data) | 1147 | if (data) |
@@ -1150,7 +1150,7 @@ ssize_t bufgetdata(int handle_id, size_t size, void **data) | |||
1150 | return size; | 1150 | return size; |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | ssize_t bufgettail(int handle_id, size_t size, void **data) | 1153 | ssize_t bufgettail(const int handle_id, const size_t size, void **data) |
1154 | { | 1154 | { |
1155 | size_t tidx; | 1155 | size_t tidx; |
1156 | 1156 | ||
@@ -1173,14 +1173,14 @@ ssize_t bufgettail(int handle_id, size_t size, void **data) | |||
1173 | if (tidx + size > buffer_len) | 1173 | if (tidx + size > buffer_len) |
1174 | { | 1174 | { |
1175 | size_t copy_n = tidx + size - buffer_len; | 1175 | size_t copy_n = tidx + size - buffer_len; |
1176 | memcpy(guard_buffer, (unsigned char *)buffer, copy_n); | 1176 | memcpy(guard_buffer, (const unsigned char *)buffer, copy_n); |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | *data = &buffer[tidx]; | 1179 | *data = &buffer[tidx]; |
1180 | return size; | 1180 | return size; |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | ssize_t bufcuttail(int handle_id, size_t size) | 1183 | ssize_t bufcuttail(const int handle_id, size_t size) |
1184 | { | 1184 | { |
1185 | struct memory_handle *h; | 1185 | struct memory_handle *h; |
1186 | 1186 | ||
@@ -1198,9 +1198,9 @@ ssize_t bufcuttail(int handle_id, size_t size) | |||
1198 | h->available -= size; | 1198 | h->available -= size; |
1199 | h->filesize -= size; | 1199 | h->filesize -= size; |
1200 | h->widx = RINGBUF_SUB(h->widx, size); | 1200 | h->widx = RINGBUF_SUB(h->widx, size); |
1201 | if (h == cur_handle) { | 1201 | if (h == cur_handle) |
1202 | buf_widx = h->widx; | 1202 | buf_widx = h->widx; |
1203 | } | 1203 | |
1204 | return size; | 1204 | return size; |
1205 | } | 1205 | } |
1206 | 1206 | ||
@@ -1223,7 +1223,7 @@ management functions for all the actual handle management work. | |||
1223 | */ | 1223 | */ |
1224 | 1224 | ||
1225 | /* Get a handle offset from a pointer */ | 1225 | /* Get a handle offset from a pointer */ |
1226 | ssize_t buf_get_offset(int handle_id, void *ptr) | 1226 | ssize_t buf_get_offset(const int handle_id, void *ptr) |
1227 | { | 1227 | { |
1228 | const struct memory_handle *h = find_handle(handle_id); | 1228 | const struct memory_handle *h = find_handle(handle_id); |
1229 | if (!h) | 1229 | if (!h) |
@@ -1232,7 +1232,7 @@ ssize_t buf_get_offset(int handle_id, void *ptr) | |||
1232 | return (size_t)ptr - (size_t)&buffer[h->ridx]; | 1232 | return (size_t)ptr - (size_t)&buffer[h->ridx]; |
1233 | } | 1233 | } |
1234 | 1234 | ||
1235 | ssize_t buf_handle_offset(int handle_id) | 1235 | ssize_t buf_handle_offset(const int handle_id) |
1236 | { | 1236 | { |
1237 | const struct memory_handle *h = find_handle(handle_id); | 1237 | const struct memory_handle *h = find_handle(handle_id); |
1238 | if (!h) | 1238 | if (!h) |
@@ -1240,13 +1240,13 @@ ssize_t buf_handle_offset(int handle_id) | |||
1240 | return h->offset; | 1240 | return h->offset; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | void buf_request_buffer_handle(int handle_id) | 1243 | void buf_request_buffer_handle(const int handle_id) |
1244 | { | 1244 | { |
1245 | LOGFQUEUE("buffering >| Q_START_FILL %d",handle_id); | 1245 | LOGFQUEUE("buffering >| Q_START_FILL %d",handle_id); |
1246 | queue_send(&buffering_queue, Q_START_FILL, handle_id); | 1246 | queue_send(&buffering_queue, Q_START_FILL, handle_id); |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | void buf_set_base_handle(int handle_id) | 1249 | void buf_set_base_handle(const int handle_id) |
1250 | { | 1250 | { |
1251 | LOGFQUEUE("buffering > Q_BASE_HANDLE %d", handle_id); | 1251 | LOGFQUEUE("buffering > Q_BASE_HANDLE %d", handle_id); |
1252 | queue_post(&buffering_queue, Q_BASE_HANDLE, handle_id); | 1252 | queue_post(&buffering_queue, Q_BASE_HANDLE, handle_id); |
@@ -1258,13 +1258,13 @@ size_t buf_used(void) | |||
1258 | return BUF_USED; | 1258 | return BUF_USED; |
1259 | } | 1259 | } |
1260 | 1260 | ||
1261 | void buf_set_watermark(size_t bytes) | 1261 | void buf_set_watermark(const size_t bytes) |
1262 | { | 1262 | { |
1263 | LOGFQUEUE("buffering > Q_SET_WATERMARK %ld", (long)bytes); | 1263 | LOGFQUEUE("buffering > Q_SET_WATERMARK %ld", (long)bytes); |
1264 | queue_post(&buffering_queue, Q_SET_WATERMARK, bytes); | 1264 | queue_post(&buffering_queue, Q_SET_WATERMARK, bytes); |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | bool register_buffering_callback(buffering_callback func) | 1267 | bool register_buffering_callback(const buffering_callback func) |
1268 | { | 1268 | { |
1269 | int i; | 1269 | int i; |
1270 | if (buffer_callback_count >= MAX_BUF_CALLBACKS) | 1270 | if (buffer_callback_count >= MAX_BUF_CALLBACKS) |
@@ -1283,7 +1283,7 @@ bool register_buffering_callback(buffering_callback func) | |||
1283 | return false; | 1283 | return false; |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | void unregister_buffering_callback(buffering_callback func) | 1286 | void unregister_buffering_callback(const buffering_callback func) |
1287 | { | 1287 | { |
1288 | int i; | 1288 | int i; |
1289 | for (i = 0; i < MAX_BUF_CALLBACKS; i++) | 1289 | for (i = 0; i < MAX_BUF_CALLBACKS; i++) |
@@ -1297,7 +1297,7 @@ void unregister_buffering_callback(buffering_callback func) | |||
1297 | return; | 1297 | return; |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | static void call_buffering_callbacks(enum callback_event ev, int value) | 1300 | static void call_buffering_callbacks(const enum callback_event ev, const int value) |
1301 | { | 1301 | { |
1302 | logf("call_buffering_callbacks()"); | 1302 | logf("call_buffering_callbacks()"); |
1303 | int i; | 1303 | int i; |
@@ -1310,8 +1310,8 @@ static void call_buffering_callbacks(enum callback_event ev, int value) | |||
1310 | } | 1310 | } |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | static void shrink_buffer_inner(struct memory_handle *h) { | 1313 | static void shrink_buffer_inner(struct memory_handle *h) |
1314 | 1314 | { | |
1315 | if (h == NULL) | 1315 | if (h == NULL) |
1316 | return; | 1316 | return; |
1317 | 1317 | ||
@@ -1320,7 +1320,8 @@ static void shrink_buffer_inner(struct memory_handle *h) { | |||
1320 | shrink_handle(h); | 1320 | shrink_handle(h); |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | static void shrink_buffer(void) { | 1323 | static void shrink_buffer(void) |
1324 | { | ||
1324 | logf("shrink_buffer()"); | 1325 | logf("shrink_buffer()"); |
1325 | shrink_buffer_inner(first_handle); | 1326 | shrink_buffer_inner(first_handle); |
1326 | } | 1327 | } |
@@ -1444,7 +1445,8 @@ void buffering_thread(void) | |||
1444 | } | 1445 | } |
1445 | } | 1446 | } |
1446 | 1447 | ||
1447 | void buffering_init(void) { | 1448 | void buffering_init(void) |
1449 | { | ||
1448 | mutex_init(&llist_mutex); | 1450 | mutex_init(&llist_mutex); |
1449 | #ifdef HAVE_PRIORITY_SCHEDULING | 1451 | #ifdef HAVE_PRIORITY_SCHEDULING |
1450 | /* This behavior not safe atm */ | 1452 | /* This behavior not safe atm */ |
@@ -1464,7 +1466,7 @@ void buffering_init(void) { | |||
1464 | } | 1466 | } |
1465 | 1467 | ||
1466 | /* Initialise the buffering subsystem */ | 1468 | /* Initialise the buffering subsystem */ |
1467 | bool buffering_reset(char *buf, size_t buflen) | 1469 | bool buffering_reset(char *buf, const size_t buflen) |
1468 | { | 1470 | { |
1469 | if (!buf || !buflen) | 1471 | if (!buf || !buflen) |
1470 | return false; | 1472 | return false; |
diff --git a/apps/buffering.h b/apps/buffering.h index bc61ec5e6d..abe8f608c6 100644 --- a/apps/buffering.h +++ b/apps/buffering.h | |||
@@ -56,7 +56,7 @@ enum callback_event { | |||
56 | void buffering_init(void); | 56 | void buffering_init(void); |
57 | 57 | ||
58 | /* Reset the buffering system */ | 58 | /* Reset the buffering system */ |
59 | bool buffering_reset(char *buf, size_t buflen); | 59 | bool buffering_reset(char *buf, const size_t buflen); |
60 | 60 | ||
61 | 61 | ||
62 | /*************************************************************************** | 62 | /*************************************************************************** |
@@ -80,15 +80,15 @@ bool buffering_reset(char *buf, size_t buflen); | |||
80 | 80 | ||
81 | #define BUF_MAX_HANDLES 256 | 81 | #define BUF_MAX_HANDLES 256 |
82 | 82 | ||
83 | int bufopen(const char *file, size_t offset, enum data_type type); | 83 | int bufopen(const char *file, size_t offset, const enum data_type type); |
84 | int bufalloc(const void *src, size_t size, enum data_type type); | 84 | int bufalloc(const void *src, const size_t size, const enum data_type type); |
85 | bool bufclose(int handle_id); | 85 | bool bufclose(const int handle_id); |
86 | int bufseek(int handle_id, size_t newpos); | 86 | int bufseek(const int handle_id, const size_t newpos); |
87 | int bufadvance(int handle_id, off_t offset); | 87 | int bufadvance(const int handle_id, const off_t offset); |
88 | ssize_t bufread(int handle_id, size_t size, void *dest); | 88 | ssize_t bufread(const int handle_id, size_t size, void *dest); |
89 | ssize_t bufgetdata(int handle_id, size_t size, void **data); | 89 | ssize_t bufgetdata(const int handle_id, size_t size, void **data); |
90 | ssize_t bufgettail(int handle_id, size_t size, void **data); | 90 | ssize_t bufgettail(const int handle_id, const size_t size, void **data); |
91 | ssize_t bufcuttail(int handle_id, size_t size); | 91 | ssize_t bufcuttail(const int handle_id, size_t size); |
92 | 92 | ||
93 | 93 | ||
94 | /*************************************************************************** | 94 | /*************************************************************************** |
@@ -102,10 +102,10 @@ ssize_t bufcuttail(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 | ||
105 | ssize_t buf_get_offset(int handle_id, void *ptr); | 105 | ssize_t buf_get_offset(const int handle_id, void *ptr); |
106 | ssize_t buf_handle_offset(int handle_id); | 106 | ssize_t buf_handle_offset(const int handle_id); |
107 | void buf_request_buffer_handle(int handle_id); | 107 | void buf_request_buffer_handle(const int handle_id); |
108 | void buf_set_base_handle(int handle_id); | 108 | void buf_set_base_handle(const int handle_id); |
109 | size_t buf_used(void); | 109 | size_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 |
126 | typedef void (*buffering_callback)(enum callback_event ev, int value); | 126 | typedef void (*buffering_callback)(const enum callback_event ev, const int value); |
127 | bool register_buffering_callback(buffering_callback func); | 127 | bool register_buffering_callback(const buffering_callback func); |
128 | void unregister_buffering_callback(buffering_callback func); | 128 | void unregister_buffering_callback(const buffering_callback func); |
129 | 129 | ||
130 | /* Settings */ | 130 | /* Settings */ |
131 | enum { | 131 | enum { |
diff --git a/apps/plugin.h b/apps/plugin.h index 66ed5fdbb2..27fcffb69c 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -120,12 +120,12 @@ | |||
120 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 120 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
121 | 121 | ||
122 | /* increase this every time the api struct changes */ | 122 | /* increase this every time the api struct changes */ |
123 | #define PLUGIN_API_VERSION 103 | 123 | #define PLUGIN_API_VERSION 104 |
124 | 124 | ||
125 | /* update this to latest version if a change to the api struct breaks | 125 | /* update this to latest version if a change to the api struct breaks |
126 | backwards compatibility (and please take the opportunity to sort in any | 126 | backwards compatibility (and please take the opportunity to sort in any |
127 | new function which are "waiting" at the end of the function table) */ | 127 | new function which are "waiting" at the end of the function table) */ |
128 | #define PLUGIN_MIN_API_VERSION 103 | 128 | #define PLUGIN_MIN_API_VERSION 104 |
129 | 129 | ||
130 | /* plugin return codes */ | 130 | /* plugin return codes */ |
131 | enum plugin_status { | 131 | enum plugin_status { |
@@ -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, enum data_type type); | 687 | int (*bufopen)(const char *file, size_t offset, const enum data_type type); |
688 | int (*bufalloc)(const void *src, size_t size, enum data_type type); | 688 | int (*bufalloc)(const void *src, const size_t size, const enum data_type type); |
689 | bool (*bufclose)(int handle_id); | 689 | bool (*bufclose)(const int handle_id); |
690 | int (*bufseek)(int handle_id, size_t newpos); | 690 | int (*bufseek)(const int handle_id, const size_t newpos); |
691 | int (*bufadvance)(int handle_id, off_t offset); | 691 | int (*bufadvance)(const int handle_id, const off_t offset); |
692 | ssize_t (*bufread)(int handle_id, size_t size, void *dest); | 692 | ssize_t (*bufread)(const int handle_id, size_t size, void *dest); |
693 | ssize_t (*bufgetdata)(int handle_id, size_t size, void **data); | 693 | ssize_t (*bufgetdata)(const int handle_id, size_t size, void **data); |
694 | ssize_t (*bufgettail)(int handle_id, size_t size, void **data); | 694 | ssize_t (*bufgettail)(const int handle_id, const size_t size, void **data); |
695 | ssize_t (*bufcuttail)(int handle_id, size_t size); | 695 | ssize_t (*bufcuttail)(const int handle_id, size_t size); |
696 | 696 | ||
697 | ssize_t (*buf_get_offset)(int handle_id, void *ptr); | 697 | ssize_t (*buf_get_offset)(const int handle_id, void *ptr); |
698 | ssize_t (*buf_handle_offset)(int handle_id); | 698 | ssize_t (*buf_handle_offset)(const int handle_id); |
699 | void (*buf_request_buffer_handle)(int handle_id); | 699 | void (*buf_request_buffer_handle)(const int handle_id); |
700 | void (*buf_set_base_handle)(int handle_id); | 700 | void (*buf_set_base_handle)(const int handle_id); |
701 | size_t (*buf_used)(void); | 701 | size_t (*buf_used)(void); |
702 | #endif | 702 | #endif |
703 | 703 | ||
diff --git a/firmware/export/id3.h b/firmware/export/id3.h index bb3b6a6fe5..0035fae19a 100644 --- a/firmware/export/id3.h +++ b/firmware/export/id3.h | |||
@@ -234,7 +234,7 @@ bool mp3info(struct mp3entry *entry, const char *filename); | |||
234 | char* id3_get_num_genre(const unsigned int genre_num); | 234 | char* id3_get_num_genre(const unsigned int genre_num); |
235 | char* id3_get_codec(const struct mp3entry* id3); | 235 | char* id3_get_codec(const struct mp3entry* id3); |
236 | int getid3v2len(int fd); | 236 | int getid3v2len(int fd); |
237 | void adjust_mp3entry(struct mp3entry *entry, void *dest, void *orig); | 237 | void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig); |
238 | void copy_mp3entry(struct mp3entry *dest, struct mp3entry *orig); | 238 | void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig); |
239 | 239 | ||
240 | #endif | 240 | #endif |
diff --git a/firmware/id3.c b/firmware/id3.c index f594528910..6afe2ac304 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -1231,7 +1231,7 @@ bool mp3info(struct mp3entry *entry, const char *filename) | |||
1231 | return result; | 1231 | return result; |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | void adjust_mp3entry(struct mp3entry *entry, void *dest, void *orig) | 1234 | void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig) |
1235 | { | 1235 | { |
1236 | long offset; | 1236 | long offset; |
1237 | if (orig > dest) | 1237 | if (orig > dest) |
@@ -1270,7 +1270,7 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, void *orig) | |||
1270 | #endif | 1270 | #endif |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | void copy_mp3entry(struct mp3entry *dest, struct mp3entry *orig) | 1273 | void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig) |
1274 | { | 1274 | { |
1275 | memcpy(dest, orig, sizeof(struct mp3entry)); | 1275 | memcpy(dest, orig, sizeof(struct mp3entry)); |
1276 | adjust_mp3entry(dest, dest, orig); | 1276 | adjust_mp3entry(dest, dest, orig); |