summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2010-06-23 06:25:18 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2010-06-23 06:25:18 +0000
commitfc1fab477608379531ae0c1f09f9b375561d704f (patch)
tree4cdc95522e17496571e87b668812d48f3a92638e
parentf101c8ad621145c478dee49f24de0b5a70cd5ae3 (diff)
downloadrockbox-fc1fab477608379531ae0c1f09f9b375561d704f.tar.gz
rockbox-fc1fab477608379531ae0c1f09f9b375561d704f.zip
Clean up comments.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27078 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/mpc.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/apps/codecs/mpc.c b/apps/codecs/mpc.c
index 5a00e449a9..036864c832 100644
--- a/apps/codecs/mpc.c
+++ b/apps/codecs/mpc.c
@@ -35,9 +35,7 @@ static mpc_int32_t read_impl(mpc_reader *reader, void *ptr, mpc_int32_t 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 /* WARNING: assumes we don't need to skip too far into the past,
40 this might not be supported by the buffering layer yet */
41 (void)reader; 39 (void)reader;
42 return ci->seek_buffer(offset); 40 return ci->seek_buffer(offset);
43} 41}
@@ -54,7 +52,7 @@ static mpc_int32_t get_size_impl(mpc_reader *reader)
54 return ci->filesize; 52 return ci->filesize;
55} 53}
56 54
57/* this is the codec entry point */ 55/* This is the codec entry point. */
58enum codec_status codec_main(void) 56enum codec_status codec_main(void)
59{ 57{
60 mpc_int64_t samplesdone; 58 mpc_int64_t samplesdone;
@@ -90,14 +88,14 @@ next_track:
90 while (!*ci->taginfo_ready && !ci->stop_codec) 88 while (!*ci->taginfo_ready && !ci->stop_codec)
91 ci->sleep(1); 89 ci->sleep(1);
92 90
93 /* initialize demux/decoder */ 91 /* Initialize demux/decoder. */
94 demux = mpc_demux_init(&reader); 92 demux = mpc_demux_init(&reader);
95 if (NULL == demux) 93 if (NULL == demux)
96 { 94 {
97 retval = CODEC_ERROR; 95 retval = CODEC_ERROR;
98 goto done; 96 goto done;
99 } 97 }
100 /* read file's streaminfo data */ 98 /* Read file's streaminfo data. */
101 mpc_demux_get_info(demux, &info); 99 mpc_demux_get_info(demux, &info);
102 100
103 byterate = (mpc_uint32_t)(info.average_bitrate) / 8; 101 byterate = (mpc_uint32_t)(info.average_bitrate) / 8;
@@ -110,7 +108,7 @@ next_track:
110 * there is no loss of information except rounding. */ 108 * there is no loss of information except rounding. */
111 samplesdone = 100 * ((mpc_uint64_t)(ci->id3->offset * frequency) / byterate); 109 samplesdone = 100 * ((mpc_uint64_t)(ci->id3->offset * frequency) / byterate);
112 110
113 /* set playback engine up for correct number of channels */ 111 /* Set up digital signal processing for correct number of channels */
114 /* NOTE: current musepack format only allows for stereo files 112 /* NOTE: current musepack format only allows for stereo files
115 but code is here to handle other configurations anyway */ 113 but code is here to handle other configurations anyway */
116 if (info.channels == 2) 114 if (info.channels == 2)
@@ -126,8 +124,8 @@ next_track:
126 codec_set_replaygain(ci->id3); 124 codec_set_replaygain(ci->id3);
127 125
128 /* Resume to saved sample offset. */ 126 /* Resume to saved sample offset. */
129 if (samplesdone > 0) { 127 if (samplesdone > 0)
130 /* hack to improve seek time if filebuf goes empty */ 128 {
131 if (mpc_demux_seek_sample(demux, samplesdone) == MPC_STATUS_OK) 129 if (mpc_demux_seek_sample(demux, samplesdone) == MPC_STATUS_OK)
132 { 130 {
133 elapsed_time = (samplesdone*10)/frequency; 131 elapsed_time = (samplesdone*10)/frequency;
@@ -137,15 +135,14 @@ next_track:
137 { 135 {
138 samplesdone = 0; 136 samplesdone = 0;
139 } 137 }
140 /* reset chunksize */
141 } 138 }
142 139
143 /* This is the decoding loop. */ 140 /* This is the decoding loop. */
144 do { 141 do
145 /* Complete seek handler. */ 142 {
143 /* Complete seek handler. */
146 if (ci->seek_time) 144 if (ci->seek_time)
147 { 145 {
148 /* hack to improve seek time if filebuf goes empty */
149 mpc_int64_t new_offset = ((ci->seek_time - 1)/10)*frequency; 146 mpc_int64_t new_offset = ((ci->seek_time - 1)/10)*frequency;
150 if (mpc_demux_seek_sample(demux, new_offset) == MPC_STATUS_OK) 147 if (mpc_demux_seek_sample(demux, new_offset) == MPC_STATUS_OK)
151 { 148 {
@@ -153,20 +150,24 @@ next_track:
153 ci->set_elapsed(ci->seek_time); 150 ci->set_elapsed(ci->seek_time);
154 } 151 }
155 ci->seek_complete(); 152 ci->seek_complete();
156 /* reset chunksize */
157 } 153 }
154
155 /* Stop or skip occured, exit decoding loop. */
158 if (ci->stop_codec || ci->new_track) 156 if (ci->stop_codec || ci->new_track)
159 break; 157 break;
160 158
159 /* Decode one frame. */
161 status = mpc_demux_decode(demux, &frame); 160 status = mpc_demux_decode(demux, &frame);
162 ci->yield(); 161 ci->yield();
163 if (frame.bits == -1) /* decoding stopped */ 162 if (frame.bits == -1)
164 { 163 {
164 /* Decoding error, exit decoding loop. */
165 retval = (status == MPC_STATUS_OK) ? CODEC_OK : CODEC_ERROR; 165 retval = (status == MPC_STATUS_OK) ? CODEC_OK : CODEC_ERROR;
166 goto done; 166 goto done;
167 } 167 }
168 else 168 else
169 { 169 {
170 /* Decoding passed, insert samples to PCM buffer. */
170 ci->pcmbuf_insert(frame.buffer, 171 ci->pcmbuf_insert(frame.buffer,
171 frame.buffer + MPC_FRAME_LENGTH, 172 frame.buffer + MPC_FRAME_LENGTH,
172 frame.samples); 173 frame.samples);
@@ -186,4 +187,3 @@ done:
186exit: 187exit:
187 return retval; 188 return retval;
188} 189}
189