Disable unneeded parts of mpc's file-I/O interface.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27024 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andree Buschmann 2010-06-21 18:45:34 +00:00
parent d18aa51ded
commit a3541c07de
2 changed files with 6 additions and 17 deletions

View file

@ -65,12 +65,14 @@ struct mpc_reader_t {
/// Returns the total length of the source stream, in bytes. /// Returns the total length of the source stream, in bytes.
mpc_int32_t (*get_size)(mpc_reader *p_reader); mpc_int32_t (*get_size)(mpc_reader *p_reader);
/* rockbox: not used
/// True if the stream is a seekable stream. /// True if the stream is a seekable stream.
mpc_bool_t (*canseek)(mpc_reader *p_reader); mpc_bool_t (*canseek)(mpc_reader *p_reader);
/// Field that can be used to identify a particular instance of /// Field that can be used to identify a particular instance of
/// reader or carry along data associated with that reader. /// reader or carry along data associated with that reader.
void *data; void *data;
*/
}; };
/* rockbox: not used /* rockbox: not used
/// Initializes reader with default stdio file reader implementation. Use /// Initializes reader with default stdio file reader implementation. Use

View file

@ -30,39 +30,28 @@ MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH] IBSS_ATTR;
/* Our implementations of the mpc_reader callback functions. */ /* Our implementations of the mpc_reader callback functions. */
static mpc_int32_t read_impl(mpc_reader *reader, void *ptr, mpc_int32_t size) static mpc_int32_t read_impl(mpc_reader *reader, void *ptr, mpc_int32_t size)
{ {
struct codec_api *ci = (struct codec_api *)(reader->data); (void)reader;
return ((mpc_int32_t)(ci->read_filebuf(ptr, size))); return ((mpc_int32_t)(ci->read_filebuf(ptr, size)));
} }
static mpc_bool_t seek_impl(mpc_reader *reader, mpc_int32_t offset) static mpc_bool_t seek_impl(mpc_reader *reader, mpc_int32_t offset)
{ {
struct codec_api *ci = (struct codec_api *)(reader->data);
/* WARNING: assumes we don't need to skip too far into the past, /* WARNING: assumes we don't need to skip too far into the past,
this might not be supported by the buffering layer yet */ this might not be supported by the buffering layer yet */
(void)reader;
return ci->seek_buffer(offset); return ci->seek_buffer(offset);
} }
static mpc_int32_t tell_impl(mpc_reader *reader) static mpc_int32_t tell_impl(mpc_reader *reader)
{ {
struct codec_api *ci = (struct codec_api *)(reader->data); (void)reader;
return ci->curpos; return ci->curpos;
} }
static mpc_int32_t get_size_impl(mpc_reader *reader) static mpc_int32_t get_size_impl(mpc_reader *reader)
{
struct codec_api *ci = (struct codec_api *)(reader->data);
return ci->filesize;
}
static mpc_bool_t canseek_impl(mpc_reader *reader)
{ {
(void)reader; (void)reader;
return ci->filesize;
/* doesn't much matter, libmusepack ignores this anyway */
return true;
} }
/* this is the codec entry point */ /* this is the codec entry point */
@ -90,8 +79,6 @@ enum codec_status codec_main(void)
reader.seek = seek_impl; reader.seek = seek_impl;
reader.tell = tell_impl; reader.tell = tell_impl;
reader.get_size = get_size_impl; reader.get_size = get_size_impl;
reader.canseek = canseek_impl;
reader.data = ci;
next_track: next_track:
if (codec_init()) if (codec_init())