A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

mpegplayer: One last dealie-O for now: Change all "WVS" usage in the code for identifiers to "OSD".

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25873 a1c6a512-1295-4272-9138-f99709370657

+320 -320
+320 -320
apps/plugins/mpegplayer/mpegplayer.c
··· 363 363 #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ 364 364 /* 3% of 30min file == 54s step size */ 365 365 #define MIN_FF_REWIND_STEP (TS_SECOND/2) 366 - #define WVS_MIN_UPDATE_INTERVAL (HZ/2) 366 + #define OSD_MIN_UPDATE_INTERVAL (HZ/2) 367 367 368 - /* WVS status - same order as icon array */ 369 - enum wvs_status_enum 368 + /* OSD status - same order as icon array */ 369 + enum osd_status_enum 370 370 { 371 - WVS_STATUS_STOPPED = 0, 372 - WVS_STATUS_PAUSED, 373 - WVS_STATUS_PLAYING, 374 - WVS_STATUS_FF, 375 - WVS_STATUS_RW, 376 - WVS_STATUS_COUNT, 377 - WVS_STATUS_MASK = 0x7 371 + OSD_STATUS_STOPPED = 0, 372 + OSD_STATUS_PAUSED, 373 + OSD_STATUS_PLAYING, 374 + OSD_STATUS_FF, 375 + OSD_STATUS_RW, 376 + OSD_STATUS_COUNT, 377 + OSD_STATUS_MASK = 0x7 378 378 }; 379 379 380 - enum wvs_bits 380 + enum osd_bits 381 381 { 382 - WVS_REFRESH_DEFAULT = 0x0000, /* Only refresh elements when due */ 382 + OSD_REFRESH_DEFAULT = 0x0000, /* Only refresh elements when due */ 383 383 /* Refresh the... */ 384 - WVS_REFRESH_VOLUME = 0x0001, /* ...volume display */ 385 - WVS_REFRESH_TIME = 0x0002, /* ...time display+progress */ 386 - WVS_REFRESH_STATUS = 0x0004, /* ...playback status icon */ 387 - WVS_REFRESH_BACKGROUND = 0x0008, /* ...background (implies ALL) */ 388 - WVS_REFRESH_VIDEO = 0x0010, /* ...video image upon timeout */ 389 - WVS_REFRESH_RESUME = 0x0020, /* Resume playback upon timeout */ 390 - WVS_NODRAW = 0x8000, /* OR bitflag - don't draw anything */ 391 - WVS_SHOW = 0x4000, /* OR bitflag - show the WVS */ 392 - WVS_HP_PAUSE = 0x2000, 393 - WVS_HIDE = 0x0000, /* hide the WVS (aid readability) */ 394 - WVS_REFRESH_ALL = 0x000f, /* Only immediate graphical elements */ 384 + OSD_REFRESH_VOLUME = 0x0001, /* ...volume display */ 385 + OSD_REFRESH_TIME = 0x0002, /* ...time display+progress */ 386 + OSD_REFRESH_STATUS = 0x0004, /* ...playback status icon */ 387 + OSD_REFRESH_BACKGROUND = 0x0008, /* ...background (implies ALL) */ 388 + OSD_REFRESH_VIDEO = 0x0010, /* ...video image upon timeout */ 389 + OSD_REFRESH_RESUME = 0x0020, /* Resume playback upon timeout */ 390 + OSD_NODRAW = 0x8000, /* OR bitflag - don't draw anything */ 391 + OSD_SHOW = 0x4000, /* OR bitflag - show the OSD */ 392 + OSD_HP_PAUSE = 0x2000, 393 + OSD_HIDE = 0x0000, /* hide the OSD (aid readability) */ 394 + OSD_REFRESH_ALL = 0x000f, /* Only immediate graphical elements */ 395 395 }; 396 396 397 397 /* Status icons selected according to font height */ ··· 399 399 extern const unsigned char mpegplayer_status_icons_12x12x1[]; 400 400 extern const unsigned char mpegplayer_status_icons_16x16x1[]; 401 401 402 - /* Main border areas that contain WVS elements */ 403 - #define WVS_BDR_L 2 404 - #define WVS_BDR_T 2 405 - #define WVS_BDR_R 2 406 - #define WVS_BDR_B 2 402 + /* Main border areas that contain OSD elements */ 403 + #define OSD_BDR_L 2 404 + #define OSD_BDR_T 2 405 + #define OSD_BDR_R 2 406 + #define OSD_BDR_B 2 407 407 408 - struct wvs 408 + struct osd 409 409 { 410 410 long hide_tick; 411 411 long show_for; ··· 434 434 unsigned flags; 435 435 }; 436 436 437 - static struct wvs wvs; 437 + static struct osd osd; 438 438 439 - static void wvs_show(unsigned show); 439 + static void osd_show(unsigned show); 440 440 441 441 #ifdef LCD_LANDSCAPE 442 - #define _X (x + wvs.x) 443 - #define _Y (y + wvs.y) 442 + #define _X (x + osd.x) 443 + #define _Y (y + osd.y) 444 444 #define _W width 445 445 #define _H height 446 446 #else 447 - #define _X (LCD_WIDTH - (y + wvs.y) - height) 448 - #define _Y (x + wvs.x) 447 + #define _X (LCD_WIDTH - (y + osd.y) - height) 448 + #define _Y (x + osd.x) 449 449 #define _W height 450 450 #define _H width 451 451 #endif ··· 470 470 471 471 /* Drawing functions that operate rotated on LCD_PORTRAIT displays - 472 472 * most are just wrappers of lcd_* functions with transforms applied. 473 - * The origin is the upper-left corner of the WVS area */ 473 + * The origin is the upper-left corner of the OSD area */ 474 474 static void draw_update_rect(int x, int y, int width, int height) 475 475 { 476 476 lcd_(update_rect)(_X, _Y, _W, _H); ··· 501 501 static void draw_hline(int x1, int x2, int y) 502 502 { 503 503 #ifdef LCD_LANDSCAPE 504 - lcd_(hline)(x1 + wvs.x, x2 + wvs.x, y + wvs.y); 504 + lcd_(hline)(x1 + osd.x, x2 + osd.x, y + osd.y); 505 505 #else 506 - y = LCD_WIDTH - (y + wvs.y) - 1; 507 - lcd_(vline)(y, x1 + wvs.x, x2 + wvs.x); 506 + y = LCD_WIDTH - (y + osd.y) - 1; 507 + lcd_(vline)(y, x1 + osd.x, x2 + osd.x); 508 508 #endif 509 509 } 510 510 511 511 static void draw_vline(int x, int y1, int y2) 512 512 { 513 513 #ifdef LCD_LANDSCAPE 514 - lcd_(vline)(x + wvs.x, y1 + wvs.y, y2 + wvs.y); 514 + lcd_(vline)(x + osd.x, y1 + osd.y, y2 + osd.y); 515 515 #else 516 - y1 = LCD_WIDTH - (y1 + wvs.y) - 1; 517 - y2 = LCD_WIDTH - (y2 + wvs.y) - 1; 518 - lcd_(hline)(y1, y2, x + wvs.x); 516 + y1 = LCD_WIDTH - (y1 + osd.y) - 1; 517 + y2 = LCD_WIDTH - (y2 + osd.y) - 1; 518 + lcd_(hline)(y1, y2, x + osd.x); 519 519 #endif 520 520 } 521 521 ··· 534 534 535 535 draw_fillrect(x + 1, y + 1, val, height - 2); 536 536 537 - lcd_(set_foreground)(wvs.prog_fillcolor); 537 + lcd_(set_foreground)(osd.prog_fillcolor); 538 538 539 539 draw_fillrect(x + 1 + val, y + 1, width - 2 - val, height - 2); 540 540 ··· 625 625 626 626 ucs = rb->bidi_l2v(str, 1); 627 627 628 - x += wvs.x; 629 - y += wvs.y; 628 + x += osd.x; 629 + y += osd.y; 630 630 631 631 while ((ch = *ucs++) != 0 && x < SCREEN_WIDTH) 632 632 { ··· 666 666 { 667 667 int mode = lcd_(get_drawmode)(); 668 668 lcd_(set_drawmode)(DRMODE_FG); 669 - lcd_(putsxy)(x + wvs.x, y + wvs.y, str); 669 + lcd_(putsxy)(x + osd.x, y + osd.y, str); 670 670 lcd_(set_drawmode)(mode); 671 671 } 672 672 #endif /* LCD_PORTRAIT */ 673 673 674 674 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 675 675 /* So we can refresh the overlay */ 676 - static void wvs_lcd_enable_hook(void* param) 676 + static void osd_lcd_enable_hook(void* param) 677 677 { 678 678 (void)param; 679 679 rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_1, 0); 680 680 } 681 681 #endif 682 682 683 - static void wvs_backlight_on_video_mode(bool video_on) 683 + static void osd_backlight_on_video_mode(bool video_on) 684 684 { 685 685 if (video_on) { 686 686 /* Turn off backlight timeout */ 687 687 /* backlight control in lib/helper.c */ 688 688 backlight_force_on(); 689 689 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 690 - rb->remove_event(LCD_EVENT_ACTIVATION, wvs_lcd_enable_hook); 690 + rb->remove_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook); 691 691 #endif 692 692 } else { 693 693 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 694 - rb->add_event(LCD_EVENT_ACTIVATION, false, wvs_lcd_enable_hook); 694 + rb->add_event(LCD_EVENT_ACTIVATION, false, osd_lcd_enable_hook); 695 695 #endif 696 696 /* Revert to user's backlight settings */ 697 697 backlight_use_settings(); ··· 699 699 } 700 700 701 701 #ifdef HAVE_BACKLIGHT_BRIGHTNESS 702 - static void wvs_backlight_brightness_video_mode(bool video_on) 702 + static void osd_backlight_brightness_video_mode(bool video_on) 703 703 { 704 704 if (settings.backlight_brightness < 0) 705 705 return; ··· 708 708 video_on ? settings.backlight_brightness : -1); 709 709 } 710 710 #else 711 - #define wvs_backlight_brightness_video_mode(video_on) 711 + #define osd_backlight_brightness_video_mode(video_on) 712 712 #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ 713 713 714 - static void wvs_text_init(void) 714 + static void osd_text_init(void) 715 715 { 716 716 struct hms hms; 717 717 char buf[32]; ··· 720 720 721 721 lcd_(setfont)(FONT_UI); 722 722 723 - wvs.x = 0; 724 - wvs.width = SCREEN_WIDTH; 723 + osd.x = 0; 724 + osd.width = SCREEN_WIDTH; 725 725 726 - vo_rect_clear(&wvs.time_rect); 727 - vo_rect_clear(&wvs.stat_rect); 728 - vo_rect_clear(&wvs.prog_rect); 729 - vo_rect_clear(&wvs.vol_rect); 726 + vo_rect_clear(&osd.time_rect); 727 + vo_rect_clear(&osd.stat_rect); 728 + vo_rect_clear(&osd.prog_rect); 729 + vo_rect_clear(&osd.vol_rect); 730 730 731 731 ts_to_hms(stream_get_duration(), &hms); 732 732 hms_format(buf, sizeof (buf), &hms); 733 - lcd_(getstringsize)(buf, &wvs.time_rect.r, &wvs.time_rect.b); 733 + lcd_(getstringsize)(buf, &osd.time_rect.r, &osd.time_rect.b); 734 734 735 735 /* Choose well-sized bitmap images relative to font height */ 736 - if (wvs.time_rect.b < 12) { 737 - wvs.icons = mpegplayer_status_icons_8x8x1; 738 - wvs.stat_rect.r = wvs.stat_rect.b = 8; 739 - } else if (wvs.time_rect.b < 16) { 740 - wvs.icons = mpegplayer_status_icons_12x12x1; 741 - wvs.stat_rect.r = wvs.stat_rect.b = 12; 736 + if (osd.time_rect.b < 12) { 737 + osd.icons = mpegplayer_status_icons_8x8x1; 738 + osd.stat_rect.r = osd.stat_rect.b = 8; 739 + } else if (osd.time_rect.b < 16) { 740 + osd.icons = mpegplayer_status_icons_12x12x1; 741 + osd.stat_rect.r = osd.stat_rect.b = 12; 742 742 } else { 743 - wvs.icons = mpegplayer_status_icons_16x16x1; 744 - wvs.stat_rect.r = wvs.stat_rect.b = 16; 743 + osd.icons = mpegplayer_status_icons_16x16x1; 744 + osd.stat_rect.r = osd.stat_rect.b = 16; 745 745 } 746 746 747 - if (wvs.stat_rect.b < wvs.time_rect.b) { 748 - vo_rect_offset(&wvs.stat_rect, 0, 749 - (wvs.time_rect.b - wvs.stat_rect.b) / 2 + WVS_BDR_T); 750 - vo_rect_offset(&wvs.time_rect, WVS_BDR_L, WVS_BDR_T); 747 + if (osd.stat_rect.b < osd.time_rect.b) { 748 + vo_rect_offset(&osd.stat_rect, 0, 749 + (osd.time_rect.b - osd.stat_rect.b) / 2 + OSD_BDR_T); 750 + vo_rect_offset(&osd.time_rect, OSD_BDR_L, OSD_BDR_T); 751 751 } else { 752 - vo_rect_offset(&wvs.time_rect, WVS_BDR_L, 753 - wvs.stat_rect.b - wvs.time_rect.b + WVS_BDR_T); 754 - vo_rect_offset(&wvs.stat_rect, 0, WVS_BDR_T); 752 + vo_rect_offset(&osd.time_rect, OSD_BDR_L, 753 + osd.stat_rect.b - osd.time_rect.b + OSD_BDR_T); 754 + vo_rect_offset(&osd.stat_rect, 0, OSD_BDR_T); 755 755 } 756 756 757 - wvs.dur_rect = wvs.time_rect; 757 + osd.dur_rect = osd.time_rect; 758 758 759 759 phys = rb->sound_val2phys(SOUND_VOLUME, rb->sound_min(SOUND_VOLUME)); 760 760 rb->snprintf(buf, sizeof(buf), "%d%s", phys, 761 761 rb->sound_unit(SOUND_VOLUME)); 762 762 763 763 lcd_(getstringsize)(" ", &spc_width, NULL); 764 - lcd_(getstringsize)(buf, &wvs.vol_rect.r, &wvs.vol_rect.b); 764 + lcd_(getstringsize)(buf, &osd.vol_rect.r, &osd.vol_rect.b); 765 765 766 - wvs.prog_rect.r = SCREEN_WIDTH - WVS_BDR_L - spc_width - 767 - wvs.vol_rect.r - WVS_BDR_R; 768 - wvs.prog_rect.b = 3*wvs.stat_rect.b / 4; 769 - vo_rect_offset(&wvs.prog_rect, wvs.time_rect.l, 770 - wvs.time_rect.b); 766 + osd.prog_rect.r = SCREEN_WIDTH - OSD_BDR_L - spc_width - 767 + osd.vol_rect.r - OSD_BDR_R; 768 + osd.prog_rect.b = 3*osd.stat_rect.b / 4; 769 + vo_rect_offset(&osd.prog_rect, osd.time_rect.l, 770 + osd.time_rect.b); 771 771 772 - vo_rect_offset(&wvs.stat_rect, 773 - (wvs.prog_rect.r + wvs.prog_rect.l - wvs.stat_rect.r) / 2, 772 + vo_rect_offset(&osd.stat_rect, 773 + (osd.prog_rect.r + osd.prog_rect.l - osd.stat_rect.r) / 2, 774 774 0); 775 775 776 - vo_rect_offset(&wvs.dur_rect, 777 - wvs.prog_rect.r - wvs.dur_rect.r, 0); 776 + vo_rect_offset(&osd.dur_rect, 777 + osd.prog_rect.r - osd.dur_rect.r, 0); 778 778 779 - vo_rect_offset(&wvs.vol_rect, wvs.prog_rect.r + spc_width, 780 - (wvs.prog_rect.b + wvs.prog_rect.t - wvs.vol_rect.b) / 2); 779 + vo_rect_offset(&osd.vol_rect, osd.prog_rect.r + spc_width, 780 + (osd.prog_rect.b + osd.prog_rect.t - osd.vol_rect.b) / 2); 781 781 782 - wvs.height = WVS_BDR_T + MAX(wvs.prog_rect.b, wvs.vol_rect.b) - 783 - MIN(wvs.time_rect.t, wvs.stat_rect.t) + WVS_BDR_B; 782 + osd.height = OSD_BDR_T + MAX(osd.prog_rect.b, osd.vol_rect.b) - 783 + MIN(osd.time_rect.t, osd.stat_rect.t) + OSD_BDR_B; 784 784 785 785 #ifdef HAVE_LCD_COLOR 786 - wvs.height = ALIGN_UP(wvs.height, 2); 786 + osd.height = ALIGN_UP(osd.height, 2); 787 787 #endif 788 - wvs.y = SCREEN_HEIGHT - wvs.height; 788 + osd.y = SCREEN_HEIGHT - osd.height; 789 789 790 790 lcd_(setfont)(FONT_SYSFIXED); 791 791 } 792 792 793 - static void wvs_init(void) 793 + static void osd_init(void) 794 794 { 795 - wvs.flags = 0; 796 - wvs.show_for = HZ*4; 797 - wvs.print_delay = 75*HZ/100; 798 - wvs.resume_delay = HZ/2; 795 + osd.flags = 0; 796 + osd.show_for = HZ*4; 797 + osd.print_delay = 75*HZ/100; 798 + osd.resume_delay = HZ/2; 799 799 #ifdef HAVE_LCD_COLOR 800 - wvs.bgcolor = LCD_RGBPACK(0x73, 0x75, 0xbd); 801 - wvs.fgcolor = LCD_WHITE; 802 - wvs.prog_fillcolor = LCD_BLACK; 800 + osd.bgcolor = LCD_RGBPACK(0x73, 0x75, 0xbd); 801 + osd.fgcolor = LCD_WHITE; 802 + osd.prog_fillcolor = LCD_BLACK; 803 803 #else 804 - wvs.bgcolor = GREY_LIGHTGRAY; 805 - wvs.fgcolor = GREY_BLACK; 806 - wvs.prog_fillcolor = GREY_WHITE; 804 + osd.bgcolor = GREY_LIGHTGRAY; 805 + osd.fgcolor = GREY_BLACK; 806 + osd.prog_fillcolor = GREY_WHITE; 807 807 #endif 808 - wvs.curr_time = 0; 809 - wvs.status = WVS_STATUS_STOPPED; 810 - wvs.auto_refresh = WVS_REFRESH_TIME; 811 - wvs.next_auto_refresh = *rb->current_tick; 812 - wvs_text_init(); 808 + osd.curr_time = 0; 809 + osd.status = OSD_STATUS_STOPPED; 810 + osd.auto_refresh = OSD_REFRESH_TIME; 811 + osd.next_auto_refresh = *rb->current_tick; 812 + osd_text_init(); 813 813 } 814 814 815 - static void wvs_schedule_refresh(unsigned refresh) 815 + static void osd_schedule_refresh(unsigned refresh) 816 816 { 817 817 long tick = *rb->current_tick; 818 818 819 - if (refresh & WVS_REFRESH_VIDEO) 820 - wvs.print_tick = tick + wvs.print_delay; 819 + if (refresh & OSD_REFRESH_VIDEO) 820 + osd.print_tick = tick + osd.print_delay; 821 821 822 - if (refresh & WVS_REFRESH_RESUME) 823 - wvs.resume_tick = tick + wvs.resume_delay; 822 + if (refresh & OSD_REFRESH_RESUME) 823 + osd.resume_tick = tick + osd.resume_delay; 824 824 825 - wvs.auto_refresh |= refresh; 825 + osd.auto_refresh |= refresh; 826 826 } 827 827 828 - static void wvs_cancel_refresh(unsigned refresh) 828 + static void osd_cancel_refresh(unsigned refresh) 829 829 { 830 - wvs.auto_refresh &= ~refresh; 830 + osd.auto_refresh &= ~refresh; 831 831 } 832 832 833 833 /* Refresh the background area */ 834 - static void wvs_refresh_background(void) 834 + static void osd_refresh_background(void) 835 835 { 836 836 char buf[32]; 837 837 struct hms hms; ··· 842 842 #ifdef HAVE_LCD_COLOR 843 843 /* Draw a "raised" area for our graphics */ 844 844 lcd_(set_background)(draw_blendcolor(bg, DRAW_WHITE, 192)); 845 - draw_hline(0, wvs.width, 0); 845 + draw_hline(0, osd.width, 0); 846 846 847 847 lcd_(set_background)(draw_blendcolor(bg, DRAW_WHITE, 80)); 848 - draw_hline(0, wvs.width, 1); 848 + draw_hline(0, osd.width, 1); 849 849 850 850 lcd_(set_background)(draw_blendcolor(bg, DRAW_BLACK, 48)); 851 - draw_hline(0, wvs.width, wvs.height-2); 851 + draw_hline(0, osd.width, osd.height-2); 852 852 853 853 lcd_(set_background)(draw_blendcolor(bg, DRAW_BLACK, 128)); 854 - draw_hline(0, wvs.width, wvs.height-1); 854 + draw_hline(0, osd.width, osd.height-1); 855 855 856 856 lcd_(set_background)(bg); 857 - draw_clear_area(0, 2, wvs.width, wvs.height - 4); 857 + draw_clear_area(0, 2, osd.width, osd.height - 4); 858 858 #else 859 859 /* Give contrast with the main background */ 860 860 lcd_(set_background)(GREY_WHITE); 861 - draw_hline(0, wvs.width, 0); 861 + draw_hline(0, osd.width, 0); 862 862 863 863 lcd_(set_background)(GREY_DARKGRAY); 864 - draw_hline(0, wvs.width, wvs.height-1); 864 + draw_hline(0, osd.width, osd.height-1); 865 865 866 866 lcd_(set_background)(bg); 867 - draw_clear_area(0, 1, wvs.width, wvs.height - 2); 867 + draw_clear_area(0, 1, osd.width, osd.height - 2); 868 868 #endif 869 869 870 - vo_rect_set_ext(&wvs.update_rect, 0, 0, wvs.width, wvs.height); 870 + vo_rect_set_ext(&osd.update_rect, 0, 0, osd.width, osd.height); 871 871 lcd_(set_drawmode)(DRMODE_SOLID); 872 872 873 873 if (stream_get_duration() != INVALID_TIMESTAMP) { 874 874 /* Draw the movie duration */ 875 875 ts_to_hms(stream_get_duration(), &hms); 876 876 hms_format(buf, sizeof (buf), &hms); 877 - draw_putsxy_oriented(wvs.dur_rect.l, wvs.dur_rect.t, buf); 877 + draw_putsxy_oriented(osd.dur_rect.l, osd.dur_rect.t, buf); 878 878 } 879 879 /* else don't know the duration */ 880 880 } 881 881 882 882 /* Refresh the current time display + the progress bar */ 883 - static void wvs_refresh_time(void) 883 + static void osd_refresh_time(void) 884 884 { 885 885 char buf[32]; 886 886 struct hms hms; 887 887 888 888 uint32_t duration = stream_get_duration(); 889 889 890 - draw_scrollbar_draw_rect(&wvs.prog_rect, 0, duration, 891 - wvs.curr_time); 890 + draw_scrollbar_draw_rect(&osd.prog_rect, 0, duration, 891 + osd.curr_time); 892 892 893 - ts_to_hms(wvs.curr_time, &hms); 893 + ts_to_hms(osd.curr_time, &hms); 894 894 hms_format(buf, sizeof (buf), &hms); 895 895 896 - draw_clear_area_rect(&wvs.time_rect); 897 - draw_putsxy_oriented(wvs.time_rect.l, wvs.time_rect.t, buf); 896 + draw_clear_area_rect(&osd.time_rect); 897 + draw_putsxy_oriented(osd.time_rect.l, osd.time_rect.t, buf); 898 898 899 - vo_rect_union(&wvs.update_rect, &wvs.update_rect, 900 - &wvs.prog_rect); 901 - vo_rect_union(&wvs.update_rect, &wvs.update_rect, 902 - &wvs.time_rect); 899 + vo_rect_union(&osd.update_rect, &osd.update_rect, 900 + &osd.prog_rect); 901 + vo_rect_union(&osd.update_rect, &osd.update_rect, 902 + &osd.time_rect); 903 903 } 904 904 905 905 /* Refresh the volume display area */ 906 - static void wvs_refresh_volume(void) 906 + static void osd_refresh_volume(void) 907 907 { 908 908 char buf[32]; 909 909 int width; ··· 915 915 lcd_(getstringsize)(buf, &width, NULL); 916 916 917 917 /* Right-justified */ 918 - draw_clear_area_rect(&wvs.vol_rect); 919 - draw_putsxy_oriented(wvs.vol_rect.r - width, wvs.vol_rect.t, buf); 918 + draw_clear_area_rect(&osd.vol_rect); 919 + draw_putsxy_oriented(osd.vol_rect.r - width, osd.vol_rect.t, buf); 920 920 921 - vo_rect_union(&wvs.update_rect, &wvs.update_rect, &wvs.vol_rect); 921 + vo_rect_union(&osd.update_rect, &osd.update_rect, &osd.vol_rect); 922 922 } 923 923 924 924 /* Refresh the status icon */ 925 - static void wvs_refresh_status(void) 925 + static void osd_refresh_status(void) 926 926 { 927 - int icon_size = wvs.stat_rect.r - wvs.stat_rect.l; 927 + int icon_size = osd.stat_rect.r - osd.stat_rect.l; 928 928 929 - draw_clear_area_rect(&wvs.stat_rect); 929 + draw_clear_area_rect(&osd.stat_rect); 930 930 931 931 #ifdef HAVE_LCD_COLOR 932 932 /* Draw status icon with a drop shadow */ ··· 938 938 939 939 while (1) 940 940 { 941 - draw_oriented_mono_bitmap_part(wvs.icons, 942 - icon_size*wvs.status, 941 + draw_oriented_mono_bitmap_part(osd.icons, 942 + icon_size*osd.status, 943 943 0, 944 - icon_size*WVS_STATUS_COUNT, 945 - wvs.stat_rect.l + wvs.x + i, 946 - wvs.stat_rect.t + wvs.y + i, 944 + icon_size*OSD_STATUS_COUNT, 945 + osd.stat_rect.l + osd.x + i, 946 + osd.stat_rect.t + osd.y + i, 947 947 icon_size, icon_size); 948 948 949 949 if (--i < 0) ··· 952 952 lcd_(set_foreground)(oldfg); 953 953 } 954 954 955 - vo_rect_union(&wvs.update_rect, &wvs.update_rect, &wvs.stat_rect); 955 + vo_rect_union(&osd.update_rect, &osd.update_rect, &osd.stat_rect); 956 956 #else 957 - draw_oriented_mono_bitmap_part(wvs.icons, 958 - icon_size*wvs.status, 957 + draw_oriented_mono_bitmap_part(osd.icons, 958 + icon_size*osd.status, 959 959 0, 960 - icon_size*WVS_STATUS_COUNT, 961 - wvs.stat_rect.l + wvs.x, 962 - wvs.stat_rect.t + wvs.y, 960 + icon_size*OSD_STATUS_COUNT, 961 + osd.stat_rect.l + osd.x, 962 + osd.stat_rect.t + osd.y, 963 963 icon_size, icon_size); 964 - vo_rect_union(&wvs.update_rect, &wvs.update_rect, &wvs.stat_rect); 964 + vo_rect_union(&osd.update_rect, &osd.update_rect, &osd.stat_rect); 965 965 #endif 966 966 } 967 967 968 968 /* Update the current status which determines which icon is displayed */ 969 - static bool wvs_update_status(void) 969 + static bool osd_update_status(void) 970 970 { 971 971 int status; 972 972 973 973 switch (stream_status()) 974 974 { 975 975 default: 976 - status = WVS_STATUS_STOPPED; 976 + status = OSD_STATUS_STOPPED; 977 977 break; 978 978 case STREAM_PAUSED: 979 - /* If paused with a pending resume, coerce it to WVS_STATUS_PLAYING */ 980 - status = (wvs.auto_refresh & WVS_REFRESH_RESUME) ? 981 - WVS_STATUS_PLAYING : WVS_STATUS_PAUSED; 979 + /* If paused with a pending resume, coerce it to OSD_STATUS_PLAYING */ 980 + status = (osd.auto_refresh & OSD_REFRESH_RESUME) ? 981 + OSD_STATUS_PLAYING : OSD_STATUS_PAUSED; 982 982 break; 983 983 case STREAM_PLAYING: 984 - status = WVS_STATUS_PLAYING; 984 + status = OSD_STATUS_PLAYING; 985 985 break; 986 986 } 987 987 988 - if (status != wvs.status) { 988 + if (status != osd.status) { 989 989 /* A refresh is needed */ 990 - wvs.status = status; 990 + osd.status = status; 991 991 return true; 992 992 } 993 993 ··· 995 995 } 996 996 997 997 /* Update the current time that will be displayed */ 998 - static void wvs_update_time(void) 998 + static void osd_update_time(void) 999 999 { 1000 1000 uint32_t start; 1001 - wvs.curr_time = stream_get_seek_time(&start); 1002 - wvs.curr_time -= start; 1001 + osd.curr_time = stream_get_seek_time(&start); 1002 + osd.curr_time -= start; 1003 1003 } 1004 1004 1005 - /* Refresh various parts of the WVS - showing it if it is hidden */ 1006 - static void wvs_refresh(int hint) 1005 + /* Refresh various parts of the OSD - showing it if it is hidden */ 1006 + static void osd_refresh(int hint) 1007 1007 { 1008 1008 long tick; 1009 1009 unsigned oldbg, oldfg; 1010 1010 1011 1011 tick = *rb->current_tick; 1012 1012 1013 - if (hint == WVS_REFRESH_DEFAULT) { 1013 + if (hint == OSD_REFRESH_DEFAULT) { 1014 1014 /* The default which forces no updates */ 1015 1015 1016 1016 /* Make sure Rockbox doesn't turn off the player because of 1017 1017 too little activity */ 1018 - if (wvs.status == WVS_STATUS_PLAYING) 1018 + if (osd.status == OSD_STATUS_PLAYING) 1019 1019 rb->reset_poweroff_timer(); 1020 1020 1021 1021 /* Redraw the current or possibly extract a new video frame */ 1022 - if ((wvs.auto_refresh & WVS_REFRESH_VIDEO) && 1023 - TIME_AFTER(tick, wvs.print_tick)) { 1024 - wvs.auto_refresh &= ~WVS_REFRESH_VIDEO; 1022 + if ((osd.auto_refresh & OSD_REFRESH_VIDEO) && 1023 + TIME_AFTER(tick, osd.print_tick)) { 1024 + osd.auto_refresh &= ~OSD_REFRESH_VIDEO; 1025 1025 stream_draw_frame(false); 1026 1026 } 1027 1027 1028 1028 /* Restart playback if the timout was reached */ 1029 - if ((wvs.auto_refresh & WVS_REFRESH_RESUME) && 1030 - TIME_AFTER(tick, wvs.resume_tick)) { 1031 - wvs.auto_refresh &= ~(WVS_REFRESH_RESUME | WVS_REFRESH_VIDEO); 1029 + if ((osd.auto_refresh & OSD_REFRESH_RESUME) && 1030 + TIME_AFTER(tick, osd.resume_tick)) { 1031 + osd.auto_refresh &= ~(OSD_REFRESH_RESUME | OSD_REFRESH_VIDEO); 1032 1032 stream_resume(); 1033 1033 } 1034 1034 1035 1035 /* If not visible, return */ 1036 - if (!(wvs.flags & WVS_SHOW)) 1036 + if (!(osd.flags & OSD_SHOW)) 1037 1037 return; 1038 1038 1039 1039 /* Hide if the visibility duration was reached */ 1040 - if (TIME_AFTER(tick, wvs.hide_tick)) { 1041 - wvs_show(WVS_HIDE); 1040 + if (TIME_AFTER(tick, osd.hide_tick)) { 1041 + osd_show(OSD_HIDE); 1042 1042 return; 1043 1043 } 1044 1044 } else { 1045 1045 /* A forced update of some region */ 1046 1046 1047 1047 /* Show if currently invisible */ 1048 - if (!(wvs.flags & WVS_SHOW)) { 1048 + if (!(osd.flags & OSD_SHOW)) { 1049 1049 /* Avoid call back into this function - it will be drawn */ 1050 - wvs_show(WVS_SHOW | WVS_NODRAW); 1051 - hint = WVS_REFRESH_ALL; 1050 + osd_show(OSD_SHOW | OSD_NODRAW); 1051 + hint = OSD_REFRESH_ALL; 1052 1052 } 1053 1053 1054 1054 /* Move back timeouts for frame print and hide */ 1055 - wvs.print_tick = tick + wvs.print_delay; 1056 - wvs.hide_tick = tick + wvs.show_for; 1055 + osd.print_tick = tick + osd.print_delay; 1056 + osd.hide_tick = tick + osd.show_for; 1057 1057 } 1058 1058 1059 - if (TIME_AFTER(tick, wvs.next_auto_refresh)) { 1059 + if (TIME_AFTER(tick, osd.next_auto_refresh)) { 1060 1060 /* Refresh whatever graphical elements are due automatically */ 1061 - wvs.next_auto_refresh = tick + WVS_MIN_UPDATE_INTERVAL; 1061 + osd.next_auto_refresh = tick + OSD_MIN_UPDATE_INTERVAL; 1062 1062 1063 - if (wvs.auto_refresh & WVS_REFRESH_STATUS) { 1064 - if (wvs_update_status()) 1065 - hint |= WVS_REFRESH_STATUS; 1063 + if (osd.auto_refresh & OSD_REFRESH_STATUS) { 1064 + if (osd_update_status()) 1065 + hint |= OSD_REFRESH_STATUS; 1066 1066 } 1067 1067 1068 - if (wvs.auto_refresh & WVS_REFRESH_TIME) { 1069 - wvs_update_time(); 1070 - hint |= WVS_REFRESH_TIME; 1068 + if (osd.auto_refresh & OSD_REFRESH_TIME) { 1069 + osd_update_time(); 1070 + hint |= OSD_REFRESH_TIME; 1071 1071 } 1072 1072 } 1073 1073 ··· 1080 1080 oldbg = lcd_(get_background)(); 1081 1081 1082 1082 lcd_(setfont)(FONT_UI); 1083 - lcd_(set_foreground)(wvs.fgcolor); 1084 - lcd_(set_background)(wvs.bgcolor); 1083 + lcd_(set_foreground)(osd.fgcolor); 1084 + lcd_(set_background)(osd.bgcolor); 1085 1085 1086 - vo_rect_clear(&wvs.update_rect); 1086 + vo_rect_clear(&osd.update_rect); 1087 1087 1088 - if (hint & WVS_REFRESH_BACKGROUND) { 1089 - wvs_refresh_background(); 1090 - hint |= WVS_REFRESH_ALL; /* Requires a redraw of everything */ 1088 + if (hint & OSD_REFRESH_BACKGROUND) { 1089 + osd_refresh_background(); 1090 + hint |= OSD_REFRESH_ALL; /* Requires a redraw of everything */ 1091 1091 } 1092 1092 1093 - if (hint & WVS_REFRESH_TIME) { 1094 - wvs_refresh_time(); 1093 + if (hint & OSD_REFRESH_TIME) { 1094 + osd_refresh_time(); 1095 1095 } 1096 1096 1097 - if (hint & WVS_REFRESH_VOLUME) { 1098 - wvs_refresh_volume(); 1097 + if (hint & OSD_REFRESH_VOLUME) { 1098 + osd_refresh_volume(); 1099 1099 } 1100 1100 1101 - if (hint & WVS_REFRESH_STATUS) { 1102 - wvs_refresh_status(); 1101 + if (hint & OSD_REFRESH_STATUS) { 1102 + osd_refresh_status(); 1103 1103 } 1104 1104 1105 1105 /* Go back to defaults */ ··· 1110 1110 /* Update the dirty rectangle */ 1111 1111 vo_lock(); 1112 1112 1113 - draw_update_rect(wvs.update_rect.l, 1114 - wvs.update_rect.t, 1115 - wvs.update_rect.r - wvs.update_rect.l, 1116 - wvs.update_rect.b - wvs.update_rect.t); 1113 + draw_update_rect(osd.update_rect.l, 1114 + osd.update_rect.t, 1115 + osd.update_rect.r - osd.update_rect.l, 1116 + osd.update_rect.b - osd.update_rect.t); 1117 1117 1118 1118 vo_unlock(); 1119 1119 } 1120 1120 1121 - /* Show/Hide the WVS */ 1122 - static void wvs_show(unsigned show) 1121 + /* Show/Hide the OSD */ 1122 + static void osd_show(unsigned show) 1123 1123 { 1124 - if (((show ^ wvs.flags) & WVS_SHOW) == 0) 1124 + if (((show ^ osd.flags) & OSD_SHOW) == 0) 1125 1125 { 1126 - if (show & WVS_SHOW) { 1127 - wvs.hide_tick = *rb->current_tick + wvs.show_for; 1126 + if (show & OSD_SHOW) { 1127 + osd.hide_tick = *rb->current_tick + osd.show_for; 1128 1128 } 1129 1129 return; 1130 1130 } 1131 1131 1132 - if (show & WVS_SHOW) { 1132 + if (show & OSD_SHOW) { 1133 1133 /* Clip away the part of video that is covered */ 1134 - struct vo_rect rc = { 0, 0, SCREEN_WIDTH, wvs.y }; 1134 + struct vo_rect rc = { 0, 0, SCREEN_WIDTH, osd.y }; 1135 1135 1136 - wvs.flags |= WVS_SHOW; 1136 + osd.flags |= OSD_SHOW; 1137 1137 1138 - if (wvs.status != WVS_STATUS_PLAYING) { 1138 + if (osd.status != OSD_STATUS_PLAYING) { 1139 1139 /* Not playing - set brightness to mpegplayer setting */ 1140 - wvs_backlight_brightness_video_mode(true); 1140 + osd_backlight_brightness_video_mode(true); 1141 1141 } 1142 1142 1143 1143 stream_vo_set_clip(&rc); 1144 1144 1145 - if (!(show & WVS_NODRAW)) 1146 - wvs_refresh(WVS_REFRESH_ALL); 1145 + if (!(show & OSD_NODRAW)) 1146 + osd_refresh(OSD_REFRESH_ALL); 1147 1147 } else { 1148 1148 /* Uncover clipped video area and redraw it */ 1149 - wvs.flags &= ~WVS_SHOW; 1149 + osd.flags &= ~OSD_SHOW; 1150 1150 1151 - draw_clear_area(0, 0, wvs.width, wvs.height); 1151 + draw_clear_area(0, 0, osd.width, osd.height); 1152 1152 1153 - if (!(show & WVS_NODRAW)) { 1153 + if (!(show & OSD_NODRAW)) { 1154 1154 vo_lock(); 1155 - draw_update_rect(0, 0, wvs.width, wvs.height); 1155 + draw_update_rect(0, 0, osd.width, osd.height); 1156 1156 vo_unlock(); 1157 1157 1158 1158 stream_vo_set_clip(NULL); ··· 1161 1161 stream_vo_set_clip(NULL); 1162 1162 } 1163 1163 1164 - if (wvs.status != WVS_STATUS_PLAYING) { 1164 + if (osd.status != OSD_STATUS_PLAYING) { 1165 1165 /* Not playing - restore backlight brightness */ 1166 - wvs_backlight_brightness_video_mode(false); 1166 + osd_backlight_brightness_video_mode(false); 1167 1167 } 1168 1168 } 1169 1169 } 1170 1170 1171 1171 /* Set the current status - update screen if specified */ 1172 - static void wvs_set_status(int status) 1172 + static void osd_set_status(int status) 1173 1173 { 1174 - bool draw = (status & WVS_NODRAW) == 0; 1174 + bool draw = (status & OSD_NODRAW) == 0; 1175 1175 1176 - status &= WVS_STATUS_MASK; 1176 + status &= OSD_STATUS_MASK; 1177 1177 1178 - if (wvs.status != status) { 1178 + if (osd.status != status) { 1179 1179 1180 - wvs.status = status; 1180 + osd.status = status; 1181 1181 1182 1182 if (draw) 1183 - wvs_refresh(WVS_REFRESH_STATUS); 1183 + osd_refresh(OSD_REFRESH_STATUS); 1184 1184 } 1185 1185 } 1186 1186 1187 1187 /* Get the current status value */ 1188 - static int wvs_get_status(void) 1188 + static int osd_get_status(void) 1189 1189 { 1190 - return wvs.status & WVS_STATUS_MASK; 1190 + return osd.status & OSD_STATUS_MASK; 1191 1191 } 1192 1192 1193 1193 /* Handle Fast-forward/Rewind keys using WPS settings (and some nicked code ;) */ 1194 - static uint32_t wvs_ff_rw(int btn, unsigned refresh) 1194 + static uint32_t osd_ff_rw(int btn, unsigned refresh) 1195 1195 { 1196 1196 unsigned int step = TS_SECOND*rb->global_settings->ff_rewind_min_step; 1197 1197 const long ff_rw_accel = (rb->global_settings->ff_rewind_accel + 3); ··· 1200 1200 const uint32_t duration = stream_get_duration(); 1201 1201 unsigned int max_step = 0; 1202 1202 uint32_t ff_rw_count = 0; 1203 - unsigned status = wvs.status; 1203 + unsigned status = osd.status; 1204 1204 1205 - wvs_cancel_refresh(WVS_REFRESH_VIDEO | WVS_REFRESH_RESUME | 1206 - WVS_REFRESH_TIME); 1205 + osd_cancel_refresh(OSD_REFRESH_VIDEO | OSD_REFRESH_RESUME | 1206 + OSD_REFRESH_TIME); 1207 1207 1208 1208 time -= start; /* Absolute clock => stream-relative */ 1209 1209 ··· 1217 1217 case MPEG_RC_FF: 1218 1218 #endif 1219 1219 if (!(btn & BUTTON_REPEAT)) 1220 - wvs_set_status(WVS_STATUS_FF); 1220 + osd_set_status(OSD_STATUS_FF); 1221 1221 btn = MPEG_FF | BUTTON_REPEAT; /* simplify code below */ 1222 1222 break; 1223 1223 case MPEG_RW: ··· 1228 1228 case MPEG_RC_RW: 1229 1229 #endif 1230 1230 if (!(btn & BUTTON_REPEAT)) 1231 - wvs_set_status(WVS_STATUS_RW); 1231 + osd_set_status(OSD_STATUS_RW); 1232 1232 btn = MPEG_RW | BUTTON_REPEAT; /* simplify code below */ 1233 1233 break; 1234 1234 default: ··· 1242 1242 switch (btn) 1243 1243 { 1244 1244 case BUTTON_NONE: 1245 - wvs_refresh(WVS_REFRESH_DEFAULT); 1245 + osd_refresh(OSD_REFRESH_DEFAULT); 1246 1246 break; 1247 1247 1248 1248 case MPEG_FF | BUTTON_REPEAT: ··· 1271 1271 case MPEG_RC_FF | BUTTON_REL: 1272 1272 case MPEG_RC_RW | BUTTON_REL: 1273 1273 #endif 1274 - if (wvs.status == WVS_STATUS_FF) 1274 + if (osd.status == OSD_STATUS_FF) 1275 1275 time += ff_rw_count; 1276 - else if (wvs.status == WVS_STATUS_RW) 1276 + else if (osd.status == OSD_STATUS_RW) 1277 1277 time -= ff_rw_count; 1278 1278 1279 1279 /* Fall-through */ 1280 1280 case -1: 1281 1281 default: 1282 - wvs_schedule_refresh(refresh); 1283 - wvs_set_status(status); 1284 - wvs_schedule_refresh(WVS_REFRESH_TIME); 1282 + osd_schedule_refresh(refresh); 1283 + osd_set_status(status); 1284 + osd_schedule_refresh(OSD_REFRESH_TIME); 1285 1285 return time; 1286 1286 } 1287 1287 1288 - if (wvs.status == WVS_STATUS_FF) { 1288 + if (osd.status == OSD_STATUS_FF) { 1289 1289 /* fast forwarding, calc max step relative to end */ 1290 1290 max_step = muldiv_uint32(duration - (time + ff_rw_count), 1291 1291 FF_REWIND_MAX_PERCENT, 100); ··· 1305 1305 /* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */ 1306 1306 step += step >> ff_rw_accel; 1307 1307 1308 - if (wvs.status == WVS_STATUS_FF) { 1308 + if (osd.status == OSD_STATUS_FF) { 1309 1309 if (duration - time <= ff_rw_count) 1310 1310 ff_rw_count = duration - time; 1311 1311 1312 - wvs.curr_time = time + ff_rw_count; 1312 + osd.curr_time = time + ff_rw_count; 1313 1313 } else { 1314 1314 if (time <= ff_rw_count) 1315 1315 ff_rw_count = time; 1316 1316 1317 - wvs.curr_time = time - ff_rw_count; 1317 + osd.curr_time = time - ff_rw_count; 1318 1318 } 1319 1319 1320 - wvs_refresh(WVS_REFRESH_TIME); 1320 + osd_refresh(OSD_REFRESH_TIME); 1321 1321 1322 - btn = rb->button_get_w_tmo(WVS_MIN_UPDATE_INTERVAL); 1322 + btn = rb->button_get_w_tmo(OSD_MIN_UPDATE_INTERVAL); 1323 1323 } 1324 1324 } 1325 1325 1326 - static int wvs_status(void) 1326 + static int osd_status(void) 1327 1327 { 1328 1328 int status = stream_status(); 1329 1329 1330 1330 /* Coerce to STREAM_PLAYING if paused with a pending resume */ 1331 1331 if (status == STREAM_PAUSED) { 1332 - if (wvs.auto_refresh & WVS_REFRESH_RESUME) 1332 + if (osd.auto_refresh & OSD_REFRESH_RESUME) 1333 1333 status = STREAM_PLAYING; 1334 1334 } 1335 1335 ··· 1337 1337 } 1338 1338 1339 1339 /* Change the current audio volume by a specified amount */ 1340 - static void wvs_set_volume(int delta) 1340 + static void osd_set_volume(int delta) 1341 1341 { 1342 1342 int vol = rb->global_settings->volume; 1343 1343 int limit; ··· 1363 1363 } 1364 1364 1365 1365 /* Update the volume display */ 1366 - wvs_refresh(WVS_REFRESH_VOLUME); 1366 + osd_refresh(OSD_REFRESH_VOLUME); 1367 1367 } 1368 1368 1369 1369 /* Begin playback at the specified time */ 1370 - static int wvs_play(uint32_t time) 1370 + static int osd_play(uint32_t time) 1371 1371 { 1372 1372 int retval; 1373 1373 1374 - wvs_cancel_refresh(WVS_REFRESH_VIDEO | WVS_REFRESH_RESUME); 1374 + osd_cancel_refresh(OSD_REFRESH_VIDEO | OSD_REFRESH_RESUME); 1375 1375 1376 1376 retval = stream_seek(time, SEEK_SET); 1377 1377 1378 1378 if (retval >= STREAM_OK) { 1379 - wvs_backlight_on_video_mode(true); 1380 - wvs_backlight_brightness_video_mode(true); 1379 + osd_backlight_on_video_mode(true); 1380 + osd_backlight_brightness_video_mode(true); 1381 1381 stream_show_vo(true); 1382 1382 retval = stream_play(); 1383 1383 1384 1384 if (retval >= STREAM_OK) 1385 - wvs_set_status(WVS_STATUS_PLAYING | WVS_NODRAW); 1385 + osd_set_status(OSD_STATUS_PLAYING | OSD_NODRAW); 1386 1386 } 1387 1387 1388 1388 return retval; 1389 1389 } 1390 1390 1391 1391 /* Halt playback - pause engine and return logical state */ 1392 - static int wvs_halt(void) 1392 + static int osd_halt(void) 1393 1393 { 1394 1394 int status = stream_pause(); 1395 1395 1396 1396 /* Coerce to STREAM_PLAYING if paused with a pending resume */ 1397 1397 if (status == STREAM_PAUSED) { 1398 - if (wvs_get_status() == WVS_STATUS_PLAYING) 1398 + if (osd_get_status() == OSD_STATUS_PLAYING) 1399 1399 status = STREAM_PLAYING; 1400 1400 } 1401 1401 1402 1402 /* Cancel some auto refreshes - caller will restart them if desired */ 1403 - wvs_cancel_refresh(WVS_REFRESH_VIDEO | WVS_REFRESH_RESUME); 1403 + osd_cancel_refresh(OSD_REFRESH_VIDEO | OSD_REFRESH_RESUME); 1404 1404 1405 1405 /* No backlight fiddling here - callers does the right thing */ 1406 1406 ··· 1408 1408 } 1409 1409 1410 1410 /* Pause playback if playing */ 1411 - static int wvs_pause(void) 1411 + static int osd_pause(void) 1412 1412 { 1413 - unsigned refresh = wvs.auto_refresh; 1414 - int status = wvs_halt(); 1413 + unsigned refresh = osd.auto_refresh; 1414 + int status = osd_halt(); 1415 1415 1416 - if (status == STREAM_PLAYING && (refresh & WVS_REFRESH_RESUME)) { 1416 + if (status == STREAM_PLAYING && (refresh & OSD_REFRESH_RESUME)) { 1417 1417 /* Resume pending - change to a still video frame update */ 1418 - wvs_schedule_refresh(WVS_REFRESH_VIDEO); 1418 + osd_schedule_refresh(OSD_REFRESH_VIDEO); 1419 1419 } 1420 1420 1421 - wvs_set_status(WVS_STATUS_PAUSED); 1421 + osd_set_status(OSD_STATUS_PAUSED); 1422 1422 1423 - wvs_backlight_on_video_mode(false); 1424 - /* Leave brightness alone and restore it when WVS is hidden */ 1423 + osd_backlight_on_video_mode(false); 1424 + /* Leave brightness alone and restore it when OSD is hidden */ 1425 1425 1426 1426 return status; 1427 1427 } 1428 1428 1429 1429 /* Resume playback if halted or paused */ 1430 - static void wvs_resume(void) 1430 + static void osd_resume(void) 1431 1431 { 1432 1432 /* Cancel video and resume auto refresh - the resyc when starting 1433 1433 * playback will perform those tasks */ 1434 - wvs_backlight_on_video_mode(true); 1435 - wvs_backlight_brightness_video_mode(true); 1436 - wvs_cancel_refresh(WVS_REFRESH_VIDEO | WVS_REFRESH_RESUME); 1437 - wvs_set_status(WVS_STATUS_PLAYING); 1434 + osd_backlight_on_video_mode(true); 1435 + osd_backlight_brightness_video_mode(true); 1436 + osd_cancel_refresh(OSD_REFRESH_VIDEO | OSD_REFRESH_RESUME); 1437 + osd_set_status(OSD_STATUS_PLAYING); 1438 1438 stream_resume(); 1439 1439 } 1440 1440 1441 1441 /* Stop playback - remember the resume point if not closed */ 1442 - static void wvs_stop(void) 1442 + static void osd_stop(void) 1443 1443 { 1444 1444 uint32_t resume_time; 1445 1445 1446 - wvs_cancel_refresh(WVS_REFRESH_VIDEO | WVS_REFRESH_RESUME); 1447 - wvs_set_status(WVS_STATUS_STOPPED | WVS_NODRAW); 1448 - wvs_show(WVS_HIDE | WVS_NODRAW); 1446 + osd_cancel_refresh(OSD_REFRESH_VIDEO | OSD_REFRESH_RESUME); 1447 + osd_set_status(OSD_STATUS_STOPPED | OSD_NODRAW); 1448 + osd_show(OSD_HIDE | OSD_NODRAW); 1449 1449 1450 1450 stream_stop(); 1451 1451 ··· 1454 1454 if (resume_time != INVALID_TIMESTAMP) 1455 1455 settings.resume_time = resume_time; 1456 1456 1457 - wvs_backlight_on_video_mode(false); 1458 - wvs_backlight_brightness_video_mode(false); 1457 + osd_backlight_on_video_mode(false); 1458 + osd_backlight_brightness_video_mode(false); 1459 1459 } 1460 1460 1461 1461 /* Perform a seek if seeking is possible for this stream - if playing, a delay 1462 1462 * will be inserted before restarting in case the user decides to seek again */ 1463 - static void wvs_seek(int btn) 1463 + static void osd_seek(int btn) 1464 1464 { 1465 1465 int status; 1466 1466 unsigned refresh; ··· 1470 1470 return; 1471 1471 1472 1472 /* Halt playback - not strictly nescessary but nice */ 1473 - status = wvs_halt(); 1473 + status = osd_halt(); 1474 1474 1475 1475 if (status == STREAM_STOPPED) 1476 1476 return; 1477 1477 1478 - wvs_show(WVS_SHOW); 1478 + osd_show(OSD_SHOW); 1479 1479 1480 1480 if (status == STREAM_PLAYING) 1481 - refresh = WVS_REFRESH_RESUME; /* delay resume if playing */ 1481 + refresh = OSD_REFRESH_RESUME; /* delay resume if playing */ 1482 1482 else 1483 - refresh = WVS_REFRESH_VIDEO; /* refresh if paused */ 1483 + refresh = OSD_REFRESH_VIDEO; /* refresh if paused */ 1484 1484 1485 1485 /* Obtain a new playback point */ 1486 - time = wvs_ff_rw(btn, refresh); 1486 + time = osd_ff_rw(btn, refresh); 1487 1487 1488 1488 /* Tell engine to resume at that time */ 1489 1489 stream_seek(time, SEEK_SET); ··· 1491 1491 1492 1492 #ifdef HAVE_HEADPHONE_DETECTION 1493 1493 /* Handle SYS_PHONE_PLUGGED/UNPLUGGED */ 1494 - static void wvs_handle_phone_plug(bool inserted) 1494 + static void osd_handle_phone_plug(bool inserted) 1495 1495 { 1496 1496 if (rb->global_settings->unplug_mode == 0) 1497 1497 return; ··· 1499 1499 /* Wait for any incomplete state transition to complete first */ 1500 1500 stream_wait_status(); 1501 1501 1502 - int status = wvs_status(); 1502 + int status = osd_status(); 1503 1503 1504 1504 if (inserted) { 1505 1505 if (rb->global_settings->unplug_mode > 1) { 1506 1506 if (status == STREAM_PAUSED) { 1507 - wvs_resume(); 1507 + osd_resume(); 1508 1508 } 1509 1509 } 1510 1510 } else { 1511 1511 if (status == STREAM_PLAYING) { 1512 - wvs_pause(); 1512 + osd_pause(); 1513 1513 1514 1514 if (stream_can_seek() && rb->global_settings->unplug_rw) { 1515 1515 stream_seek(-rb->global_settings->unplug_rw*TS_SECOND, 1516 1516 SEEK_CUR); 1517 - wvs_schedule_refresh(WVS_REFRESH_VIDEO); 1517 + osd_schedule_refresh(OSD_REFRESH_VIDEO); 1518 1518 /* Update time display now */ 1519 - wvs_update_time(); 1520 - wvs_refresh(WVS_REFRESH_TIME); 1519 + osd_update_time(); 1520 + osd_refresh(OSD_REFRESH_TIME); 1521 1521 } 1522 1522 } 1523 1523 } ··· 1538 1538 rb->lcd_set_mode(LCD_MODE_YUV); 1539 1539 #endif 1540 1540 1541 - wvs_init(); 1541 + osd_init(); 1542 1542 1543 1543 /* Start playback at the specified starting time */ 1544 - if (wvs_play(settings.resume_time) < STREAM_OK) { 1544 + if (osd_play(settings.resume_time) < STREAM_OK) { 1545 1545 rb->splash(HZ*2, "Playback failed"); 1546 1546 return; 1547 1547 } ··· 1552 1552 int button; 1553 1553 1554 1554 mpeg_menu_sysevent_clear(); 1555 - button = rb->button_get_w_tmo(WVS_MIN_UPDATE_INTERVAL/2); 1555 + button = rb->button_get_w_tmo(OSD_MIN_UPDATE_INTERVAL/2); 1556 1556 1557 1557 button = mpeg_menu_sysevent_callback(button, NULL); 1558 1558 ··· 1560 1560 { 1561 1561 case BUTTON_NONE: 1562 1562 { 1563 - wvs_refresh(WVS_REFRESH_DEFAULT); 1563 + osd_refresh(OSD_REFRESH_DEFAULT); 1564 1564 continue; 1565 1565 } /* BUTTON_NONE: */ 1566 1566 ··· 1584 1584 case MPEG_RC_VOLUP|BUTTON_REPEAT: 1585 1585 #endif 1586 1586 { 1587 - wvs_set_volume(+1); 1587 + osd_set_volume(+1); 1588 1588 break; 1589 1589 } /* MPEG_VOLUP*: */ 1590 1590 ··· 1599 1599 case MPEG_RC_VOLDOWN|BUTTON_REPEAT: 1600 1600 #endif 1601 1601 { 1602 - wvs_set_volume(-1); 1602 + osd_set_volume(-1); 1603 1603 break; 1604 1604 } /* MPEG_VOLDOWN*: */ 1605 1605 ··· 1608 1608 case MPEG_RC_MENU: 1609 1609 #endif 1610 1610 { 1611 - int state = wvs_halt(); /* save previous state */ 1611 + int state = osd_halt(); /* save previous state */ 1612 1612 int result; 1613 1613 1614 1614 /* Hide video output */ 1615 - wvs_show(WVS_HIDE | WVS_NODRAW); 1615 + osd_show(OSD_HIDE | OSD_NODRAW); 1616 1616 stream_show_vo(false); 1617 - wvs_backlight_brightness_video_mode(false); 1617 + osd_backlight_brightness_video_mode(false); 1618 1618 1619 1619 #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV) 1620 1620 rb->lcd_set_mode(LCD_MODE_RGB565); ··· 1634 1634 switch (result) 1635 1635 { 1636 1636 case MPEG_MENU_QUIT: 1637 - wvs_stop(); 1637 + osd_stop(); 1638 1638 break; 1639 1639 1640 1640 default: ··· 1643 1643 #endif 1644 1644 /* If not stopped, show video again */ 1645 1645 if (state != STREAM_STOPPED) { 1646 - wvs_show(WVS_SHOW); 1646 + osd_show(OSD_SHOW); 1647 1647 stream_show_vo(true); 1648 1648 } 1649 1649 1650 1650 /* If stream was playing, restart it */ 1651 1651 if (state == STREAM_PLAYING) { 1652 - wvs_resume(); 1652 + osd_resume(); 1653 1653 } 1654 1654 break; 1655 1655 } ··· 1660 1660 case MPEG_SHOW_OSD: 1661 1661 case MPEG_SHOW_OSD | BUTTON_REPEAT: 1662 1662 /* Show if not visible */ 1663 - wvs_show(WVS_SHOW); 1663 + osd_show(OSD_SHOW); 1664 1664 /* Make sure it refreshes */ 1665 - wvs_refresh(WVS_REFRESH_DEFAULT); 1665 + osd_refresh(OSD_REFRESH_DEFAULT); 1666 1666 break; 1667 1667 #endif 1668 1668 ··· 1672 1672 #endif 1673 1673 case ACTION_STD_CANCEL: 1674 1674 { 1675 - wvs_stop(); 1675 + osd_stop(); 1676 1676 break; 1677 1677 } /* MPEG_STOP: */ 1678 1678 ··· 1684 1684 case MPEG_RC_PAUSE: 1685 1685 #endif 1686 1686 { 1687 - int status = wvs_status(); 1687 + int status = osd_status(); 1688 1688 1689 1689 if (status == STREAM_PLAYING) { 1690 1690 /* Playing => Paused */ 1691 - wvs_pause(); 1691 + osd_pause(); 1692 1692 } 1693 1693 else if (status == STREAM_PAUSED) { 1694 1694 /* Paused => Playing */ 1695 - wvs_resume(); 1695 + osd_resume(); 1696 1696 } 1697 1697 1698 1698 break; ··· 1711 1711 case MPEG_RC_FF: 1712 1712 #endif 1713 1713 { 1714 - wvs_seek(button); 1714 + osd_seek(button); 1715 1715 break; 1716 1716 } /* MPEG_RW: MPEG_FF: */ 1717 1717 ··· 1719 1719 case SYS_PHONE_PLUGGED: 1720 1720 case SYS_PHONE_UNPLUGGED: 1721 1721 { 1722 - wvs_handle_phone_plug(button == SYS_PHONE_PLUGGED); 1722 + osd_handle_phone_plug(button == SYS_PHONE_PLUGGED); 1723 1723 break; 1724 1724 } /* SYS_PHONE_*: */ 1725 1725 #endif ··· 1734 1734 rb->yield(); 1735 1735 } /* end while */ 1736 1736 1737 - wvs_stop(); 1737 + osd_stop(); 1738 1738 1739 1739 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 1740 1740 /* Be sure hook is removed before exiting since the stop will put it 1741 1741 * back because of the backlight restore. */ 1742 - rb->remove_event(LCD_EVENT_ACTIVATION, wvs_lcd_enable_hook); 1742 + rb->remove_event(LCD_EVENT_ACTIVATION, osd_lcd_enable_hook); 1743 1743 #endif 1744 1744 1745 1745 rb->lcd_setfont(FONT_UI);