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.

root_menu move tag cache init check to pictureflow plugin

let pictureflow decide if the tag cache is ready instead of core

Change-Id: I2ab9b375d773dbbc28ea41fbf7bb6fb361ace8fd

+54 -28
+4
apps/plugin.c
··· 803 803 804 804 /* new stuff at the end, sort into place next time 805 805 the API gets incompatible */ 806 + 807 + #ifdef HAVE_TAGCACHE 808 + tagcache_get_stat, 809 + #endif 806 810 }; 807 811 808 812 static int plugin_buffer_handle;
+6 -1
apps/plugin.h
··· 154 154 #define PLUGIN_MAGIC 0x526F634B /* RocK */ 155 155 156 156 /* increase this every time the api struct changes */ 157 - #define PLUGIN_API_VERSION 239 157 + #define PLUGIN_API_VERSION 240 158 158 159 159 /* update this to latest version if a change to the api struct breaks 160 160 backwards compatibility (and please take the opportunity to sort in any ··· 930 930 931 931 /* new stuff at the end, sort into place next time 932 932 the API gets incompatible */ 933 + 934 + #ifdef HAVE_TAGCACHE 935 + struct tagcache_stat* (*tagcache_get_stat)(void); 936 + #endif 937 + 933 938 }; 934 939 935 940 /* plugin header */
+31
apps/plugins/pictureflow/pictureflow.c
··· 530 530 static void draw_splashscreen(unsigned char * buf_tmp, size_t buf_tmp_size); 531 531 static void free_all_slide_prio(int prio); 532 532 533 + static bool check_database(bool prompt) 534 + { 535 + bool needwarn = true; 536 + struct tagcache_stat *stat = rb->tagcache_get_stat(); 537 + while ( !(stat->initialized && stat->ready) ) 538 + { 539 + if (needwarn) 540 + rb->splash(0, ID2P(LANG_TAGCACHE_BUSY)); 541 + if (!prompt) 542 + return false; 543 + else if (rb->action_userabort(HZ/5)) 544 + return false; 545 + 546 + needwarn = false; 547 + stat = rb->tagcache_get_stat(); 548 + rb->yield(); 549 + } 550 + return true; 551 + } 552 + 533 553 static bool confirm_quit(void) 534 554 { 535 555 const struct text_message prompt = ··· 3821 3841 3822 3842 void * buf; 3823 3843 size_t buf_size; 3844 + bool prompt = (parameter && ((char *) parameter)[0] == ACTIVITY_MAINMENU); 3845 + 3846 + if (!check_database(prompt)) 3847 + { 3848 + if (prompt) 3849 + return PLUGIN_OK; 3850 + else 3851 + error_wait("Please enable database"); 3852 + 3853 + return PLUGIN_ERROR; 3854 + } 3824 3855 3825 3856 atexit(cleanup); 3826 3857
+13 -27
apps/root_menu.c
··· 704 704 } 705 705 706 706 #ifdef HAVE_PICTUREFLOW_INTEGRATION 707 - static int load_plugin_screen(char *plug_path) 707 + static int load_plugin_screen(char *plug_path, void* plug_param) 708 708 { 709 709 int ret_val; 710 710 int old_previous = last_screen; ··· 712 712 global_status.last_screen = (char)next_screen; 713 713 status_save(); 714 714 715 - switch (plugin_load(plug_path, NULL)) 715 + switch (plugin_load(plug_path, plug_param)) 716 716 { 717 717 case PLUGIN_GOTO_WPS: 718 718 ret_val = GO_TO_WPS; ··· 728 728 if (ret_val == GO_TO_PREVIOUS) 729 729 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous; 730 730 return ret_val; 731 - } 732 - 733 - static bool check_database(void) 734 - { 735 - bool needwarn = true; 736 - while ( !tagcache_is_usable() ) 737 - { 738 - if (needwarn) 739 - splash(0, ID2P(LANG_TAGCACHE_BUSY)); 740 - if ( action_userabort(HZ/5) ) 741 - return false; 742 - needwarn = false; 743 - } 744 - return true; 745 731 } 746 732 #endif 747 733 ··· 823 809 break; 824 810 #ifdef HAVE_PICTUREFLOW_INTEGRATION 825 811 case GO_TO_PICTUREFLOW: 826 - if (check_database()) 827 - { 828 - char pf_path[MAX_PATH]; 829 - snprintf(pf_path, sizeof(pf_path), 830 - "%s/pictureflow.rock", 831 - PLUGIN_DEMOS_DIR); 832 - next_screen = load_plugin_screen(pf_path); 833 - previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PICTUREFLOW; 834 - } 835 - else 836 - next_screen = GO_TO_PREVIOUS; 812 + { 813 + char pf_path[MAX_PATH]; 814 + char activity[6];/* big enough to display int */ 815 + snprintf(activity, sizeof(activity), "%d", get_current_activity()); 816 + snprintf(pf_path, sizeof(pf_path), 817 + "%s/pictureflow.rock", 818 + PLUGIN_DEMOS_DIR); 819 + 820 + next_screen = load_plugin_screen(pf_path, &activity); 821 + previous_browser = (next_screen != GO_TO_WPS) ? GO_TO_FILEBROWSER : GO_TO_PICTUREFLOW; 837 822 break; 823 + } 838 824 #endif 839 825 default: 840 826 #ifdef HAVE_TAGCACHE