diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/buffering.c | 11 | ||||
-rw-r--r-- | apps/buffering.h | 2 | ||||
-rw-r--r-- | apps/codec_thread.c | 7 | ||||
-rw-r--r-- | apps/codecs.c | 1 | ||||
-rw-r--r-- | apps/codecs.h | 6 | ||||
-rw-r--r-- | apps/codecs/mpa.c | 12 | ||||
-rw-r--r-- | apps/plugin.c | 3 | ||||
-rw-r--r-- | apps/plugin.h | 7 |
8 files changed, 12 insertions, 37 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 0cd81df93a..f70400a1ee 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -1444,7 +1444,6 @@ ssize_t bufcuttail(int handle_id, size_t size) | |||
1444 | SECONDARY EXPORTED FUNCTIONS | 1444 | SECONDARY EXPORTED FUNCTIONS |
1445 | ============================ | 1445 | ============================ |
1446 | 1446 | ||
1447 | buf_get_offset | ||
1448 | buf_handle_offset | 1447 | buf_handle_offset |
1449 | buf_request_buffer_handle | 1448 | buf_request_buffer_handle |
1450 | buf_set_base_handle | 1449 | buf_set_base_handle |
@@ -1457,16 +1456,6 @@ They take care of the content of the structs, and rely on the linked list | |||
1457 | management functions for all the actual handle management work. | 1456 | management functions for all the actual handle management work. |
1458 | */ | 1457 | */ |
1459 | 1458 | ||
1460 | /* Get a handle offset from a pointer */ | ||
1461 | ssize_t buf_get_offset(int handle_id, void *ptr) | ||
1462 | { | ||
1463 | const struct memory_handle *h = find_handle(handle_id); | ||
1464 | if (!h) | ||
1465 | return ERR_HANDLE_NOT_FOUND; | ||
1466 | |||
1467 | return (size_t)ptr - (size_t)&buffer[h->ridx]; | ||
1468 | } | ||
1469 | |||
1470 | ssize_t buf_handle_offset(int handle_id) | 1459 | ssize_t buf_handle_offset(int handle_id) |
1471 | { | 1460 | { |
1472 | const struct memory_handle *h = find_handle(handle_id); | 1461 | const struct memory_handle *h = find_handle(handle_id); |
diff --git a/apps/buffering.h b/apps/buffering.h index c3a9f928d1..34d6d641c7 100644 --- a/apps/buffering.h +++ b/apps/buffering.h | |||
@@ -91,14 +91,12 @@ ssize_t bufcuttail(int handle_id, size_t size); | |||
91 | * SECONDARY FUNCTIONS | 91 | * SECONDARY FUNCTIONS |
92 | * =================== | 92 | * =================== |
93 | * | 93 | * |
94 | * buf_get_offset: Get a handle offset from a pointer | ||
95 | * buf_handle_offset: Get the offset of the first buffered byte from the file | 94 | * buf_handle_offset: Get the offset of the first buffered byte from the file |
96 | * buf_request_buffer_handle: Request buffering of a handle | 95 | * buf_request_buffer_handle: Request buffering of a handle |
97 | * buf_set_base_handle: Tell the buffering thread which handle is currently read | 96 | * buf_set_base_handle: Tell the buffering thread which handle is currently read |
98 | * buf_used: Total amount of buffer space used (including allocated space) | 97 | * buf_used: Total amount of buffer space used (including allocated space) |
99 | ****************************************************************************/ | 98 | ****************************************************************************/ |
100 | 99 | ||
101 | ssize_t buf_get_offset(int handle_id, void *ptr); | ||
102 | ssize_t buf_handle_offset(int handle_id); | 100 | ssize_t buf_handle_offset(int handle_id); |
103 | void buf_request_buffer_handle(int handle_id); | 101 | void buf_request_buffer_handle(int handle_id); |
104 | void buf_set_base_handle(int handle_id); | 102 | void buf_set_base_handle(int handle_id); |
diff --git a/apps/codec_thread.c b/apps/codec_thread.c index 9b17d7cf42..65a7ebc7d5 100644 --- a/apps/codec_thread.c +++ b/apps/codec_thread.c | |||
@@ -337,12 +337,6 @@ static void codec_advance_buffer_callback(size_t amount) | |||
337 | codec_set_offset_callback(ci.curpos); | 337 | codec_set_offset_callback(ci.curpos); |
338 | } | 338 | } |
339 | 339 | ||
340 | static void codec_advance_buffer_loc_callback(void *ptr) | ||
341 | { | ||
342 | size_t amount = buf_get_offset(get_audio_hid(), ptr); | ||
343 | codec_advance_buffer_callback(amount); | ||
344 | } | ||
345 | |||
346 | static bool codec_seek_buffer_callback(size_t newpos) | 340 | static bool codec_seek_buffer_callback(size_t newpos) |
347 | { | 341 | { |
348 | logf("codec_seek_buffer_callback"); | 342 | logf("codec_seek_buffer_callback"); |
@@ -443,7 +437,6 @@ void codec_init_codec_api(void) | |||
443 | ci.read_filebuf = codec_filebuf_callback; | 437 | ci.read_filebuf = codec_filebuf_callback; |
444 | ci.request_buffer = codec_request_buffer_callback; | 438 | ci.request_buffer = codec_request_buffer_callback; |
445 | ci.advance_buffer = codec_advance_buffer_callback; | 439 | ci.advance_buffer = codec_advance_buffer_callback; |
446 | ci.advance_buffer_loc = codec_advance_buffer_loc_callback; | ||
447 | ci.seek_buffer = codec_seek_buffer_callback; | 440 | ci.seek_buffer = codec_seek_buffer_callback; |
448 | ci.seek_complete = codec_seek_complete_callback; | 441 | ci.seek_complete = codec_seek_complete_callback; |
449 | ci.request_next_track = codec_request_next_track_callback; | 442 | ci.request_next_track = codec_request_next_track_callback; |
diff --git a/apps/codecs.c b/apps/codecs.c index c9f612b3f4..28e8c2a1c0 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -93,7 +93,6 @@ struct codec_api ci = { | |||
93 | NULL, /* read_filebuf */ | 93 | NULL, /* read_filebuf */ |
94 | NULL, /* request_buffer */ | 94 | NULL, /* request_buffer */ |
95 | NULL, /* advance_buffer */ | 95 | NULL, /* advance_buffer */ |
96 | NULL, /* advance_buffer_loc */ | ||
97 | NULL, /* seek_buffer */ | 96 | NULL, /* seek_buffer */ |
98 | NULL, /* seek_complete */ | 97 | NULL, /* seek_complete */ |
99 | NULL, /* request_next_track */ | 98 | NULL, /* request_next_track */ |
diff --git a/apps/codecs.h b/apps/codecs.h index 028e3614ff..daf2c8694e 100644 --- a/apps/codecs.h +++ b/apps/codecs.h | |||
@@ -75,12 +75,12 @@ | |||
75 | #define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ | 75 | #define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ |
76 | 76 | ||
77 | /* increase this every time the api struct changes */ | 77 | /* increase this every time the api struct changes */ |
78 | #define CODEC_API_VERSION 39 | 78 | #define CODEC_API_VERSION 40 |
79 | 79 | ||
80 | /* update this to latest version if a change to the api struct breaks | 80 | /* update this to latest version if a change to the api struct breaks |
81 | backwards compatibility (and please take the opportunity to sort in any | 81 | backwards compatibility (and please take the opportunity to sort in any |
82 | new function which are "waiting" at the end of the function table) */ | 82 | new function which are "waiting" at the end of the function table) */ |
83 | #define CODEC_MIN_API_VERSION 39 | 83 | #define CODEC_MIN_API_VERSION 40 |
84 | 84 | ||
85 | /* codec return codes */ | 85 | /* codec return codes */ |
86 | enum codec_status { | 86 | enum codec_status { |
@@ -134,8 +134,6 @@ struct codec_api { | |||
134 | void* (*request_buffer)(size_t *realsize, size_t reqsize); | 134 | void* (*request_buffer)(size_t *realsize, size_t reqsize); |
135 | /* Advance file buffer position by <amount> amount of bytes. */ | 135 | /* Advance file buffer position by <amount> amount of bytes. */ |
136 | void (*advance_buffer)(size_t amount); | 136 | void (*advance_buffer)(size_t amount); |
137 | /* Advance file buffer to a pointer location inside file buffer. */ | ||
138 | void (*advance_buffer_loc)(void *ptr); | ||
139 | /* Seek file buffer to position <newpos> beginning of file. */ | 137 | /* Seek file buffer to position <newpos> beginning of file. */ |
140 | bool (*seek_buffer)(size_t newpos); | 138 | bool (*seek_buffer)(size_t newpos); |
141 | /* Codec should call this function when it has done the seeking. */ | 139 | /* Codec should call this function when it has done the seeking. */ |
diff --git a/apps/codecs/mpa.c b/apps/codecs/mpa.c index 4d6c52f2b3..4b49775029 100644 --- a/apps/codecs/mpa.c +++ b/apps/codecs/mpa.c | |||
@@ -424,24 +424,22 @@ next_track: | |||
424 | 424 | ||
425 | /* Fill the buffer */ | 425 | /* Fill the buffer */ |
426 | if (stream.next_frame) | 426 | if (stream.next_frame) |
427 | ci->advance_buffer_loc((void *)stream.next_frame); | 427 | ci->advance_buffer(stream.next_frame - stream.buffer); |
428 | else | 428 | else |
429 | ci->advance_buffer(size); | 429 | ci->advance_buffer(size); |
430 | stream.error = 0; | 430 | stream.error = 0; /* Must get new inputbuffer next time */ |
431 | file_end++; | 431 | file_end++; |
432 | continue; | 432 | continue; |
433 | } else if (MAD_RECOVERABLE(stream.error)) { | 433 | } else if (MAD_RECOVERABLE(stream.error)) { |
434 | /* Probably syncing after a seek */ | ||
434 | continue; | 435 | continue; |
435 | } else { | 436 | } else { |
436 | /* Some other unrecoverable error */ | 437 | /* Some other unrecoverable error */ |
437 | status = CODEC_ERROR; | 438 | status = CODEC_ERROR; |
438 | break; | 439 | break; |
439 | } | 440 | } |
440 | break; | ||
441 | } | 441 | } |
442 | 442 | ||
443 | file_end = 0; | ||
444 | |||
445 | /* Do the pcmbuf insert here. Note, this is the PREVIOUS frame's pcm | 443 | /* Do the pcmbuf insert here. Note, this is the PREVIOUS frame's pcm |
446 | data (not the one just decoded above). When we exit the decoding | 444 | data (not the one just decoded above). When we exit the decoding |
447 | loop we will need to process the final frame that was decoded. */ | 445 | loop we will need to process the final frame that was decoded. */ |
@@ -479,9 +477,11 @@ next_track: | |||
479 | } | 477 | } |
480 | 478 | ||
481 | if (stream.next_frame) | 479 | if (stream.next_frame) |
482 | ci->advance_buffer_loc((void *)stream.next_frame); | 480 | ci->advance_buffer(stream.next_frame - stream.buffer); |
483 | else | 481 | else |
484 | ci->advance_buffer(size); | 482 | ci->advance_buffer(size); |
483 | stream.error = 0; /* Must get new inputbuffer next time */ | ||
484 | file_end = 0; | ||
485 | 485 | ||
486 | framelength = synth.pcm.length - samples_to_skip; | 486 | framelength = synth.pcm.length - samples_to_skip; |
487 | if (framelength < 0) { | 487 | if (framelength < 0) { |
diff --git a/apps/plugin.c b/apps/plugin.c index 3807ad5d76..ea290c89a7 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -407,6 +407,7 @@ static const struct plugin_api rockbox_api = { | |||
407 | default_event_handler, | 407 | default_event_handler, |
408 | default_event_handler_ex, | 408 | default_event_handler_ex, |
409 | create_thread, | 409 | create_thread, |
410 | thread_self, | ||
410 | thread_exit, | 411 | thread_exit, |
411 | thread_wait, | 412 | thread_wait, |
412 | #if (CONFIG_CODEC == SWCODEC) | 413 | #if (CONFIG_CODEC == SWCODEC) |
@@ -745,7 +746,6 @@ static const struct plugin_api rockbox_api = { | |||
745 | bufgettail, | 746 | bufgettail, |
746 | bufcuttail, | 747 | bufcuttail, |
747 | 748 | ||
748 | buf_get_offset, | ||
749 | buf_handle_offset, | 749 | buf_handle_offset, |
750 | buf_request_buffer_handle, | 750 | buf_request_buffer_handle, |
751 | buf_set_base_handle, | 751 | buf_set_base_handle, |
@@ -779,7 +779,6 @@ static const struct plugin_api rockbox_api = { | |||
779 | 779 | ||
780 | /* new stuff at the end, sort into place next time | 780 | /* new stuff at the end, sort into place next time |
781 | the API gets incompatible */ | 781 | the API gets incompatible */ |
782 | thread_self, | ||
783 | }; | 782 | }; |
784 | 783 | ||
785 | int plugin_load(const char* plugin, const void* parameter) | 784 | int plugin_load(const char* plugin, const void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 43b9818ffd..de720d41eb 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -145,12 +145,12 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
145 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 145 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
146 | 146 | ||
147 | /* increase this every time the api struct changes */ | 147 | /* increase this every time the api struct changes */ |
148 | #define PLUGIN_API_VERSION 201 | 148 | #define PLUGIN_API_VERSION 202 |
149 | 149 | ||
150 | /* update this to latest version if a change to the api struct breaks | 150 | /* update this to latest version if a change to the api struct breaks |
151 | backwards compatibility (and please take the opportunity to sort in any | 151 | backwards compatibility (and please take the opportunity to sort in any |
152 | new function which are "waiting" at the end of the function table) */ | 152 | new function which are "waiting" at the end of the function table) */ |
153 | #define PLUGIN_MIN_API_VERSION 200 | 153 | #define PLUGIN_MIN_API_VERSION 202 |
154 | 154 | ||
155 | /* plugin return codes */ | 155 | /* plugin return codes */ |
156 | /* internal returns start at 0x100 to make exit(1..255) work */ | 156 | /* internal returns start at 0x100 to make exit(1..255) work */ |
@@ -479,6 +479,7 @@ struct plugin_api { | |||
479 | const char *name | 479 | const char *name |
480 | IF_PRIO(, int priority) | 480 | IF_PRIO(, int priority) |
481 | IF_COP(, unsigned int core)); | 481 | IF_COP(, unsigned int core)); |
482 | unsigned int (*thread_self)(void); | ||
482 | void (*thread_exit)(void); | 483 | void (*thread_exit)(void); |
483 | void (*thread_wait)(unsigned int thread_id); | 484 | void (*thread_wait)(unsigned int thread_id); |
484 | #if CONFIG_CODEC == SWCODEC | 485 | #if CONFIG_CODEC == SWCODEC |
@@ -871,7 +872,6 @@ struct plugin_api { | |||
871 | ssize_t (*bufgettail)(int handle_id, size_t size, void **data); | 872 | ssize_t (*bufgettail)(int handle_id, size_t size, void **data); |
872 | ssize_t (*bufcuttail)(int handle_id, size_t size); | 873 | ssize_t (*bufcuttail)(int handle_id, size_t size); |
873 | 874 | ||
874 | ssize_t (*buf_get_offset)(int handle_id, void *ptr); | ||
875 | ssize_t (*buf_handle_offset)(int handle_id); | 875 | ssize_t (*buf_handle_offset)(int handle_id); |
876 | void (*buf_request_buffer_handle)(int handle_id); | 876 | void (*buf_request_buffer_handle)(int handle_id); |
877 | void (*buf_set_base_handle)(int handle_id); | 877 | void (*buf_set_base_handle)(int handle_id); |
@@ -909,7 +909,6 @@ struct plugin_api { | |||
909 | 909 | ||
910 | /* new stuff at the end, sort into place next time | 910 | /* new stuff at the end, sort into place next time |
911 | the API gets incompatible */ | 911 | the API gets incompatible */ |
912 | unsigned int (*thread_self)(void); | ||
913 | }; | 912 | }; |
914 | 913 | ||
915 | /* plugin header */ | 914 | /* plugin header */ |