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