comparison src/madplug/plugin.c @ 738:6ea974a229a8 trunk

[svn] - add read/write support for TLEN frame.
author yaz
date Tue, 27 Feb 2007 04:17:49 -0800
parents 1733b12ef974
children 7ffb93bce2d2
comparison
equal deleted inserted replaced
737:eecd54a11610 738:6ea974a229a8
400 if (input_get_info(&myinfo, info.remote ? TRUE : audmad_config.fast_play_time_calc) == TRUE) { 400 if (input_get_info(&myinfo, info.remote ? TRUE : audmad_config.fast_play_time_calc) == TRUE) {
401 if(myinfo.tuple->track_name) 401 if(myinfo.tuple->track_name)
402 *title = strdup(myinfo.tuple->track_name); 402 *title = strdup(myinfo.tuple->track_name);
403 else 403 else
404 *title = strdup(url); 404 *title = strdup(url);
405 *length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS); 405 if(myinfo.tuple->length == -1)
406 *length = mad_timer_count(myinfo.duration, MAD_UNITS_MILLISECONDS);
407 else
408 *length = myinfo.tuple->length;
406 } 409 }
407 else { 410 else {
408 *title = strdup(url); 411 *title = strdup(url);
409 *length = -1; 412 *length = -1;
410 } 413 }
553 tuple->file_name = g_path_get_basename(filename); 556 tuple->file_name = g_path_get_basename(filename);
554 tuple->file_path = g_path_get_dirname(filename); 557 tuple->file_path = g_path_get_dirname(filename);
555 tuple->file_ext = extname(filename); 558 tuple->file_ext = extname(filename);
556 559
557 // length 560 // length
558 { 561 tuple->length = -1;
562 string = input_id3_get_string(tag, "TLEN");
563 if (string) {
564 tuple->length = atoi(string);
565 #ifdef DEBUG
566 printf("get_song_tuple: TLEN = %d\n", tuple->length);
567 #endif
568 g_free(string);
569 string = NULL;
570 }
571 else {
559 char *dummy = NULL; 572 char *dummy = NULL;
560 int length = 0; 573 int length = 0;
561 audmad_get_song_info(filename, &dummy, &length); 574 audmad_get_song_info(filename, &dummy, &length);
562 tuple->length = length; 575 tuple->length = length;
563 g_free(dummy); 576 g_free(dummy);
580 input_id3_get_string(tag, ID3_FRAME_COMMENT); 593 input_id3_get_string(tag, ID3_FRAME_COMMENT);
581 594
582 } 595 }
583 id3_file_close(id3file); 596 id3_file_close(id3file);
584 } 597 }
585 else { 598 else { // no id3tag
586 tuple->file_name = g_path_get_basename(filename); 599 tuple->file_name = g_path_get_basename(filename);
587 tuple->file_path = g_path_get_dirname(filename); 600 tuple->file_path = g_path_get_dirname(filename);
588 tuple->file_ext = extname(filename); 601 tuple->file_ext = extname(filename);
589 // length 602 // length
590 { 603 {
591 char *dummy = NULL; 604 char *dummy = NULL;
592 int length = 0; 605 int length = 0;
593 audmad_get_song_info(filename, &dummy, &length); 606 if(tuple->length == -1) {
594 tuple->length = length; 607 audmad_get_song_info(filename, &dummy, &length);
608 tuple->length = length;
609 }
595 g_free(dummy); 610 g_free(dummy);
596 } 611 }
597 } 612 }
598 vfs_fclose(file); 613 vfs_fclose(file);
599 } 614 }