summaryrefslogtreecommitdiff
path: root/apps/codecs/mpc.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/mpc.c')
-rw-r--r--apps/codecs/mpc.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/apps/codecs/mpc.c b/apps/codecs/mpc.c
index afda2871f9..5a00e449a9 100644
--- a/apps/codecs/mpc.c
+++ b/apps/codecs/mpc.c
@@ -30,39 +30,28 @@ MPC_SAMPLE_FORMAT sample_buffer[MPC_DECODER_BUFFER_LENGTH] IBSS_ATTR;
30/* Our implementations of the mpc_reader callback functions. */ 30/* Our implementations of the mpc_reader callback functions. */
31static mpc_int32_t read_impl(mpc_reader *reader, void *ptr, mpc_int32_t size) 31static mpc_int32_t read_impl(mpc_reader *reader, void *ptr, mpc_int32_t size)
32{ 32{
33 struct codec_api *ci = (struct codec_api *)(reader->data); 33 (void)reader;
34 return ((mpc_int32_t)(ci->read_filebuf(ptr, size))); 34 return ((mpc_int32_t)(ci->read_filebuf(ptr, size)));
35} 35}
36 36
37static mpc_bool_t seek_impl(mpc_reader *reader, mpc_int32_t offset) 37static mpc_bool_t seek_impl(mpc_reader *reader, mpc_int32_t offset)
38{ 38{
39 struct codec_api *ci = (struct codec_api *)(reader->data);
40
41 /* WARNING: assumes we don't need to skip too far into the past, 39 /* WARNING: assumes we don't need to skip too far into the past,
42 this might not be supported by the buffering layer yet */ 40 this might not be supported by the buffering layer yet */
41 (void)reader;
43 return ci->seek_buffer(offset); 42 return ci->seek_buffer(offset);
44} 43}
45 44
46static mpc_int32_t tell_impl(mpc_reader *reader) 45static mpc_int32_t tell_impl(mpc_reader *reader)
47{ 46{
48 struct codec_api *ci = (struct codec_api *)(reader->data); 47 (void)reader;
49
50 return ci->curpos; 48 return ci->curpos;
51} 49}
52 50
53static mpc_int32_t get_size_impl(mpc_reader *reader) 51static mpc_int32_t get_size_impl(mpc_reader *reader)
54{ 52{
55 struct codec_api *ci = (struct codec_api *)(reader->data);
56
57 return ci->filesize;
58}
59
60static mpc_bool_t canseek_impl(mpc_reader *reader)
61{
62 (void)reader; 53 (void)reader;
63 54 return ci->filesize;
64 /* doesn't much matter, libmusepack ignores this anyway */
65 return true;
66} 55}
67 56
68/* this is the codec entry point */ 57/* this is the codec entry point */
@@ -90,8 +79,6 @@ enum codec_status codec_main(void)
90 reader.seek = seek_impl; 79 reader.seek = seek_impl;
91 reader.tell = tell_impl; 80 reader.tell = tell_impl;
92 reader.get_size = get_size_impl; 81 reader.get_size = get_size_impl;
93 reader.canseek = canseek_impl;
94 reader.data = ci;
95 82
96next_track: 83next_track:
97 if (codec_init()) 84 if (codec_init())