Revision: 2309
http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2309&view=rev
Author: tmzullinger
Date: 2009-04-12 22:22:20 +0000 (Sun, 12 Apr 2009)
Log Message:
-----------
Define a convenient debug macro for mp3file.c
Modified Paths:
--------------
gtkpod/trunk/ChangeLog
gtkpod/trunk/src/mp3file.c
Modified: gtkpod/trunk/ChangeLog
===================================================================
--- gtkpod/trunk/ChangeLog 2009-04-12 22:22:08 UTC (rev 2308)
+++ gtkpod/trunk/ChangeLog 2009-04-12 22:22:20 UTC (rev 2309)
@@ -1,5 +1,7 @@
2009-04-12 Todd Zullinger <[email protected]>
+ * src/mp3file.c: Define a convenient debug macro
+
* src/repository.c: Fix entry widget names for Create
Repository window. The names were changed to fix issues
caused during the glade file conversion to glade3, in svn
Modified: gtkpod/trunk/src/mp3file.c
===================================================================
--- gtkpod/trunk/src/mp3file.c 2009-04-12 22:22:08 UTC (rev 2308)
+++ gtkpod/trunk/src/mp3file.c 2009-04-12 22:22:20 UTC (rev 2309)
@@ -29,7 +29,13 @@
#define LOCALDEBUG 0
+#if LOCALDEBUG
+# define debug(s) printf s
+#else
+# define debug(s)
+#endif
+
/* The code in the first section of this file is taken from the
* mp3info (http://www.ibiblio.org/mp3info/) project. Only the code
* needed for the playlength calculation has been extracted. */
@@ -1031,9 +1037,7 @@
*len = 0;
frame = id3_tag_findframe (tag, frame_name, index);
-#if LOCALDEBUG
- printf ("frame: %p\n", frame);
-#endif
+ debug (("frame: %p\n", frame));
if (!frame) return NULL;
@@ -1104,15 +1108,11 @@
/* The last field contains the data */
field = id3_frame_field (frame, frame->nfields-1);
-#if LOCALDEBUG
- printf (" field: %p\n", field);
-#endif
+ debug ((" field: %p\n", field));
if (!field) return NULL;
-#if LOCALDEBUG
- printf (" type: %d\n", field->type);
-#endif
+ debug ((" type: %d\n", field->type));
switch (field->type)
{
@@ -1151,41 +1151,30 @@
enum id3_field_textencoding encoding = ID3_FIELD_TEXTENCODING_ISO_8859_1;
frame = id3_tag_findframe (tag, frame_name, 0);
-#if LOCALDEBUG
- printf ("frame: %p\n", frame);
-#endif
+ debug (("frame: %p\n", frame));
if (!frame) return NULL;
/* Find the encoding used for the field */
field = id3_frame_field (frame, 0);
-#if LOCALDEBUG
- printf ("field: %p\n", field);
- printf ("type: %d\n", id3_field_type (field));
-#endif
+ debug (("field: %p\n", field));
+ debug (("type: %d\n", id3_field_type (field)));
if (field && (id3_field_type (field) == ID3_FIELD_TYPE_TEXTENCODING))
{
encoding = field->number.value;
-#if LOCALDEBUG
- printf ("encoding: %d\n", encoding);
-#endif
+ debug (("encoding: %d\n", encoding));
}
/* The last field contains the data */
field = id3_frame_field (frame, frame->nfields-1);
-#if LOCALDEBUG
- printf ("field: %p\n", field);
-#endif
+ debug (("field: %p\n", field));
if (!field) return NULL;
-#if LOCALDEBUG
- printf ("type: %d\n", field->type);
-#endif
+ debug (("type: %d\n", field->type));
-
switch (field->type)
{
case ID3_FIELD_TYPE_STRINGLIST:
@@ -1196,9 +1185,7 @@
break;
case ID3_FIELD_TYPE_BINARYDATA:
binary = id3_field_getbinarydata(field, &len);
-#if LOCALDEBUG
- printf ("len: %ld\nbinary: %s\n", len, binary+1);
-#endif
+ debug (("len: %ld\nbinary: %s\n", len, binary+1));
if (len > 0)
return charset_to_utf8 (binary+1);
break;
@@ -1977,17 +1964,13 @@
if (gd->radio_gain_set) return;
gd->radio_gain = (gdouble)gain / 10;
gd->radio_gain_set = TRUE;
-#if LOCALDEBUG
- printf("radio gain (lame): %f\n", gd->radio_gain);
-#endif
+ debug (("radio gain (lame): %f\n", gd->radio_gain));
break;
case 0x40:
if (gd->audiophile_gain_set) return;
gd->audiophile_gain = (gdouble)gain / 10;
gd->audiophile_gain_set = TRUE;
-#if LOCALDEBUG
- printf("album gain (lame): %f\n", gd->audiophile_gain);
-#endif
+ debug (("album gain (lame): %f\n",
gd->audiophile_gain));
break;
}
}
@@ -2040,19 +2023,15 @@
/* Replay Gain data is only available since Lame version 3.94b */
if (lame_vcmp(lt.version_string, "3.94b") < 0) {
-#if LOCALDEBUG
- printf("Old lame version (%s). Not used.\n", lt.version_string);
-#endif
+ debug (("Old lame version (%s). Not used.\n",
lt.version_string));
goto rg_fail;
}
if ((!gd->peak_signal_set) && lt.peak_signal_amplitude) {
gd->peak_signal = lt.peak_signal_amplitude;
gd->peak_signal_set = TRUE;
-#if LOCALDEBUG
- printf("peak signal (lame): %f\n",
- (double)gd->peak_signal / 0x800000);
-#endif
+ debug (("peak signal (lame): %f\n",
+ (double)gd->peak_signal / 0x800000));
}
/*
@@ -2061,10 +2040,8 @@
*/
if ((lame_vcmp(lt.version_string, "3.95.") < 0)) {
gain_adjust = 60;
-#if LOCALDEBUG
- printf("Old lame version (%s). Adjusting gain.\n",
- lt.version_string);
-#endif
+ debug (("Old lame version (%s). Adjusting gain.\n",
+ lt.version_string));
}
/* radio gain */
@@ -2207,9 +2184,7 @@
&& (!strncasecmp(ep, " dB", 3))) {
gd->radio_gain = d;
gd->radio_gain_set = TRUE;
-#if LOCALDEBUG
- printf("radio gain (ape): %f\n",
gd->radio_gain);
-#endif
+ debug (("radio gain (ape): %f\n",
gd->radio_gain));
}
continue;
@@ -2224,10 +2199,8 @@
d *= 0x800000;
gd->peak_signal = (guint32) floor(d + 0.5);
gd->peak_signal_set = TRUE;
-#if LOCALDEBUG
- printf("radio peak signal (ape): %f\n",
- (double)gd->peak_signal / 0x800000);
-#endif
+ debug (("radio peak signal (ape): %f\n",
+ (double)gd->peak_signal / 0x800000));
}
continue;
@@ -2290,9 +2263,7 @@
if (gd.radio_gain_set)
{
track->soundcheck = replaygain_to_soundcheck (gd.radio_gain);
-#if LOCALDEBUG
- printf("using lame radio gain\n");
-#endif
+ debug (("using lame radio gain\n"));
return TRUE;
}
@@ -2300,9 +2271,7 @@
if (gd.radio_gain_set)
{
track->soundcheck = replaygain_to_soundcheck (gd.radio_gain);
-#if LOCALDEBUG
- printf("using ape radio gain\n");
-#endif
+ debug (("using ape radio gain\n"));
return TRUE;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2