Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Show Track Info: Support fs tags in Playlist Viewer, Properties, and PictureFlow

Playlist Viewer falls back to splashf if there is not
enough plugin buffer space left for running the
view_text plugin .

Change-Id: I418731018b03f396270b68e5e2d2e69635df1af0

+85 -23
+1 -1
apps/gui/wps.c
··· 1044 1044 gwps_leave_wps(true); 1045 1045 if (browse_id3(audio_current_track(), 1046 1046 playlist_get_display_index(), 1047 - playlist_amount(), NULL, 1)) 1047 + playlist_amount(), NULL, 1, NULL)) 1048 1048 return GO_TO_ROOT; 1049 1049 restore = true; 1050 1050 }
+1 -1
apps/onplay.c
··· 700 700 701 701 if (browse_id3(audio_current_track(), 702 702 playlist_get_display_index(), 703 - playlist_amount(), NULL, 1)) 703 + playlist_amount(), NULL, 1, NULL)) 704 704 return GO_TO_ROOT; 705 705 return GO_TO_PREVIOUS; 706 706 }
+45 -4
apps/playlist_viewer.c
··· 55 55 /* Maximum number of tracks we can have loaded at one time */ 56 56 #define MAX_PLAYLIST_ENTRIES 200 57 57 58 + /* Maximum amount of space required for the name buffer. For each 59 + entry, we store the file name as well as, possibly, metadata */ 60 + #define MAX_NAME_BUFFER_SZ (MAX_PLAYLIST_ENTRIES * 2 * MAX_PATH) 61 + 62 + /* Over-approximation of view_text plugin size */ 63 + #define VIEW_TEXT_PLUGIN_SZ 5000 64 + 58 65 /* The number of items between the selected one and the end/start of 59 66 * the buffer under which the buffer must reload */ 60 67 #define MIN_BUFFER_MARGIN (screens[0].getnblines()+1) ··· 116 123 viewer-relative index) of moving track */ 117 124 struct playlist_buffer buffer; 118 125 struct mp3entry *id3; 126 + bool allow_view_text_plugin; 119 127 }; 120 128 121 129 struct playlist_search_data ··· 392 400 if (!buffer || buffer_size <= MAX_PATH + id3_size) 393 401 return false; 394 402 403 + /* Index buffer is required, unless playback is stopped or we're 404 + showing the current playlist (i.e. filename == NULL) */ 405 + if (filename && is_playing) 406 + index_buffer_size = playlist_get_index_bufsz(buffer_size - id3_size - (MAX_PATH + 1)); 407 + 408 + /* Check for unused space in the plugin buffer to run 409 + the view_text plugin used by the Track Info screen: 410 + ┌───────┬───────────────────────────────────────────────────────┐ 411 + │ │<----------------- plugin_get_buffer ----------------->│ 412 + │ (TSR ├───────────────┬─────┬──────────────┬───────────────┐ │ 413 + │plugin)│██ view_text ██│ id3 │ index buffer │ name buffer │ │ 414 + └───────┴───────────────┴─────┴──────────────┴───────────────┴──┘ 415 + */ 416 + if (buffer_size >= VIEW_TEXT_PLUGIN_SZ + id3_size + index_buffer_size + MAX_NAME_BUFFER_SZ) 417 + { 418 + buffer += VIEW_TEXT_PLUGIN_SZ; 419 + buffer_size -= VIEW_TEXT_PLUGIN_SZ; 420 + viewer->allow_view_text_plugin = true; 421 + } 422 + else 423 + viewer->allow_view_text_plugin = false; 424 + 395 425 viewer->id3 = (void *) buffer; 396 426 buffer += id3_size; 397 427 buffer_size -= id3_size; ··· 425 455 if (is_playing) 426 456 { 427 457 index_buffer = buffer; 428 - index_buffer_size = playlist_get_index_bufsz(buffer_size - (MAX_PATH + 1)); 429 - 430 458 buffer += index_buffer_size; 431 459 buffer_size -= index_buffer_size; 432 460 } ··· 577 605 } 578 606 } 579 607 608 + /* Fallback for displaying fullscreen tags, in case there is not 609 + * enough plugin buffer space left to call the view_text plugin 610 + * from the Track Info screen 611 + */ 612 + static int view_text(const char *title, const char *text) 613 + { 614 + splashf(0, "[%s]\n%s", title, text); 615 + action_userabort(TIMEOUT_BLOCK); 616 + return 0; 617 + } 618 + 580 619 static enum pv_onplay_result show_track_info(const struct playlist_entry *current_track) 581 620 { 582 621 bool id3_retrieval_successful = retrieve_id3_tags(current_track->index, 583 622 current_track->name, 584 623 viewer.id3, 0); 585 624 586 - return id3_retrieval_successful && 625 + return (id3_retrieval_successful && 587 626 browse_id3_ex(viewer.id3, viewer.playlist, current_track->display_index, 588 - viewer.num_tracks, NULL, 1) ? PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED; 627 + viewer.num_tracks, NULL, 1, 628 + viewer.allow_view_text_plugin ? NULL : &view_text)) ? 629 + PV_ONPLAY_USB : PV_ONPLAY_UNCHANGED; 589 630 } 590 631 591 632 static void close_playlist_viewer(void)
+3 -2
apps/plugin.h
··· 174 174 * when this happens please take the opportunity to sort in 175 175 * any new functions "waiting" at the end of the list. 176 176 */ 177 - #define PLUGIN_API_VERSION 272 177 + #define PLUGIN_API_VERSION 273 178 178 179 179 /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ 180 180 ··· 513 513 void (*add_to_pl_cb)); 514 514 bool (*browse_id3)(struct mp3entry *id3, 515 515 int playlist_display_index, int playlist_amount, 516 - struct tm *modified, int track_ct); 516 + struct tm *modified, int track_ct, 517 + int (*view_text)(const char *title, const char *text)); 517 518 518 519 /* talking */ 519 520 int (*talk_id)(int32_t id, bool enqueue);
+1 -1
apps/plugins/CATEGORIES
··· 207 207 xrick,games 208 208 xworld,games 209 209 zxbox,viewers 210 - view_text,viewers 210 + view_text,viewers
+1 -1
apps/plugins/SOURCES
··· 238 238 #endif 239 239 test_usb.c 240 240 test_viewports.c 241 - #endif /* HAVE_TEST_PLUGINS */ 241 + #endif /* HAVE_TEST_PLUGINS */
+2 -1
apps/plugins/pictureflow/pictureflow.c
··· 33 33 #include "lib/grey.h" 34 34 #include "lib/mylcd.h" 35 35 #include "lib/feature_wrappers.h" 36 + #include "lib/simple_viewer.h" 36 37 37 38 /******************************* Globals ***********************************/ 38 39 static fb_data *lcd_fb; ··· 4082 4083 if (is_multiple_tracks) 4083 4084 finalize_id3(&id3); 4084 4085 4085 - return rb->browse_id3(&id3, 0, 0, NULL, i) ? PLUGIN_USB_CONNECTED : 0; 4086 + return rb->browse_id3(&id3, 0, 0, NULL, i, &view_text) ? PLUGIN_USB_CONNECTED : 0; 4086 4087 } 4087 4088 4088 4089
+8 -4
apps/plugins/properties.c
··· 20 20 ****************************************************************************/ 21 21 #include "plugin.h" 22 22 #include "lib/mul_id3.h" 23 + #include "lib/simple_viewer.h" 23 24 24 25 #if !defined(ARRAY_SIZE) 25 26 #define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) ··· 339 340 } 340 341 } 341 342 else if (props_type == PROPS_ID3) 342 - ret = rb->browse_id3(&id3, 0, 0, &tm, 1); /* Track Info for single file */ 343 + /* Track Info for single file */ 344 + ret = rb->browse_id3(&id3, 0, 0, &tm, 1, &view_text); 343 345 else if (props_type == PROPS_MUL_ID3) 344 - ret = rb->browse_id3(&id3, 0, 0, NULL, mul_id3_count); /* database tracks */ 346 + /* database tracks */ 347 + ret = rb->browse_id3(&id3, 0, 0, NULL, mul_id3_count, &view_text); 345 348 else if ((ret = browse_file_or_dir(&stats)) < 0) 346 - ret = assemble_track_info(file, &stats) ? /* playlist or folder tracks */ 347 - rb->browse_id3(&id3, 0, 0, NULL, mul_id3_count) : 349 + ret = assemble_track_info(file, &stats) ? 350 + /* playlist or folder tracks */ 351 + rb->browse_id3(&id3, 0, 0, NULL, mul_id3_count, &view_text) : 348 352 (stats.canceled ? 0 : -1); 349 353 350 354 return ret == -1 ? PLUGIN_ERROR : ret == 1 ? PLUGIN_USB_CONNECTED : PLUGIN_OK;
+1 -1
apps/plugins/view_text.c
··· 28 28 /* this is the plugin entry point */ 29 29 enum plugin_status plugin_start(const void* parameter) 30 30 { 31 - 31 + 32 32 char** title_and_text = (char**)parameter; 33 33 view_text(title_and_text[0], title_and_text[1]); 34 34 return PLUGIN_OK;
+18 -5
apps/screens.c
··· 777 777 */ 778 778 bool browse_id3_ex(struct mp3entry *id3, struct playlist_info *playlist, 779 779 int playlist_display_index, int playlist_amount, 780 - struct tm *modified, int track_ct) 780 + struct tm *modified, int track_ct, 781 + int (*view_text)(const char *title, const char *text)) 781 782 { 782 783 struct gui_synclist id3_lists; 783 784 int key; ··· 824 825 825 826 char buffer[MAX_PATH]; 826 827 title_and_text[1] = (char*)id3_get_or_speak_info(id3_lists.selected_item+1,&info, buffer, sizeof(buffer), false); 827 - plugin_load(VIEWERS_DIR"/view_text.rock", title_and_text); 828 + 829 + if (view_text) 830 + { 831 + FOR_NB_SCREENS(i) 832 + viewportmanager_theme_enable(i, false, NULL); 833 + view_text(title_and_text[0], title_and_text[1]); 834 + FOR_NB_SCREENS(i) 835 + viewportmanager_theme_undo(i, false); 836 + } 837 + else 838 + plugin_load(VIEWERS_DIR"/view_text.rock", title_and_text); 839 + gui_synclist_set_title(&id3_lists, str(LANG_TRACK_INFO), NOICON); 828 840 gui_synclist_draw(&id3_lists); 829 841 continue; 830 842 } ··· 839 851 ret = true; 840 852 break; 841 853 } 842 - } 854 + } 843 855 else if (is_curr_track_info) 844 856 { 845 857 if (!audio_status()) ··· 861 873 } 862 874 863 875 bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, 864 - struct tm *modified, int track_ct) 876 + struct tm *modified, int track_ct, 877 + int (*view_text)(const char *title, const char *text)) 865 878 { 866 879 return browse_id3_ex(id3, NULL, playlist_display_index, playlist_amount, 867 - modified, track_ct); 880 + modified, track_ct, view_text); 868 881 } 869 882 870 883 static const char* runtime_get_data(int selected_item, void* data,
+4 -2
apps/screens.h
··· 45 45 #ifndef WARBLE 46 46 bool browse_id3_ex(struct mp3entry *id3, struct playlist_info *playlist, 47 47 int playlist_display_index, int playlist_amount, 48 - struct tm *modified, int track_ct); 48 + struct tm *modified, int track_ct, 49 + int (*view_text)(const char *title, const char *text)); 49 50 #endif 50 51 bool browse_id3(struct mp3entry *id3, int playlist_display_index, int playlist_amount, 51 - struct tm *modified, int track_ct); 52 + struct tm *modified, int track_ct, 53 + int (*view_text)(const char *title, const char *text)); 52 54 int view_runtime(void); 53 55 54 56 #ifdef HAVE_TOUCHSCREEN