diff options
author | William Wilgus <me.theuser@yahoo.com> | 2019-07-20 04:46:14 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2019-07-20 04:50:57 -0500 |
commit | 6392e05476ab45f973dea611082d4dbcfe3db7cf (patch) | |
tree | 822bf4f073114560137caff34ea45f25a6fac009 /apps/plugin.c | |
parent | 55eb1c54ebe33faa8b1eb8c527d5644961ca78dc (diff) | |
download | rockbox-6392e05476ab45f973dea611082d4dbcfe3db7cf.tar.gz rockbox-6392e05476ab45f973dea611082d4dbcfe3db7cf.zip |
Plugin API
Reorganize Plugin functions in prep for API bump
Stub in sound_current
add sleep_timer
Change-Id: I74b3a433c86bd6cec43a7c45ae0d2db95c97bb60
Diffstat (limited to 'apps/plugin.c')
-rw-r--r-- | apps/plugin.c | 210 |
1 files changed, 119 insertions, 91 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 7d4199a607..12bfe485e5 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -84,7 +84,7 @@ char *plugin_get_current_filename(void); | |||
84 | static void* plugin_get_audio_buffer(size_t *buffer_size); | 84 | static void* plugin_get_audio_buffer(size_t *buffer_size); |
85 | static void plugin_release_audio_buffer(void); | 85 | static void plugin_release_audio_buffer(void); |
86 | static void plugin_tsr(bool (*exit_callback)(bool)); | 86 | static void plugin_tsr(bool (*exit_callback)(bool)); |
87 | 87 | int sound_current(int setting); /*stub*/ | |
88 | 88 | ||
89 | #ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE | 89 | #ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE |
90 | /* File handle leak prophylaxis */ | 90 | /* File handle leak prophylaxis */ |
@@ -182,6 +182,8 @@ static const struct plugin_api rockbox_api = { | |||
182 | language_strings, | 182 | language_strings, |
183 | 183 | ||
184 | /* lcd */ | 184 | /* lcd */ |
185 | splash, | ||
186 | splashf, | ||
185 | #ifdef HAVE_LCD_CONTRAST | 187 | #ifdef HAVE_LCD_CONTRAST |
186 | lcd_set_contrast, | 188 | lcd_set_contrast, |
187 | #endif | 189 | #endif |
@@ -203,7 +205,7 @@ static const struct plugin_api rockbox_api = { | |||
203 | lcd_remove_cursor, | 205 | lcd_remove_cursor, |
204 | lcd_icon, | 206 | lcd_icon, |
205 | lcd_double_height, | 207 | lcd_double_height, |
206 | #else | 208 | #else /* HAVE_LCD_BITMAP */ |
207 | &lcd_static_framebuffer[0][0], | 209 | &lcd_static_framebuffer[0][0], |
208 | lcd_set_viewport, | 210 | lcd_set_viewport, |
209 | lcd_set_framebuffer, | 211 | lcd_set_framebuffer, |
@@ -274,20 +276,6 @@ static const struct plugin_api rockbox_api = { | |||
274 | gui_scrollbar_draw, | 276 | gui_scrollbar_draw, |
275 | #endif /* HAVE_LCD_BITMAP */ | 277 | #endif /* HAVE_LCD_BITMAP */ |
276 | 278 | ||
277 | backlight_on, | ||
278 | backlight_off, | ||
279 | backlight_set_timeout, | ||
280 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
281 | backlight_set_brightness, | ||
282 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
283 | |||
284 | #if CONFIG_CHARGING | ||
285 | backlight_set_timeout_plugged, | ||
286 | #endif | ||
287 | is_backlight_on, | ||
288 | splash, | ||
289 | splashf, | ||
290 | |||
291 | #ifdef HAVE_REMOTE_LCD | 279 | #ifdef HAVE_REMOTE_LCD |
292 | /* remote lcd */ | 280 | /* remote lcd */ |
293 | lcd_remote_set_contrast, | 281 | lcd_remote_set_contrast, |
@@ -311,20 +299,7 @@ static const struct plugin_api rockbox_api = { | |||
311 | &lcd_remote_static_framebuffer[0][0], | 299 | &lcd_remote_static_framebuffer[0][0], |
312 | lcd_remote_update, | 300 | lcd_remote_update, |
313 | lcd_remote_update_rect, | 301 | lcd_remote_update_rect, |
314 | 302 | #if (LCD_REMOTE_DEPTH > 1) | |
315 | remote_backlight_on, | ||
316 | remote_backlight_off, | ||
317 | remote_backlight_set_timeout, | ||
318 | #if CONFIG_CHARGING | ||
319 | remote_backlight_set_timeout_plugged, | ||
320 | #endif | ||
321 | #endif /* HAVE_REMOTE_LCD */ | ||
322 | #if NB_SCREENS == 2 | ||
323 | {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]}, | ||
324 | #else | ||
325 | {&screens[SCREEN_MAIN]}, | ||
326 | #endif | ||
327 | #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) | ||
328 | lcd_remote_set_foreground, | 303 | lcd_remote_set_foreground, |
329 | lcd_remote_get_foreground, | 304 | lcd_remote_get_foreground, |
330 | lcd_remote_set_background, | 305 | lcd_remote_set_background, |
@@ -332,6 +307,13 @@ static const struct plugin_api rockbox_api = { | |||
332 | lcd_remote_bitmap_part, | 307 | lcd_remote_bitmap_part, |
333 | lcd_remote_bitmap, | 308 | lcd_remote_bitmap, |
334 | #endif | 309 | #endif |
310 | #endif /* HAVE_REMOTE_LCD */ | ||
311 | #if NB_SCREENS == 2 | ||
312 | {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]}, | ||
313 | #else | ||
314 | {&screens[SCREEN_MAIN]}, | ||
315 | #endif | ||
316 | |||
335 | viewport_set_defaults, | 317 | viewport_set_defaults, |
336 | #ifdef HAVE_LCD_BITMAP | 318 | #ifdef HAVE_LCD_BITMAP |
337 | viewportmanager_theme_enable, | 319 | viewportmanager_theme_enable, |
@@ -339,6 +321,35 @@ static const struct plugin_api rockbox_api = { | |||
339 | viewport_set_fullscreen, | 321 | viewport_set_fullscreen, |
340 | #endif | 322 | #endif |
341 | 323 | ||
324 | /* lcd backlight */ | ||
325 | /* The backlight_* functions must be present in the API regardless whether | ||
326 | * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has | ||
327 | * no backlight but can be modded to have backlight (it's prepared on the | ||
328 | * PCB). This makes backlight an all-target feature API wise, and keeps API | ||
329 | * compatible between stock and modded Ondio. | ||
330 | * For OLED targets like the Sansa Clip, the backlight_* functions control | ||
331 | * the display enable, which has essentially the same effect. */ | ||
332 | is_backlight_on, | ||
333 | backlight_on, | ||
334 | backlight_off, | ||
335 | backlight_set_timeout, | ||
336 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | ||
337 | backlight_set_brightness, | ||
338 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ | ||
339 | |||
340 | #if CONFIG_CHARGING | ||
341 | backlight_set_timeout_plugged, | ||
342 | #endif | ||
343 | |||
344 | #ifdef HAVE_REMOTE_LCD | ||
345 | remote_backlight_on, | ||
346 | remote_backlight_off, | ||
347 | remote_backlight_set_timeout, | ||
348 | #if CONFIG_CHARGING | ||
349 | remote_backlight_set_timeout_plugged, | ||
350 | #endif | ||
351 | #endif /* HAVE_REMOTE_LCD */ | ||
352 | |||
342 | /* list */ | 353 | /* list */ |
343 | gui_synclist_init, | 354 | gui_synclist_init, |
344 | gui_synclist_set_nb_items, | 355 | gui_synclist_set_nb_items, |
@@ -358,6 +369,14 @@ static const struct plugin_api rockbox_api = { | |||
358 | simplelist_info_init, | 369 | simplelist_info_init, |
359 | simplelist_show_list, | 370 | simplelist_show_list, |
360 | 371 | ||
372 | /* action handling */ | ||
373 | get_custom_action, | ||
374 | get_action, | ||
375 | #ifdef HAVE_TOUCHSCREEN | ||
376 | action_get_touchscreen_press, | ||
377 | #endif | ||
378 | action_userabort, | ||
379 | |||
361 | /* button */ | 380 | /* button */ |
362 | button_get, | 381 | button_get, |
363 | button_get_w_tmo, | 382 | button_get_w_tmo, |
@@ -426,6 +445,11 @@ static const struct plugin_api rockbox_api = { | |||
426 | /* browsing */ | 445 | /* browsing */ |
427 | browse_context_init, | 446 | browse_context_init, |
428 | rockbox_browse, | 447 | rockbox_browse, |
448 | tree_get_context, | ||
449 | tree_get_entries, | ||
450 | tree_get_entry_at, | ||
451 | set_current_file, | ||
452 | set_dirfilter, | ||
429 | 453 | ||
430 | /* talking */ | 454 | /* talking */ |
431 | talk_id, | 455 | talk_id, |
@@ -464,8 +488,14 @@ static const struct plugin_api rockbox_api = { | |||
464 | mutex_lock, | 488 | mutex_lock, |
465 | mutex_unlock, | 489 | mutex_unlock, |
466 | #endif | 490 | #endif |
467 | 491 | #ifdef HAVE_SEMAPHORE_OBJECTS | |
492 | semaphore_init, | ||
493 | semaphore_wait, | ||
494 | semaphore_release, | ||
495 | #endif | ||
468 | reset_poweroff_timer, | 496 | reset_poweroff_timer, |
497 | set_sleeptimer_duration, /*stub*/ | ||
498 | get_sleep_timer, /*stub*/ | ||
469 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 499 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
470 | system_memory_guard, | 500 | system_memory_guard, |
471 | &cpu_frequency, | 501 | &cpu_frequency, |
@@ -507,10 +537,7 @@ static const struct plugin_api rockbox_api = { | |||
507 | queue_send, | 537 | queue_send, |
508 | queue_reply, | 538 | queue_reply, |
509 | #endif | 539 | #endif |
510 | usb_acknowledge, | 540 | |
511 | #ifdef USB_ENABLE_HID | ||
512 | usb_hid_send, | ||
513 | #endif | ||
514 | #ifdef RB_PROFILE | 541 | #ifdef RB_PROFILE |
515 | profile_thread, | 542 | profile_thread, |
516 | profstop, | 543 | profstop, |
@@ -578,6 +605,7 @@ static const struct plugin_api rockbox_api = { | |||
578 | 605 | ||
579 | /* sound */ | 606 | /* sound */ |
580 | sound_set, | 607 | sound_set, |
608 | sound_current, /*stub*/ | ||
581 | sound_default, | 609 | sound_default, |
582 | sound_min, | 610 | sound_min, |
583 | sound_max, | 611 | sound_max, |
@@ -586,6 +614,10 @@ static const struct plugin_api rockbox_api = { | |||
586 | #ifdef AUDIOHW_HAVE_EQ | 614 | #ifdef AUDIOHW_HAVE_EQ |
587 | sound_enum_hw_eq_band_setting, | 615 | sound_enum_hw_eq_band_setting, |
588 | #endif | 616 | #endif |
617 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ | ||
618 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL) | ||
619 | sound_set_pitch, | ||
620 | #endif | ||
589 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 621 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
590 | mp3_play_data, | 622 | mp3_play_data, |
591 | mp3_play_pause, | 623 | mp3_play_pause, |
@@ -650,6 +682,37 @@ static const struct plugin_api rockbox_api = { | |||
650 | system_sound_play, | 682 | system_sound_play, |
651 | keyclick_click, | 683 | keyclick_click, |
652 | #endif /* CONFIG_CODEC == SWCODEC */ | 684 | #endif /* CONFIG_CODEC == SWCODEC */ |
685 | |||
686 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
687 | peak_meter_scale_value, | ||
688 | peak_meter_set_use_dbfs, | ||
689 | peak_meter_get_use_dbfs, | ||
690 | #endif | ||
691 | |||
692 | |||
693 | /* metadata */ | ||
694 | get_metadata, | ||
695 | mp3info, | ||
696 | count_mp3_frames, | ||
697 | create_xing_header, | ||
698 | find_next_frame, | ||
699 | #ifdef HAVE_TAGCACHE | ||
700 | tagcache_search, | ||
701 | tagcache_search_set_uniqbuf, | ||
702 | tagcache_search_add_filter, | ||
703 | tagcache_get_next, | ||
704 | tagcache_retrieve, | ||
705 | tagcache_search_finish, | ||
706 | tagcache_get_numeric, | ||
707 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
708 | tagcache_fill_tags, | ||
709 | #endif | ||
710 | #endif /* HAVE_TAGCACHE */ | ||
711 | |||
712 | #ifdef HAVE_ALBUMART | ||
713 | search_albumart_files, | ||
714 | #endif | ||
715 | |||
653 | /* playback control */ | 716 | /* playback control */ |
654 | playlist_amount, | 717 | playlist_amount, |
655 | playlist_resume, | 718 | playlist_resume, |
@@ -677,10 +740,6 @@ static const struct plugin_api rockbox_api = { | |||
677 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | 740 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
678 | mpeg_get_last_header, | 741 | mpeg_get_last_header, |
679 | #endif | 742 | #endif |
680 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ | ||
681 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL) | ||
682 | sound_set_pitch, | ||
683 | #endif | ||
684 | 743 | ||
685 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) | 744 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
686 | /* MAS communication */ | 745 | /* MAS communication */ |
@@ -722,14 +781,6 @@ static const struct plugin_api rockbox_api = { | |||
722 | set_color, | 781 | set_color, |
723 | #endif | 782 | #endif |
724 | 783 | ||
725 | /* action handling */ | ||
726 | get_custom_action, | ||
727 | get_action, | ||
728 | #ifdef HAVE_TOUCHSCREEN | ||
729 | action_get_touchscreen_press, | ||
730 | #endif | ||
731 | action_userabort, | ||
732 | |||
733 | /* power */ | 784 | /* power */ |
734 | battery_level, | 785 | battery_level, |
735 | battery_level_safe, | 786 | battery_level_safe, |
@@ -741,8 +792,12 @@ static const struct plugin_api rockbox_api = { | |||
741 | charging_state, | 792 | charging_state, |
742 | # endif | 793 | # endif |
743 | #endif | 794 | #endif |
795 | /* usb */ | ||
744 | usb_inserted, | 796 | usb_inserted, |
745 | 797 | usb_acknowledge, | |
798 | #ifdef USB_ENABLE_HID | ||
799 | usb_hid_send, | ||
800 | #endif | ||
746 | /* misc */ | 801 | /* misc */ |
747 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) | 802 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
748 | __errno, | 803 | __errno, |
@@ -757,14 +812,7 @@ static const struct plugin_api rockbox_api = { | |||
757 | #if CONFIG_RTC | 812 | #if CONFIG_RTC |
758 | mktime, | 813 | mktime, |
759 | #endif | 814 | #endif |
760 | plugin_get_buffer, | 815 | |
761 | plugin_get_audio_buffer, /* defined in plugin.c */ | ||
762 | plugin_release_audio_buffer, /* defined in plugin.c */ | ||
763 | plugin_tsr, /* defined in plugin.c */ | ||
764 | plugin_get_current_filename, | ||
765 | #ifdef PLUGIN_USE_IRAM | ||
766 | audio_hard_stop, | ||
767 | #endif | ||
768 | #if defined(DEBUG) || defined(SIMULATOR) | 816 | #if defined(DEBUG) || defined(SIMULATOR) |
769 | debugf, | 817 | debugf, |
770 | #endif | 818 | #endif |
@@ -781,16 +829,7 @@ static const struct plugin_api rockbox_api = { | |||
781 | remove_array_ptr, | 829 | remove_array_ptr, |
782 | round_value_to_list32, | 830 | round_value_to_list32, |
783 | #endif /* CONFIG_CODEC == SWCODEC */ | 831 | #endif /* CONFIG_CODEC == SWCODEC */ |
784 | get_metadata, | 832 | |
785 | mp3info, | ||
786 | count_mp3_frames, | ||
787 | create_xing_header, | ||
788 | find_next_frame, | ||
789 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
790 | peak_meter_scale_value, | ||
791 | peak_meter_set_use_dbfs, | ||
792 | peak_meter_get_use_dbfs, | ||
793 | #endif | ||
794 | #ifdef HAVE_LCD_BITMAP | 833 | #ifdef HAVE_LCD_BITMAP |
795 | read_bmp_file, | 834 | read_bmp_file, |
796 | read_bmp_fd, | 835 | read_bmp_fd, |
@@ -801,11 +840,6 @@ static const struct plugin_api rockbox_api = { | |||
801 | screen_dump_set_hook, | 840 | screen_dump_set_hook, |
802 | #endif | 841 | #endif |
803 | show_logo, | 842 | show_logo, |
804 | tree_get_context, | ||
805 | tree_get_entries, | ||
806 | tree_get_entry_at, | ||
807 | set_current_file, | ||
808 | set_dirfilter, | ||
809 | 843 | ||
810 | #ifdef HAVE_WHEEL_POSITION | 844 | #ifdef HAVE_WHEEL_POSITION |
811 | wheel_status, | 845 | wheel_status, |
@@ -819,27 +853,15 @@ static const struct plugin_api rockbox_api = { | |||
819 | detect_flashed_romimage, | 853 | detect_flashed_romimage, |
820 | #endif | 854 | #endif |
821 | led, | 855 | led, |
822 | #ifdef HAVE_TAGCACHE | ||
823 | tagcache_search, | ||
824 | tagcache_search_set_uniqbuf, | ||
825 | tagcache_search_add_filter, | ||
826 | tagcache_get_next, | ||
827 | tagcache_retrieve, | ||
828 | tagcache_search_finish, | ||
829 | tagcache_get_numeric, | ||
830 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | ||
831 | tagcache_fill_tags, | ||
832 | #endif | ||
833 | #endif | ||
834 | |||
835 | #ifdef HAVE_ALBUMART | ||
836 | search_albumart_files, | ||
837 | #endif | ||
838 | 856 | ||
839 | #ifdef HAVE_SEMAPHORE_OBJECTS | 857 | /*plugin*/ |
840 | semaphore_init, | 858 | plugin_get_buffer, |
841 | semaphore_wait, | 859 | plugin_get_audio_buffer, /* defined in plugin.c */ |
842 | semaphore_release, | 860 | plugin_release_audio_buffer, /* defined in plugin.c */ |
861 | plugin_tsr, /* defined in plugin.c */ | ||
862 | plugin_get_current_filename, | ||
863 | #ifdef PLUGIN_USE_IRAM | ||
864 | audio_hard_stop, | ||
843 | #endif | 865 | #endif |
844 | 866 | ||
845 | /* new stuff at the end, sort into place next time | 867 | /* new stuff at the end, sort into place next time |
@@ -1060,3 +1082,9 @@ char *plugin_get_current_filename(void) | |||
1060 | { | 1082 | { |
1061 | return current_plugin; | 1083 | return current_plugin; |
1062 | } | 1084 | } |
1085 | |||
1086 | int sound_current(int setting) /*stub*/ | ||
1087 | { | ||
1088 | (void) setting; | ||
1089 | return 0; | ||
1090 | } | ||