"audio_file_info2:%s, by %s\n"
"audio_file_info3:A: %s, Y: %s, C: %s\n",
afi->chunks_total,
tv2ms(&afi->chunk_tv),
"audio_file_info2:%s, by %s\n"
"audio_file_info3:A: %s, Y: %s, C: %s\n",
afi->chunks_total,
tv2ms(&afi->chunk_tv),
header_mode(&mp3.header),
v && *mp3.id3.title? mp3.id3.title : "(title tag not set)",
v && *mp3.id3.artist? mp3.id3.artist : "(artist tag not set)",
header_mode(&mp3.header),
v && *mp3.id3.title? mp3.id3.title : "(title tag not set)",
v && *mp3.id3.artist? mp3.id3.artist : "(artist tag not set)",
-static int get_header(unsigned char *map, off_t numbytes, off_t *fpos,
+static int get_header(unsigned char *map, size_t numbytes, off_t *fpos,
valid_start = *fpos;
first_len = get_header(map, numbytes, fpos, &h);
if (first_len <= 0)
valid_start = *fpos;
first_len = get_header(map, numbytes, fpos, &h);
if (first_len <= 0)
struct audio_format_info *afi)
{
long fl_avg = 0, freq_avg = 0, br_avg = 0;
struct audio_format_info *afi)
{
long fl_avg = 0, freq_avg = 0, br_avg = 0;
struct timeval tmp, cct; /* current chunk time */
fpos += len;
len = find_valid_start(map, numbytes, &fpos);
if (len <= 0)
break;
struct timeval tmp, cct; /* current chunk time */
fpos += len;
len = find_valid_start(map, numbytes, &fpos);
if (len <= 0)
break;
- freq = header_frequency(&mp3.header);
- br = header_bitrate(&mp3.header);
- fl = frame_length(&mp3.header);
- if (freq < 0 || br < 0 || fl < 0)
+ ret = header_frequency(&mp3.header);
+ if (ret < 0)
+ continue;
+ freq = ret;
+ ret = header_bitrate(&mp3.header);
+ if (ret < 0)
+ continue;
+ br = ret;
+ ret = frame_length(&mp3.header);
+ if (ret < 0)
- freq_avg += (freq - freq_avg) / (afi->chunks_total + 1);
- fl_avg += (fl - fl_avg) / (afi->chunks_total + 1);
- br_avg += (br - br_avg) / ((long)afi->chunks_total + 1);
+ freq_avg += ((long)freq - freq_avg) / ((long)afi->chunks_total + 1);
+ fl_avg += ((long)fl - fl_avg) / ((long)afi->chunks_total + 1);
+ br_avg += ((long)br - br_avg) / ((long)afi->chunks_total + 1);
afi->seconds_total = (tv2ms(&total_time) + 500) / 1000;
tv_divide(afi->chunks_total, &total_time, &afi->chunk_tv);
PARA_DEBUG_LOG("%lu chunks, each %lums\n", afi->chunks_total,
afi->seconds_total = (tv2ms(&total_time) + 500) / 1000;
tv_divide(afi->chunks_total, &total_time, &afi->chunk_tv);
PARA_DEBUG_LOG("%lu chunks, each %lums\n", afi->chunks_total,