Purge buffer and codec APIs existing exclusively in support of mpa.codec and fix that to not require them: buf_get_offset and ci.advance_buffer_loc. Sort APIs; everything must become incompatible. :(

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29595 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-03-16 05:38:37 +00:00
parent dce799641d
commit 56dd75d204
8 changed files with 12 additions and 37 deletions

View file

@ -1444,7 +1444,6 @@ ssize_t bufcuttail(int handle_id, size_t size)
SECONDARY EXPORTED FUNCTIONS
============================
buf_get_offset
buf_handle_offset
buf_request_buffer_handle
buf_set_base_handle
@ -1457,16 +1456,6 @@ They take care of the content of the structs, and rely on the linked list
management functions for all the actual handle management work.
*/
/* Get a handle offset from a pointer */
ssize_t buf_get_offset(int handle_id, void *ptr)
{
const struct memory_handle *h = find_handle(handle_id);
if (!h)
return ERR_HANDLE_NOT_FOUND;
return (size_t)ptr - (size_t)&buffer[h->ridx];
}
ssize_t buf_handle_offset(int handle_id)
{
const struct memory_handle *h = find_handle(handle_id);

View file

@ -91,14 +91,12 @@ ssize_t bufcuttail(int handle_id, size_t size);
* SECONDARY FUNCTIONS
* ===================
*
* buf_get_offset: Get a handle offset from a pointer
* buf_handle_offset: Get the offset of the first buffered byte from the file
* buf_request_buffer_handle: Request buffering of a handle
* buf_set_base_handle: Tell the buffering thread which handle is currently read
* buf_used: Total amount of buffer space used (including allocated space)
****************************************************************************/
ssize_t buf_get_offset(int handle_id, void *ptr);
ssize_t buf_handle_offset(int handle_id);
void buf_request_buffer_handle(int handle_id);
void buf_set_base_handle(int handle_id);

View file

@ -337,12 +337,6 @@ static void codec_advance_buffer_callback(size_t amount)
codec_set_offset_callback(ci.curpos);
}
static void codec_advance_buffer_loc_callback(void *ptr)
{
size_t amount = buf_get_offset(get_audio_hid(), ptr);
codec_advance_buffer_callback(amount);
}
static bool codec_seek_buffer_callback(size_t newpos)
{
logf("codec_seek_buffer_callback");
@ -443,7 +437,6 @@ void codec_init_codec_api(void)
ci.read_filebuf = codec_filebuf_callback;
ci.request_buffer = codec_request_buffer_callback;
ci.advance_buffer = codec_advance_buffer_callback;
ci.advance_buffer_loc = codec_advance_buffer_loc_callback;
ci.seek_buffer = codec_seek_buffer_callback;
ci.seek_complete = codec_seek_complete_callback;
ci.request_next_track = codec_request_next_track_callback;

View file

@ -93,7 +93,6 @@ struct codec_api ci = {
NULL, /* read_filebuf */
NULL, /* request_buffer */
NULL, /* advance_buffer */
NULL, /* advance_buffer_loc */
NULL, /* seek_buffer */
NULL, /* seek_complete */
NULL, /* request_next_track */

View file

@ -75,12 +75,12 @@
#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
/* increase this every time the api struct changes */
#define CODEC_API_VERSION 39
#define CODEC_API_VERSION 40
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define CODEC_MIN_API_VERSION 39
#define CODEC_MIN_API_VERSION 40
/* codec return codes */
enum codec_status {
@ -134,8 +134,6 @@ struct codec_api {
void* (*request_buffer)(size_t *realsize, size_t reqsize);
/* Advance file buffer position by <amount> amount of bytes. */
void (*advance_buffer)(size_t amount);
/* Advance file buffer to a pointer location inside file buffer. */
void (*advance_buffer_loc)(void *ptr);
/* Seek file buffer to position <newpos> beginning of file. */
bool (*seek_buffer)(size_t newpos);
/* Codec should call this function when it has done the seeking. */

View file

@ -424,24 +424,22 @@ next_track:
/* Fill the buffer */
if (stream.next_frame)
ci->advance_buffer_loc((void *)stream.next_frame);
ci->advance_buffer(stream.next_frame - stream.buffer);
else
ci->advance_buffer(size);
stream.error = 0;
stream.error = 0; /* Must get new inputbuffer next time */
file_end++;
continue;
} else if (MAD_RECOVERABLE(stream.error)) {
/* Probably syncing after a seek */
continue;
} else {
/* Some other unrecoverable error */
status = CODEC_ERROR;
break;
}
break;
}
file_end = 0;
/* Do the pcmbuf insert here. Note, this is the PREVIOUS frame's pcm
data (not the one just decoded above). When we exit the decoding
loop we will need to process the final frame that was decoded. */
@ -479,9 +477,11 @@ next_track:
}
if (stream.next_frame)
ci->advance_buffer_loc((void *)stream.next_frame);
ci->advance_buffer(stream.next_frame - stream.buffer);
else
ci->advance_buffer(size);
stream.error = 0; /* Must get new inputbuffer next time */
file_end = 0;
framelength = synth.pcm.length - samples_to_skip;
if (framelength < 0) {

View file

@ -407,6 +407,7 @@ static const struct plugin_api rockbox_api = {
default_event_handler,
default_event_handler_ex,
create_thread,
thread_self,
thread_exit,
thread_wait,
#if (CONFIG_CODEC == SWCODEC)
@ -745,7 +746,6 @@ static const struct plugin_api rockbox_api = {
bufgettail,
bufcuttail,
buf_get_offset,
buf_handle_offset,
buf_request_buffer_handle,
buf_set_base_handle,
@ -779,7 +779,6 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time
the API gets incompatible */
thread_self,
};
int plugin_load(const char* plugin, const void* parameter)

View file

@ -145,12 +145,12 @@ void* plugin_get_buffer(size_t *buffer_size);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 201
#define PLUGIN_API_VERSION 202
/* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 200
#define PLUGIN_MIN_API_VERSION 202
/* plugin return codes */
/* internal returns start at 0x100 to make exit(1..255) work */
@ -479,6 +479,7 @@ struct plugin_api {
const char *name
IF_PRIO(, int priority)
IF_COP(, unsigned int core));
unsigned int (*thread_self)(void);
void (*thread_exit)(void);
void (*thread_wait)(unsigned int thread_id);
#if CONFIG_CODEC == SWCODEC
@ -871,7 +872,6 @@ struct plugin_api {
ssize_t (*bufgettail)(int handle_id, size_t size, void **data);
ssize_t (*bufcuttail)(int handle_id, size_t size);
ssize_t (*buf_get_offset)(int handle_id, void *ptr);
ssize_t (*buf_handle_offset)(int handle_id);
void (*buf_request_buffer_handle)(int handle_id);
void (*buf_set_base_handle)(int handle_id);
@ -909,7 +909,6 @@ struct plugin_api {
/* new stuff at the end, sort into place next time
the API gets incompatible */
unsigned int (*thread_self)(void);
};
/* plugin header */