Mercurial > audlegacy-plugins
comparison src/madplug/replaygain.c @ 2214:9a869d4bb0d3
make use of AUDDBG() for debug print out.
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Thu, 06 Dec 2007 23:25:24 +0900 |
parents | fa9f85cebade |
children | d25cd7e7eddb |
comparison
equal
deleted
inserted
replaced
2213:137187e7a379 | 2214:9a869d4bb0d3 |
---|---|
90 } | 90 } |
91 if (aud_vfs_fread(buff, 1, TagLen - sizeof(T), fp) != TagLen - sizeof(T)) { | 91 if (aud_vfs_fread(buff, 1, TagLen - sizeof(T), fp) != TagLen - sizeof(T)) { |
92 free(buff); | 92 free(buff); |
93 return 8; | 93 return 8; |
94 } | 94 } |
95 #ifdef DEBUG | 95 |
96 printf("ver = %ld\n", Read_LE_Uint32(tp->Version)); | 96 AUDDBG("ver = %ld\n", Read_LE_Uint32(tp->Version)); |
97 printf("taglen = %ld\n", TagLen); | 97 AUDDBG("taglen = %ld\n", TagLen); |
98 #endif | |
99 | 98 |
100 TagCount = Read_LE_Uint32(tp->TagCount); | 99 TagCount = Read_LE_Uint32(tp->TagCount); |
101 end = buff + TagLen - sizeof(T); | 100 end = buff + TagLen - sizeof(T); |
102 for (p = buff; p < end && TagCount--;) { | 101 for (p = buff; p < end && TagCount--;) { |
103 vsize = Read_LE_Uint32((unsigned char *)p); | 102 vsize = Read_LE_Uint32((unsigned char *)p); |
202 int i; | 201 int i; |
203 char *key; | 202 char *key; |
204 char *value; | 203 char *value; |
205 struct id3_frame *frame; | 204 struct id3_frame *frame; |
206 | 205 |
207 #ifdef DEBUG | 206 AUDDBG("f: ReadId3v2TXXX"); |
208 g_message("f: ReadId3v2TXXX"); | 207 |
209 #endif | |
210 /* tag must be read before! */ | 208 /* tag must be read before! */ |
211 if (! file_info->tag ) { | 209 if (! file_info->tag ) { |
212 #ifdef DEBUG | 210 AUDDBG("id3v2 not found"); |
213 g_message("id3v2 not found"); | |
214 #endif | |
215 return 0; | 211 return 0; |
216 } | 212 } |
217 | 213 |
218 /* Partially based on code from MPD (http://www.musicpd.org/) */ | 214 /* Partially based on code from MPD (http://www.musicpd.org/) */ |
219 for (i = 0; (frame = id3_tag_findframe(file_info->tag, "TXXX", i)); i++) { | 215 for (i = 0; (frame = id3_tag_findframe(file_info->tag, "TXXX", i)); i++) { |
257 void read_replaygain(struct mad_info_t *file_info) | 253 void read_replaygain(struct mad_info_t *file_info) |
258 { | 254 { |
259 VFSFile *fp; | 255 VFSFile *fp; |
260 glong curpos = 0; | 256 glong curpos = 0; |
261 | 257 |
262 #ifdef DEBUG | 258 AUDDBG("f: read_replaygain"); |
263 g_message("f: read_replaygain"); | |
264 #endif | |
265 | 259 |
266 file_info->has_replaygain = FALSE; | 260 file_info->has_replaygain = FALSE; |
267 file_info->replaygain_album_scale = -1; | 261 file_info->replaygain_album_scale = -1; |
268 file_info->replaygain_track_scale = -1; | 262 file_info->replaygain_track_scale = -1; |
269 file_info->mp3gain_undo = -77; | 263 file_info->mp3gain_undo = -77; |
270 file_info->mp3gain_minmax = -77; | 264 file_info->mp3gain_minmax = -77; |
271 | 265 |
272 if (ReadId3v2TXXX(file_info)) { | 266 if (ReadId3v2TXXX(file_info)) { |
273 #ifdef DEBUG | 267 #ifdef AUD_DEBUG |
274 g_message("found ReplayGain info in id3v2 tag"); | 268 AUDDBG("found ReplayGain info in id3v2 tag"); |
275 | 269 |
276 gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL); | 270 gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL); |
277 g_message("RG album scale= %g, RG track scale = %g, in %s", | 271 AUDDBG("RG album scale= %g, RG track scale = %g, in %s", |
278 file_info->replaygain_album_scale, | 272 file_info->replaygain_album_scale, |
279 file_info->replaygain_track_scale, tmp); | 273 file_info->replaygain_track_scale, tmp); |
280 g_free(tmp); | 274 g_free(tmp); |
281 #endif | 275 #endif |
282 return; | 276 return; |
320 g_message | 314 g_message |
321 ("hmpf, was supposed to find a tag.. offs=%d, res=%d", | 315 ("hmpf, was supposed to find a tag.. offs=%d, res=%d", |
322 offs, res); | 316 offs, res); |
323 } | 317 } |
324 } | 318 } |
325 #ifdef DEBUG | 319 #ifdef AUD_DEBUG |
326 else | 320 else |
327 g_message("replaygain: not found"); | 321 AUDDBG("replaygain: not found"); |
328 #endif | 322 #endif |
329 } | 323 } |
330 #ifdef DEBUG | 324 #ifdef AUD_DEBUG |
331 if (res == 0) { // got APE tags, show the result | 325 if (res == 0) { // got APE tags, show the result |
332 gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL); | 326 gchar *tmp = g_filename_to_utf8(file_info->filename, -1, NULL, NULL, NULL); |
333 g_message("RG album scale= %g, RG track scale = %g, in %s", | 327 AUDDBG("RG album scale= %g, RG track scale = %g, in %s", |
334 file_info->replaygain_album_scale, | 328 file_info->replaygain_album_scale, |
335 file_info->replaygain_track_scale, tmp); | 329 file_info->replaygain_track_scale, tmp); |
336 g_free(tmp); | 330 g_free(tmp); |
337 } | 331 } |
338 #endif | 332 #endif |
344 if (file_info->infile) | 338 if (file_info->infile) |
345 aud_vfs_fseek(fp, curpos, SEEK_SET); | 339 aud_vfs_fseek(fp, curpos, SEEK_SET); |
346 | 340 |
347 aud_vfs_fclose(fp); | 341 aud_vfs_fclose(fp); |
348 | 342 |
349 #ifdef DEBUG | 343 AUDDBG("e: read_replaygain"); |
350 g_message("e: read_replaygain"); | 344 } |
351 #endif | |
352 } |