diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-02-02 18:27:31 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-02-02 18:27:31 +0000 |
commit | 48016d5e07e2b5aff1c1044b4b299b7e7138156a (patch) | |
tree | 1e454964e931f3cb26984eaa5cfd5d2f28f68902 | |
parent | adf722453879bb93e708d0501a192d00b629fadf (diff) | |
download | rockbox-48016d5e07e2b5aff1c1044b4b299b7e7138156a.tar.gz rockbox-48016d5e07e2b5aff1c1044b4b299b7e7138156a.zip |
Reduce excessive debug output during mp3 parsing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29191 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/mp3data.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/apps/mp3data.c b/apps/mp3data.c index 8a5f993c48..a0068edeb9 100644 --- a/apps/mp3data.c +++ b/apps/mp3data.c | |||
@@ -42,6 +42,12 @@ | |||
42 | 42 | ||
43 | // #define DEBUG_VERBOSE | 43 | // #define DEBUG_VERBOSE |
44 | 44 | ||
45 | #ifdef DEBUG_VERBOSE | ||
46 | #define VDEBUGF DEBUGF | ||
47 | #else | ||
48 | #define VDEBUGF(...) do { } while(0) | ||
49 | #endif | ||
50 | |||
45 | #define SYNC_MASK (0x7ffL << 21) | 51 | #define SYNC_MASK (0x7ffL << 21) |
46 | #define VERSION_MASK (3L << 19) | 52 | #define VERSION_MASK (3L << 19) |
47 | #define LAYER_MASK (3L << 17) | 53 | #define LAYER_MASK (3L << 17) |
@@ -184,13 +190,11 @@ static bool mp3headerinfo(struct mp3info *info, unsigned long header) | |||
184 | info->mode_extension = (header & MODE_EXT_MASK) >> 4; | 190 | info->mode_extension = (header & MODE_EXT_MASK) >> 4; |
185 | info->emphasis = header & EMPHASIS_MASK; | 191 | info->emphasis = header & EMPHASIS_MASK; |
186 | 192 | ||
187 | #ifdef DEBUG_VERBOSE | 193 | VDEBUGF( "Header: %08lx, Ver %d, lay %d, bitr %d, freq %ld, " |
188 | DEBUGF( "Header: %08lx, Ver %d, lay %d, bitr %d, freq %ld, " | ||
189 | "chmode %d, mode_ext %d, emph %d, bytes: %d time: %d/%d\n", | 194 | "chmode %d, mode_ext %d, emph %d, bytes: %d time: %d/%d\n", |
190 | header, info->version, info->layer+1, info->bitrate, | 195 | header, info->version, info->layer+1, info->bitrate, |
191 | info->frequency, info->channel_mode, info->mode_extension, | 196 | info->frequency, info->channel_mode, info->mode_extension, |
192 | info->emphasis, info->frame_size, info->ft_num, info->ft_den); | 197 | info->emphasis, info->frame_size, info->ft_num, info->ft_den); |
193 | #endif | ||
194 | return true; | 198 | return true; |
195 | } | 199 | } |
196 | 200 | ||
@@ -230,10 +234,8 @@ static unsigned long __find_next_frame(int fd, long *offset, long max_offset, | |||
230 | 234 | ||
231 | *offset = pos - 4; | 235 | *offset = pos - 4; |
232 | 236 | ||
233 | #if defined(DEBUG) | ||
234 | if(*offset) | 237 | if(*offset) |
235 | DEBUGF("Warning: skipping %ld bytes of garbage\n", *offset); | 238 | VDEBUGF("Warning: skipping %ld bytes of garbage\n", *offset); |
236 | #endif | ||
237 | 239 | ||
238 | return header; | 240 | return header; |
239 | } | 241 | } |
@@ -373,9 +375,7 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
373 | /* OK, we have found a frame. Let's see if it has a Xing header */ | 375 | /* OK, we have found a frame. Let's see if it has a Xing header */ |
374 | if (info->frame_size-4 >= (int)sizeof(frame)) | 376 | if (info->frame_size-4 >= (int)sizeof(frame)) |
375 | { | 377 | { |
376 | #if defined(DEBUG) | ||
377 | DEBUGF("Error: Invalid id3 header, frame_size: %d\n", info->frame_size); | 378 | DEBUGF("Error: Invalid id3 header, frame_size: %d\n", info->frame_size); |
378 | #endif | ||
379 | return -8; | 379 | return -8; |
380 | } | 380 | } |
381 | 381 | ||
@@ -476,7 +476,7 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
476 | 476 | ||
477 | if (!memcmp(vbrheader, "VBRI", 4)) | 477 | if (!memcmp(vbrheader, "VBRI", 4)) |
478 | { | 478 | { |
479 | DEBUGF("VBRI header\n"); | 479 | VDEBUGF("VBRI header\n"); |
480 | 480 | ||
481 | /* We want to skip the VBRI frame when playing the stream */ | 481 | /* We want to skip the VBRI frame when playing the stream */ |
482 | bytecount += info->frame_size; | 482 | bytecount += info->frame_size; |
@@ -492,16 +492,16 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
492 | if(!mp3headerinfo(info, header)) | 492 | if(!mp3headerinfo(info, header)) |
493 | return -7; | 493 | return -7; |
494 | 494 | ||
495 | DEBUGF("%04x: %04x %04x ", 0, (short)(header >> 16), | 495 | VDEBUGF("%04x: %04x %04x ", 0, (short)(header >> 16), |
496 | (short)(header & 0xffff)); | 496 | (short)(header & 0xffff)); |
497 | for(i = 4;i < (int)sizeof(frame)-4;i+=2) { | 497 | for(i = 4;i < (int)sizeof(frame)-4;i+=2) { |
498 | if(i % 16 == 0) { | 498 | if(i % 16 == 0) { |
499 | DEBUGF("\n%04x: ", i-4); | 499 | VDEBUGF("\n%04x: ", i-4); |
500 | } | 500 | } |
501 | DEBUGF("%04x ", (frame[i-4] << 8) | frame[i-4+1]); | 501 | VDEBUGF("%04x ", (frame[i-4] << 8) | frame[i-4+1]); |
502 | } | 502 | } |
503 | 503 | ||
504 | DEBUGF("\n"); | 504 | VDEBUGF("\n"); |
505 | 505 | ||
506 | /* Yes, it is a FhG VBR file */ | 506 | /* Yes, it is a FhG VBR file */ |
507 | info->is_vbr = true; | 507 | info->is_vbr = true; |
@@ -524,12 +524,12 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
524 | 524 | ||
525 | /* We don't parse the TOC, since we don't yet know how to (FIXME) */ | 525 | /* We don't parse the TOC, since we don't yet know how to (FIXME) */ |
526 | num_offsets = bytes2int(0, 0, vbrheader[18], vbrheader[19]); | 526 | num_offsets = bytes2int(0, 0, vbrheader[18], vbrheader[19]); |
527 | DEBUGF("Frame size (%dkpbs): %d bytes (0x%x)\n", | 527 | VDEBUGF("Frame size (%dkpbs): %d bytes (0x%x)\n", |
528 | info->bitrate, info->frame_size, info->frame_size); | 528 | info->bitrate, info->frame_size, info->frame_size); |
529 | DEBUGF("Frame count: %lx\n", info->frame_count); | 529 | VDEBUGF("Frame count: %lx\n", info->frame_count); |
530 | DEBUGF("Byte count: %lx\n", info->byte_count); | 530 | VDEBUGF("Byte count: %lx\n", info->byte_count); |
531 | DEBUGF("Offsets: %d\n", num_offsets); | 531 | VDEBUGF("Offsets: %d\n", num_offsets); |
532 | DEBUGF("Frames/entry: %ld\n", | 532 | VDEBUGF("Frames/entry: %ld\n", |
533 | bytes2int(0, 0, vbrheader[24], vbrheader[25])); | 533 | bytes2int(0, 0, vbrheader[24], vbrheader[25])); |
534 | 534 | ||
535 | offset = 0; | 535 | offset = 0; |
@@ -538,7 +538,7 @@ int get_mp3file_info(int fd, struct mp3info *info) | |||
538 | { | 538 | { |
539 | j = bytes2int(0, 0, vbrheader[26+i*2], vbrheader[27+i*2]); | 539 | j = bytes2int(0, 0, vbrheader[26+i*2], vbrheader[27+i*2]); |
540 | offset += j; | 540 | offset += j; |
541 | DEBUGF("%03d: %lx (%x)\n", i, offset - bytecount, j); | 541 | VDEBUGF("%03d: %lx (%x)\n", i, offset - bytecount, j); |
542 | } | 542 | } |
543 | } | 543 | } |
544 | 544 | ||
@@ -603,7 +603,7 @@ int count_mp3_frames(int fd, int startpos, int filesize, | |||
603 | } | 603 | } |
604 | } | 604 | } |
605 | } | 605 | } |
606 | DEBUGF("Total number of frames: %d\n", num_frames); | 606 | VDEBUGF("Total number of frames: %d\n", num_frames); |
607 | 607 | ||
608 | if(is_vbr) | 608 | if(is_vbr) |
609 | return num_frames; | 609 | return num_frames; |
@@ -693,7 +693,7 @@ int create_xing_header(int fd, long startpos, long filesize, | |||
693 | toc[i] = filepos * 256 / filesize; | 693 | toc[i] = filepos * 256 / filesize; |
694 | } | 694 | } |
695 | 695 | ||
696 | DEBUGF("Pos %d: %ld relpos: %ld filepos: %lx tocentry: %x\n", | 696 | VDEBUGF("Pos %d: %ld relpos: %ld filepos: %lx tocentry: %x\n", |
697 | i, pos, pos-last_pos, filepos, toc[i]); | 697 | i, pos, pos-last_pos, filepos, toc[i]); |
698 | 698 | ||
699 | last_pos = pos; | 699 | last_pos = pos; |