summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-06-27 19:29:49 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-06-27 19:29:49 +0000
commit85f49731065d0730022a92c3144c963ef8927a88 (patch)
treec359019b2eecf347f05d83c58a20d38122350ae3 /apps
parent492424bce0da0dede81531fb9d20a8455699e208 (diff)
downloadrockbox-85f49731065d0730022a92c3144c963ef8927a88.tar.gz
rockbox-85f49731065d0730022a92c3144c963ef8927a88.zip
Replaced some size_t with longs. That might solve some problems. Fixed
also problem where codec buffer length indicator goes negative. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6898 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/codecs.h12
-rw-r--r--apps/playback.c34
-rw-r--r--apps/playback.h2
3 files changed, 24 insertions, 24 deletions
diff --git a/apps/codecs.h b/apps/codecs.h
index c373bdb8ba..c50af3030e 100644
--- a/apps/codecs.h
+++ b/apps/codecs.h
@@ -139,24 +139,24 @@ struct codec_api {
139 int seek_time; 139 int seek_time;
140 140
141 /* Returns buffer to malloc array. Only codeclib should need this. */ 141 /* Returns buffer to malloc array. Only codeclib should need this. */
142 void* (*get_codec_memory)(size_t *size); 142 void* (*get_codec_memory)(long *size);
143 /* Insert PCM data into audio buffer for playback. Playback will start 143 /* Insert PCM data into audio buffer for playback. Playback will start
144 automatically. */ 144 automatically. */
145 bool (*audiobuffer_insert)(char *data, size_t length); 145 bool (*audiobuffer_insert)(char *data, long length);
146 bool (*audiobuffer_insert_split)(void *ch1, void *ch2, size_t length); 146 bool (*audiobuffer_insert_split)(void *ch1, void *ch2, long length);
147 /* Set song position in WPS (value in ms). */ 147 /* Set song position in WPS (value in ms). */
148 void (*set_elapsed)(unsigned int value); 148 void (*set_elapsed)(unsigned int value);
149 149
150 /* Read next <size> amount bytes from file buffer to <ptr>. 150 /* Read next <size> amount bytes from file buffer to <ptr>.
151 Will return number of bytes read or 0 if end of file. */ 151 Will return number of bytes read or 0 if end of file. */
152 size_t (*read_filebuf)(void *ptr, size_t size); 152 long (*read_filebuf)(void *ptr, long size);
153 /* Request pointer to file buffer which can be used to read 153 /* Request pointer to file buffer which can be used to read
154 <realsize> amount of data. <reqsize> tells the buffer system 154 <realsize> amount of data. <reqsize> tells the buffer system
155 how much data it should try to allocate. If <realsize> is 0, 155 how much data it should try to allocate. If <realsize> is 0,
156 end of file is reached. */ 156 end of file is reached. */
157 void* (*request_buffer)(size_t *realsize, size_t reqsize); 157 void* (*request_buffer)(long *realsize, long reqsize);
158 /* Advance file buffer position by <amount> amount of bytes. */ 158 /* Advance file buffer position by <amount> amount of bytes. */
159 void (*advance_buffer)(size_t amount); 159 void (*advance_buffer)(long amount);
160 /* Advance file buffer to a pointer location inside file buffer. */ 160 /* Advance file buffer to a pointer location inside file buffer. */
161 void (*advance_buffer_loc)(void *ptr); 161 void (*advance_buffer_loc)(void *ptr);
162 /* Seek file buffer to position <newpos> beginning of file. */ 162 /* Seek file buffer to position <newpos> beginning of file. */
diff --git a/apps/playback.c b/apps/playback.c
index 429141f759..5721e7c21b 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -145,7 +145,7 @@ static bool track_changed;
145static int current_fd; 145static int current_fd;
146 146
147/* Information about how many bytes left on the buffer re-fill run. */ 147/* Information about how many bytes left on the buffer re-fill run. */
148static size_t fill_bytesleft; 148static long fill_bytesleft;
149 149
150/* Track info structure about songs in the file buffer. */ 150/* Track info structure about songs in the file buffer. */
151static struct track_info tracks[MAX_TRACK]; 151static struct track_info tracks[MAX_TRACK];
@@ -172,7 +172,7 @@ int mp3_get_file_pos(void);
172 172
173/* Simulator stubs. */ 173/* Simulator stubs. */
174#ifdef SIMULATOR 174#ifdef SIMULATOR
175bool pcm_insert_buffer(char *buf, size_t length) 175bool pcm_insert_buffer(char *buf, long length)
176{ 176{
177 (void)buf; 177 (void)buf;
178 (void)length; 178 (void)length;
@@ -180,13 +180,13 @@ bool pcm_insert_buffer(char *buf, size_t length)
180 return true; 180 return true;
181} 181}
182 182
183void pcm_flush_buffer(size_t length) 183void pcm_flush_buffer(long length)
184{ 184{
185 (void)length; 185 (void)length;
186} 186}
187 187
188 188
189void* pcm_request_buffer(size_t length, size_t *realsize) 189void* pcm_request_buffer(long length, long *realsize)
190{ 190{
191 (void)length; 191 (void)length;
192 (void)realsize; 192 (void)realsize;
@@ -244,10 +244,10 @@ int ata_sleep(void)
244} 244}
245#endif 245#endif
246 246
247bool codec_audiobuffer_insert_callback(char *buf, size_t length) 247bool codec_audiobuffer_insert_callback(char *buf, long length)
248{ 248{
249 char *dest; 249 char *dest;
250 size_t realsize; 250 long realsize;
251 int factor; 251 int factor;
252 int next_channel = 0; 252 int next_channel = 0;
253 int processed_length; 253 int processed_length;
@@ -292,10 +292,10 @@ bool codec_audiobuffer_insert_callback(char *buf, size_t length)
292} 292}
293 293
294bool codec_audiobuffer_insert_split_callback(void *ch1, void *ch2, 294bool codec_audiobuffer_insert_split_callback(void *ch1, void *ch2,
295 size_t length) 295 long length)
296{ 296{
297 char *dest; 297 char *dest;
298 size_t realsize; 298 long realsize;
299 int factor; 299 int factor;
300 int processed_length; 300 int processed_length;
301 301
@@ -330,7 +330,7 @@ bool codec_audiobuffer_insert_split_callback(void *ch1, void *ch2,
330 return true; 330 return true;
331} 331}
332 332
333void* get_codec_memory_callback(size_t *size) 333void* get_codec_memory_callback(long *size)
334{ 334{
335 *size = MALLOC_BUFSIZE; 335 *size = MALLOC_BUFSIZE;
336 return &audiobuf[0]; 336 return &audiobuf[0];
@@ -353,7 +353,7 @@ void codec_set_elapsed_callback(unsigned int value)
353 } 353 }
354} 354}
355 355
356size_t codec_filebuf_callback(void *ptr, size_t size) 356long codec_filebuf_callback(void *ptr, long size)
357{ 357{
358 char *buf = (char *)ptr; 358 char *buf = (char *)ptr;
359 int copy_n; 359 int copy_n;
@@ -389,9 +389,9 @@ size_t codec_filebuf_callback(void *ptr, size_t size)
389 return copy_n; 389 return copy_n;
390} 390}
391 391
392void* codec_request_buffer_callback(size_t *realsize, size_t reqsize) 392void* codec_request_buffer_callback(long *realsize, long reqsize)
393{ 393{
394 size_t part_n; 394 long part_n;
395 395
396 if (ci.stop_codec || !playing) { 396 if (ci.stop_codec || !playing) {
397 *realsize = 0; 397 *realsize = 0;
@@ -423,7 +423,7 @@ void* codec_request_buffer_callback(size_t *realsize, size_t reqsize)
423 return (char *)&codecbuf[buf_ridx]; 423 return (char *)&codecbuf[buf_ridx];
424} 424}
425 425
426void codec_advance_buffer_callback(size_t amount) 426void codec_advance_buffer_callback(long amount)
427{ 427{
428 if ((int)amount > cur_ti->available + cur_ti->filerem) 428 if ((int)amount > cur_ti->available + cur_ti->filerem)
429 amount = cur_ti->available + cur_ti->filerem; 429 amount = cur_ti->available + cur_ti->filerem;
@@ -457,7 +457,7 @@ void codec_advance_buffer_callback(size_t amount)
457 457
458void codec_advance_buffer_loc_callback(void *ptr) 458void codec_advance_buffer_loc_callback(void *ptr)
459{ 459{
460 size_t amount; 460 long amount;
461 461
462 amount = (int)ptr - (int)&codecbuf[buf_ridx]; 462 amount = (int)ptr - (int)&codecbuf[buf_ridx];
463 codec_advance_buffer_callback(amount); 463 codec_advance_buffer_callback(amount);
@@ -560,7 +560,7 @@ void yield_codecs(void)
560 560
561void audio_fill_file_buffer(void) 561void audio_fill_file_buffer(void)
562{ 562{
563 size_t i, size; 563 long i, size;
564 int rc; 564 int rc;
565 565
566 if (current_fd < 0) 566 if (current_fd < 0)
@@ -587,10 +587,10 @@ void audio_fill_file_buffer(void)
587 buf_widx -= codecbuflen; 587 buf_widx -= codecbuflen;
588 i += rc; 588 i += rc;
589 tracks[track_widx].available += rc; 589 tracks[track_widx].available += rc;
590 codecbufused += rc;
590 fill_bytesleft -= rc; 591 fill_bytesleft -= rc;
591 } 592 }
592 593
593 codecbufused += i;
594 tracks[track_widx].filerem -= i; 594 tracks[track_widx].filerem -= i;
595 tracks[track_widx].filepos += i; 595 tracks[track_widx].filepos += i;
596 /*logf("Filled:%d/%d", tracks[track_widx].available, 596 /*logf("Filled:%d/%d", tracks[track_widx].available,
@@ -1176,7 +1176,7 @@ void audio_thread(void)
1176void codec_thread(void) 1176void codec_thread(void)
1177{ 1177{
1178 struct event ev; 1178 struct event ev;
1179 size_t codecsize; 1179 long codecsize;
1180 int status; 1180 int status;
1181 int wrap; 1181 int wrap;
1182 1182
diff --git a/apps/playback.h b/apps/playback.h
index 672ddae440..f0ae9eae42 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -49,7 +49,7 @@ struct track_info {
49 struct mp3entry id3; /* TAG metadata */ 49 struct mp3entry id3; /* TAG metadata */
50 struct mp3info mp3data; /* MP3 metadata */ 50 struct mp3info mp3data; /* MP3 metadata */
51 char *codecbuf; /* Pointer to codec buffer */ 51 char *codecbuf; /* Pointer to codec buffer */
52 size_t codecsize; /* Codec length in bytes */ 52 long codecsize; /* Codec length in bytes */
53 53
54 off_t filerem; /* Remaining bytes of file NOT in buffer */ 54 off_t filerem; /* Remaining bytes of file NOT in buffer */
55 off_t filesize; /* File total length */ 55 off_t filesize; /* File total length */