Mercurial > hg > svcore
comparison data/fileio/MP3FileReader.cpp @ 929:59e7fe1b1003 warnfix_no_size_t
Unsigned removals and warning fixes in data/
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2014 14:33:42 +0100 |
parents | e802e550a1f2 |
children | d03b3d956358 |
comparison
equal
deleted
inserted
replaced
928:6a94bb528e9d | 929:59e7fe1b1003 |
---|---|
35 //#define DEBUG_ID3TAG 1 | 35 //#define DEBUG_ID3TAG 1 |
36 | 36 |
37 #include <QFileInfo> | 37 #include <QFileInfo> |
38 | 38 |
39 MP3FileReader::MP3FileReader(FileSource source, DecodeMode decodeMode, | 39 MP3FileReader::MP3FileReader(FileSource source, DecodeMode decodeMode, |
40 CacheMode mode, size_t targetRate, | 40 CacheMode mode, int targetRate, |
41 ProgressReporter *reporter) : | 41 ProgressReporter *reporter) : |
42 CodedAudioFileReader(mode, targetRate), | 42 CodedAudioFileReader(mode, targetRate), |
43 m_source(source), | 43 m_source(source), |
44 m_path(source.getLocalFilename()), | 44 m_path(source.getLocalFilename()), |
45 m_decodeThread(0) | 45 m_decodeThread(0) |
83 ::close(fd); | 83 ::close(fd); |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 ssize_t sz = 0; | 87 ssize_t sz = 0; |
88 size_t offset = 0; | 88 int offset = 0; |
89 while (offset < m_fileSize) { | 89 while (offset < m_fileSize) { |
90 sz = ::read(fd, m_filebuffer + offset, m_fileSize - offset); | 90 sz = ::read(fd, m_filebuffer + offset, m_fileSize - offset); |
91 if (sz < 0) { | 91 if (sz < 0) { |
92 m_error = QString("Read error for file %1 (after %2 bytes)") | 92 m_error = QString("Read error for file %1 (after %2 bytes)") |
93 .arg(m_path).arg(offset); | 93 .arg(m_path).arg(offset); |
272 | 272 |
273 delete[] m_reader->m_filebuffer; | 273 delete[] m_reader->m_filebuffer; |
274 m_reader->m_filebuffer = 0; | 274 m_reader->m_filebuffer = 0; |
275 | 275 |
276 if (m_reader->m_samplebuffer) { | 276 if (m_reader->m_samplebuffer) { |
277 for (size_t c = 0; c < m_reader->m_channelCount; ++c) { | 277 for (int c = 0; c < m_reader->m_channelCount; ++c) { |
278 delete[] m_reader->m_samplebuffer[c]; | 278 delete[] m_reader->m_samplebuffer[c]; |
279 } | 279 } |
280 delete[] m_reader->m_samplebuffer; | 280 delete[] m_reader->m_samplebuffer; |
281 m_reader->m_samplebuffer = 0; | 281 m_reader->m_samplebuffer = 0; |
282 } | 282 } |
288 | 288 |
289 m_reader->endSerialised(); | 289 m_reader->endSerialised(); |
290 } | 290 } |
291 | 291 |
292 bool | 292 bool |
293 MP3FileReader::decode(void *mm, size_t sz) | 293 MP3FileReader::decode(void *mm, int sz) |
294 { | 294 { |
295 DecoderData data; | 295 DecoderData data; |
296 struct mad_decoder decoder; | 296 struct mad_decoder decoder; |
297 | 297 |
298 data.start = (unsigned char const *)mm; | 298 data.start = (unsigned char const *)mm; |
389 | 389 |
390 if (!isDecodeCacheInitialised()) { | 390 if (!isDecodeCacheInitialised()) { |
391 initialiseDecodeCache(); | 391 initialiseDecodeCache(); |
392 } | 392 } |
393 | 393 |
394 if (m_samplebuffersize < frames) { | 394 if (int(m_samplebuffersize) < frames) { |
395 if (!m_samplebuffer) { | 395 if (!m_samplebuffer) { |
396 m_samplebuffer = new float *[channels]; | 396 m_samplebuffer = new float *[channels]; |
397 for (int c = 0; c < channels; ++c) { | 397 for (int c = 0; c < channels; ++c) { |
398 m_samplebuffer[c] = 0; | 398 m_samplebuffer[c] = 0; |
399 } | 399 } |
425 | 425 |
426 return MAD_FLOW_CONTINUE; | 426 return MAD_FLOW_CONTINUE; |
427 } | 427 } |
428 | 428 |
429 enum mad_flow | 429 enum mad_flow |
430 MP3FileReader::error(void *dp, | 430 MP3FileReader::error(void * /* dp */, |
431 struct mad_stream *stream, | 431 struct mad_stream * /* stream */, |
432 struct mad_frame *) | 432 struct mad_frame *) |
433 { | 433 { |
434 DecoderData *data = (DecoderData *)dp; | 434 // DecoderData *data = (DecoderData *)dp; |
435 | 435 |
436 // fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %lu\n", | 436 // fprintf(stderr, "decoding error 0x%04x (%s) at byte offset %lu\n", |
437 // stream->error, mad_stream_errorstr(stream), | 437 // stream->error, mad_stream_errorstr(stream), |
438 // (unsigned long)(stream->this_frame - data->start)); | 438 // (unsigned long)(stream->this_frame - data->start)); |
439 | 439 |