comparison data/fileio/MP3FileReader.cpp @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents 048173126e71
children a1cd5abcb38b
comparison
equal deleted inserted replaced
1037:bf0e5944289b 1038:cc27f35aa75c
84 ::close(fd); 84 ::close(fd);
85 return; 85 return;
86 } 86 }
87 87
88 ssize_t sz = 0; 88 ssize_t sz = 0;
89 int offset = 0; 89 ssize_t offset = 0;
90 while (offset < m_fileSize) { 90 while (offset < m_fileSize) {
91 sz = ::read(fd, m_filebuffer + offset, m_fileSize - offset); 91 sz = ::read(fd, m_filebuffer + offset, m_fileSize - offset);
92 if (sz < 0) { 92 if (sz < 0) {
93 m_error = QString("Read error for file %1 (after %2 bytes)") 93 m_error = QString("Read error for file %1 (after %2 bytes)")
94 .arg(m_path).arg(offset); 94 .arg(m_path).arg(offset);
289 289
290 m_reader->endSerialised(); 290 m_reader->endSerialised();
291 } 291 }
292 292
293 bool 293 bool
294 MP3FileReader::decode(void *mm, int sz) 294 MP3FileReader::decode(void *mm, sv_frame_t sz)
295 { 295 {
296 DecoderData data; 296 DecoderData data;
297 struct mad_decoder decoder; 297 struct mad_decoder decoder;
298 298
299 data.start = (unsigned char const *)mm; 299 data.start = (unsigned char const *)mm;
318 unsigned char const *start = data->start; 318 unsigned char const *start = data->start;
319 unsigned long length = data->length; 319 unsigned long length = data->length;
320 320
321 #ifdef HAVE_ID3TAG 321 #ifdef HAVE_ID3TAG
322 if (length > ID3_TAG_QUERYSIZE) { 322 if (length > ID3_TAG_QUERYSIZE) {
323 int taglen = id3_tag_query(start, ID3_TAG_QUERYSIZE); 323 ssize_t taglen = id3_tag_query(start, ID3_TAG_QUERYSIZE);
324 if (taglen > 0) { 324 if (taglen > 0) {
325 // cerr << "ID3 tag length to skip: " << taglen << endl; 325 // cerr << "ID3 tag length to skip: " << taglen << endl;
326 start += taglen; 326 start += taglen;
327 length -= taglen; 327 length -= taglen;
328 } 328 }
350 { 350 {
351 int channels = pcm->channels; 351 int channels = pcm->channels;
352 int frames = pcm->length; 352 int frames = pcm->length;
353 353
354 if (header) { 354 if (header) {
355 m_bitrateNum += header->bitrate; 355 m_bitrateNum = m_bitrateNum + double(header->bitrate);
356 m_bitrateDenom ++; 356 m_bitrateDenom ++;
357 } 357 }
358 358
359 if (frames < 1) return MAD_FLOW_CONTINUE; 359 if (frames < 1) return MAD_FLOW_CONTINUE;
360 360