Mercurial > audlegacy-plugins
comparison src/madplug/input.c @ 1976:5fa26178eaef
s/tuple_/aud_tuple_/g
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Sun, 07 Oct 2007 00:22:59 -0500 |
| parents | 0d5f7629171f |
| children | fa9f85cebade |
comparison
equal
deleted
inserted
replaced
| 1973:f86cb7fc1d4f | 1976:5fa26178eaef |
|---|---|
| 324 | 324 |
| 325 static void input_set_and_free_tag(struct id3_tag *tag, Tuple *tuple, const gchar *frame, const gint nfield) | 325 static void input_set_and_free_tag(struct id3_tag *tag, Tuple *tuple, const gchar *frame, const gint nfield) |
| 326 { | 326 { |
| 327 gchar *scratch = input_id3_get_string(tag, frame); | 327 gchar *scratch = input_id3_get_string(tag, frame); |
| 328 | 328 |
| 329 tuple_associate_string(tuple, nfield, NULL, scratch); | 329 aud_tuple_associate_string(tuple, nfield, NULL, scratch); |
| 330 tuple_associate_string(tuple, -1, frame, scratch); | 330 aud_tuple_associate_string(tuple, -1, frame, scratch); |
| 331 | 331 |
| 332 g_free(scratch); | 332 g_free(scratch); |
| 333 } | 333 } |
| 334 | 334 |
| 335 static void input_alloc_tag(struct mad_info_t *info) | 335 static void input_alloc_tag(struct mad_info_t *info) |
| 336 { | 336 { |
| 337 Tuple *tuple; | 337 Tuple *tuple; |
| 338 | 338 |
| 339 if (info->tuple == NULL) { | 339 if (info->tuple == NULL) { |
| 340 tuple = tuple_new(); | 340 tuple = aud_tuple_new(); |
| 341 info->tuple = tuple; | 341 info->tuple = tuple; |
| 342 tuple_associate_int(info->tuple, FIELD_LENGTH, NULL, -1); | 342 aud_tuple_associate_int(info->tuple, FIELD_LENGTH, NULL, -1); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 /** | 346 /** |
| 347 * read the ID3 tag | 347 * read the ID3 tag |
| 354 | 354 |
| 355 #ifdef DEBUG | 355 #ifdef DEBUG |
| 356 g_message("f: input_read_tag"); | 356 g_message("f: input_read_tag"); |
| 357 #endif | 357 #endif |
| 358 if (info->tuple != NULL) | 358 if (info->tuple != NULL) |
| 359 tuple_free(info->tuple); | 359 aud_tuple_free(info->tuple); |
| 360 | 360 |
| 361 tuple = tuple_new_from_filename(info->filename); | 361 tuple = aud_tuple_new_from_filename(info->filename); |
| 362 info->tuple = tuple; | 362 info->tuple = tuple; |
| 363 | 363 |
| 364 if(info->infile) { | 364 if(info->infile) { |
| 365 curpos = vfs_ftell(info->infile); | 365 curpos = vfs_ftell(info->infile); |
| 366 info->id3file = id3_file_vfsopen(info->infile, ID3_FILE_MODE_READONLY); | 366 info->id3file = id3_file_vfsopen(info->infile, ID3_FILE_MODE_READONLY); |
| 390 input_set_and_free_tag(info->tag, tuple, ID3_FRAME_GENRE, FIELD_GENRE); | 390 input_set_and_free_tag(info->tag, tuple, ID3_FRAME_GENRE, FIELD_GENRE); |
| 391 input_set_and_free_tag(info->tag, tuple, ID3_FRAME_COMMENT, FIELD_COMMENT); | 391 input_set_and_free_tag(info->tag, tuple, ID3_FRAME_COMMENT, FIELD_COMMENT); |
| 392 | 392 |
| 393 string = input_id3_get_string(info->tag, ID3_FRAME_TRACK); | 393 string = input_id3_get_string(info->tag, ID3_FRAME_TRACK); |
| 394 if (string) { | 394 if (string) { |
| 395 tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(string)); | 395 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, atoi(string)); |
| 396 g_free(string); | 396 g_free(string); |
| 397 string = NULL; | 397 string = NULL; |
| 398 } | 398 } |
| 399 | 399 |
| 400 // year | 400 // year |
| 402 string = input_id3_get_string(info->tag, ID3_FRAME_YEAR); //TDRC | 402 string = input_id3_get_string(info->tag, ID3_FRAME_YEAR); //TDRC |
| 403 if (!string) | 403 if (!string) |
| 404 string = input_id3_get_string(info->tag, "TYER"); | 404 string = input_id3_get_string(info->tag, "TYER"); |
| 405 | 405 |
| 406 if (string) { | 406 if (string) { |
| 407 tuple_associate_int(tuple, FIELD_YEAR, NULL, atoi(string)); | 407 aud_tuple_associate_int(tuple, FIELD_YEAR, NULL, atoi(string)); |
| 408 g_free(string); | 408 g_free(string); |
| 409 string = NULL; | 409 string = NULL; |
| 410 } | 410 } |
| 411 | 411 |
| 412 // length | 412 // length |
| 413 string = input_id3_get_string(info->tag, "TLEN"); | 413 string = input_id3_get_string(info->tag, "TLEN"); |
| 414 if (string) { | 414 if (string) { |
| 415 tuple_associate_int(tuple, FIELD_LENGTH, NULL, atoi(string)); | 415 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, atoi(string)); |
| 416 #ifdef DEBUG | 416 #ifdef DEBUG |
| 417 g_message("input_read_tag: TLEN = %d", atoi(string)); | 417 g_message("input_read_tag: TLEN = %d", atoi(string)); |
| 418 #endif | 418 #endif |
| 419 g_free(string); | 419 g_free(string); |
| 420 string = NULL; | 420 string = NULL; |
| 421 } else | 421 } else |
| 422 tuple_associate_int(tuple, FIELD_LENGTH, NULL, -1); | 422 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, -1); |
| 423 | 423 |
| 424 tuple_associate_string(tuple, FIELD_CODEC, NULL, "MPEG Audio (MP3)"); | 424 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, "MPEG Audio (MP3)"); |
| 425 tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); | 425 aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, "lossy"); |
| 426 | 426 |
| 427 info->title = tuple_formatter_make_title_string(tuple, audmad_config.title_override == TRUE ? | 427 info->title = aud_tuple_formatter_make_title_string(tuple, audmad_config.title_override == TRUE ? |
| 428 audmad_config.id3_format : get_gentitle_format()); | 428 audmad_config.id3_format : get_gentitle_format()); |
| 429 | 429 |
| 430 // for connection via proxy, we have to stop transfer once. I can't explain the reason. | 430 // for connection via proxy, we have to stop transfer once. I can't explain the reason. |
| 431 if (info->infile != NULL) { | 431 if (info->infile != NULL) { |
| 432 vfs_fseek(info->infile, -1, SEEK_SET); // an impossible request | 432 vfs_fseek(info->infile, -1, SEEK_SET); // an impossible request |
| 450 #endif | 450 #endif |
| 451 #endif | 451 #endif |
| 452 | 452 |
| 453 g_free(info->title); | 453 g_free(info->title); |
| 454 info->title = NULL; | 454 info->title = NULL; |
| 455 tuple_disassociate(info->tuple, FIELD_TITLE, NULL); | 455 aud_tuple_disassociate(info->tuple, FIELD_TITLE, NULL); |
| 456 tuple_disassociate(info->tuple, FIELD_ALBUM, NULL); | 456 aud_tuple_disassociate(info->tuple, FIELD_ALBUM, NULL); |
| 457 | 457 |
| 458 tmp = vfs_get_metadata(info->infile, "track-name"); | 458 tmp = vfs_get_metadata(info->infile, "track-name"); |
| 459 if(tmp){ | 459 if(tmp){ |
| 460 metadata = TRUE; | 460 metadata = TRUE; |
| 461 gchar *scratch; | 461 gchar *scratch; |
| 462 | 462 |
| 463 scratch = str_to_utf8(tmp); | 463 scratch = str_to_utf8(tmp); |
| 464 tuple_associate_string(info->tuple, FIELD_TITLE, NULL, scratch); | 464 aud_tuple_associate_string(info->tuple, FIELD_TITLE, NULL, scratch); |
| 465 g_free(scratch); | 465 g_free(scratch); |
| 466 | 466 |
| 467 g_free(tmp); | 467 g_free(tmp); |
| 468 tmp = NULL; | 468 tmp = NULL; |
| 469 } | 469 } |
| 472 if(tmp){ | 472 if(tmp){ |
| 473 metadata = TRUE; | 473 metadata = TRUE; |
| 474 gchar *scratch; | 474 gchar *scratch; |
| 475 | 475 |
| 476 scratch = str_to_utf8(tmp); | 476 scratch = str_to_utf8(tmp); |
| 477 tuple_associate_string(info->tuple, FIELD_ALBUM, NULL, scratch); | 477 aud_tuple_associate_string(info->tuple, FIELD_ALBUM, NULL, scratch); |
| 478 tuple_associate_string(info->tuple, -1, "stream", scratch); | 478 aud_tuple_associate_string(info->tuple, -1, "stream", scratch); |
| 479 g_free(scratch); | 479 g_free(scratch); |
| 480 | 480 |
| 481 g_free(tmp); | 481 g_free(tmp); |
| 482 tmp = NULL; | 482 tmp = NULL; |
| 483 } | 483 } |
| 484 | 484 |
| 485 if (metadata) | 485 if (metadata) |
| 486 tmp = tuple_formatter_process_string(info->tuple, "${?title:${title}}${?stream: (${stream})"); | 486 tmp = aud_tuple_formatter_process_string(info->tuple, "${?title:${title}}${?stream: (${stream})"); |
| 487 else { | 487 else { |
| 488 gchar *realfn = g_filename_from_uri(info->filename, NULL, NULL); | 488 gchar *realfn = g_filename_from_uri(info->filename, NULL, NULL); |
| 489 gchar *tmp2 = g_path_get_basename(realfn ? realfn : info->filename); // info->filename is uri. --yaz | 489 gchar *tmp2 = g_path_get_basename(realfn ? realfn : info->filename); // info->filename is uri. --yaz |
| 490 tmp = str_to_utf8(tmp2); | 490 tmp = str_to_utf8(tmp2); |
| 491 g_free(tmp2); tmp2 = NULL; | 491 g_free(tmp2); tmp2 = NULL; |
| 623 g_free(info->mp3gain_undo_str); | 623 g_free(info->mp3gain_undo_str); |
| 624 if (info->mp3gain_minmax_str) | 624 if (info->mp3gain_minmax_str) |
| 625 g_free(info->mp3gain_minmax_str); | 625 g_free(info->mp3gain_minmax_str); |
| 626 | 626 |
| 627 if (info->tuple) { | 627 if (info->tuple) { |
| 628 tuple_free(info->tuple); | 628 aud_tuple_free(info->tuple); |
| 629 info->tuple = NULL; | 629 info->tuple = NULL; |
| 630 } | 630 } |
| 631 | 631 |
| 632 if (info->prev_title) | 632 if (info->prev_title) |
| 633 g_free(info->prev_title); | 633 g_free(info->prev_title); |
