diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2023-04-04 21:35:51 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2023-04-13 02:31:32 +0200 |
commit | 6ca57ec389e9dd2141f9c9e73063c7193526dbbd (patch) | |
tree | 2cedbe36f75467fe9fb266c985c477983fa66629 /apps/screens.c | |
parent | 78c92c5ca85d275e43bacf0d9948ce9b94605f6e (diff) | |
download | rockbox-6ca57ec389e9dd2141f9c9e73063c7193526dbbd.tar.gz rockbox-6ca57ec389e9dd2141f9c9e73063c7193526dbbd.zip |
Track Info: Display larger file size and length values
When displaying Track Info for multiple tracks,
the value for combined file sizes or length was
capped at 2 GiB / ~596h.
Limit has been raised by a factor of 1000.
Change-Id: I942c64e81864cba3f719c83a24912883fafeb70e
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/apps/screens.c b/apps/screens.c index 869d081498..c519da9353 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -394,6 +394,7 @@ static const int id3_headers[]= | |||
394 | struct id3view_info { | 394 | struct id3view_info { |
395 | struct mp3entry* id3; | 395 | struct mp3entry* id3; |
396 | struct tm *modified; | 396 | struct tm *modified; |
397 | bool multiple_tracks; | ||
397 | int count; | 398 | int count; |
398 | int playlist_display_index; | 399 | int playlist_display_index; |
399 | int playlist_amount; | 400 | int playlist_amount; |
@@ -491,6 +492,9 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, | |||
491 | { | 492 | { |
492 | struct id3view_info *info = (struct id3view_info*)data; | 493 | struct id3view_info *info = (struct id3view_info*)data; |
493 | struct mp3entry* id3 =info->id3; | 494 | struct mp3entry* id3 =info->id3; |
495 | const unsigned char * const *unit; | ||
496 | unsigned int unit_ct; | ||
497 | unsigned long length; | ||
494 | struct tm *tm = info->modified; | 498 | struct tm *tm = info->modified; |
495 | int info_no=selected_item/2; | 499 | int info_no=selected_item/2; |
496 | if(!(selected_item%2)) | 500 | if(!(selected_item%2)) |
@@ -593,10 +597,13 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, | |||
593 | } | 597 | } |
594 | break; | 598 | break; |
595 | case LANG_ID3_LENGTH: | 599 | case LANG_ID3_LENGTH: |
596 | format_time(buffer, buffer_len, id3->length); | 600 | length = info->multiple_tracks ? id3->length : id3->length / 1000; |
601 | |||
602 | format_time_auto(buffer, buffer_len, | ||
603 | length, UNIT_SEC | UNIT_TRIM_ZERO, true); | ||
597 | val=buffer; | 604 | val=buffer; |
598 | if(say_it) | 605 | if(say_it) |
599 | talk_value(id3->length /1000, UNIT_TIME, true); | 606 | talk_value(length, UNIT_TIME, true); |
600 | break; | 607 | break; |
601 | case LANG_ID3_PLAYLIST: | 608 | case LANG_ID3_PLAYLIST: |
602 | if (info->playlist_display_index == 0 || info->playlist_amount == 0 ) | 609 | if (info->playlist_display_index == 0 || info->playlist_amount == 0 ) |
@@ -667,10 +674,20 @@ static const char * id3_get_or_speak_info(int selected_item, void* data, | |||
667 | case LANG_FILESIZE: /* not LANG_ID3_FILESIZE because the string is shared */ | 674 | case LANG_FILESIZE: /* not LANG_ID3_FILESIZE because the string is shared */ |
668 | if (!id3->filesize) | 675 | if (!id3->filesize) |
669 | return NULL; | 676 | return NULL; |
670 | output_dyn_value(buffer, buffer_len, id3->filesize, byte_units, 4, true); | 677 | if (info->multiple_tracks) |
678 | { | ||
679 | unit = kibyte_units; | ||
680 | unit_ct = 3; | ||
681 | } | ||
682 | else | ||
683 | { | ||
684 | unit = byte_units; | ||
685 | unit_ct = 4; | ||
686 | } | ||
687 | output_dyn_value(buffer, buffer_len, id3->filesize, unit, unit_ct, true); | ||
671 | val=buffer; | 688 | val=buffer; |
672 | if(say_it && val) | 689 | if(say_it && val) |
673 | output_dyn_value(NULL, 0, id3->filesize, byte_units, 4, true); | 690 | output_dyn_value(NULL, 0, id3->filesize, unit, unit_ct, true); |
674 | break; | 691 | break; |
675 | case LANG_DATE: | 692 | case LANG_DATE: |
676 | if (!tm) | 693 | if (!tm) |
@@ -720,8 +737,11 @@ static int id3_speak_item(int selected_item, void* data) | |||
720 | return 0; | 737 | return 0; |
721 | } | 738 | } |
722 | 739 | ||
740 | /* Note: Setting multiple_tracks parameter to true causes filesize value | ||
741 | * to be treated as KiB (instead of Bytes), and length as s instead of ms. | ||
742 | */ | ||
723 | bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, | 743 | bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, |
724 | struct tm *modified) | 744 | struct tm *modified, bool multiple_tracks) |
725 | { | 745 | { |
726 | struct gui_synclist id3_lists; | 746 | struct gui_synclist id3_lists; |
727 | int key; | 747 | int key; |
@@ -730,6 +750,7 @@ bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_a | |||
730 | info.count = 0; | 750 | info.count = 0; |
731 | info.id3 = id3; | 751 | info.id3 = id3; |
732 | info.modified = modified; | 752 | info.modified = modified; |
753 | info.multiple_tracks = multiple_tracks; | ||
733 | info.playlist_display_index = playlist_display_index; | 754 | info.playlist_display_index = playlist_display_index; |
734 | info.playlist_amount = playlist_amount; | 755 | info.playlist_amount = playlist_amount; |
735 | bool ret = false; | 756 | bool ret = false; |