diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-10-16 00:07:43 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-10-16 00:07:43 +0000 |
commit | cc8cff2ec02caf29b7d0cf565e1f9e2ebd9b0e99 (patch) | |
tree | a5427744a2aa55546f3d5982e15bed2a8d5e5f49 /apps/plugins/video.c | |
parent | 4a5df8e8d178702d603bd7cd185525c7ff6a3064 (diff) | |
download | rockbox-cc8cff2ec02caf29b7d0cf565e1f9e2ebd9b0e99.tar.gz rockbox-cc8cff2ec02caf29b7d0cf565e1f9e2ebd9b0e99.zip |
Plugin rework 1: (most) Compile-time keyboard configuration, for Ondio adaption. (all) Now using the default event handler, standard placement is now in switch() default case. (snow) Made USB aware. (video) Added contrast setting to Ondio version.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5291 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/video.c')
-rw-r--r-- | apps/plugins/video.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/apps/plugins/video.c b/apps/plugins/video.c index e63ef1c373..de05ba4af4 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c | |||
@@ -36,9 +36,17 @@ | |||
36 | #if CONFIG_KEYPAD == RECORDER_PAD | 36 | #if CONFIG_KEYPAD == RECORDER_PAD |
37 | #define VIDEO_STOP_SEEK BUTTON_PLAY | 37 | #define VIDEO_STOP_SEEK BUTTON_PLAY |
38 | #define VIDEO_RESUME BUTTON_PLAY | 38 | #define VIDEO_RESUME BUTTON_PLAY |
39 | #define VIDEO_DEBUG BUTTON_F1 | ||
40 | #define VIDEO_CONTRAST_DOWN BUTTON_F2 | ||
41 | #define VIDEO_CONTRAST_UP BUTTON_F3 | ||
42 | |||
39 | #elif CONFIG_KEYPAD == ONDIO_PAD | 43 | #elif CONFIG_KEYPAD == ONDIO_PAD |
40 | #define VIDEO_STOP_SEEK BUTTON_MENU | 44 | #define VIDEO_STOP_SEEK_PRE BUTTON_MENU |
45 | #define VIDEO_STOP_SEEK (BUTTON_MENU | BUTTON_REL) | ||
41 | #define VIDEO_RESUME BUTTON_RIGHT | 46 | #define VIDEO_RESUME BUTTON_RIGHT |
47 | #define VIDEO_CONTRAST_DOWN (BUTTON_MENU | BUTTON_DOWN) | ||
48 | #define VIDEO_CONTRAST_UP (BUTTON_MENU | BUTTON_UP) | ||
49 | |||
42 | #endif | 50 | #endif |
43 | /****************** constants ******************/ | 51 | /****************** constants ******************/ |
44 | 52 | ||
@@ -285,7 +293,6 @@ void ChangeVolume(int delta) | |||
285 | } | 293 | } |
286 | 294 | ||
287 | 295 | ||
288 | #if CONFIG_KEYPAD == RECORDER_PAD | ||
289 | // helper function to change the LCD contrast by a certain amount, +/- | 296 | // helper function to change the LCD contrast by a certain amount, +/- |
290 | void ChangeContrast(int delta) | 297 | void ChangeContrast(int delta) |
291 | { | 298 | { |
@@ -313,7 +320,6 @@ void ChangeContrast(int delta) | |||
313 | } | 320 | } |
314 | } | 321 | } |
315 | } | 322 | } |
316 | #endif | ||
317 | 323 | ||
318 | 324 | ||
319 | // sync the video to the current audio | 325 | // sync the video to the current audio |
@@ -563,6 +569,7 @@ void Cleanup(void *fd) | |||
563 | int PlayTick(int fd) | 569 | int PlayTick(int fd) |
564 | { | 570 | { |
565 | int button; | 571 | int button; |
572 | static int lastbutton = 0; | ||
566 | int avail_audio = -1, avail_video = -1; | 573 | int avail_audio = -1, avail_video = -1; |
567 | int retval = 1; | 574 | int retval = 1; |
568 | int filepos; | 575 | int filepos; |
@@ -667,11 +674,6 @@ int PlayTick(int fd) | |||
667 | else | 674 | else |
668 | filepos -= Available(gBuf.pReadAudio); // else audio | 675 | filepos -= Available(gBuf.pReadAudio); // else audio |
669 | 676 | ||
670 | if (rb->default_event_handler_ex(button, Cleanup, &fd) | ||
671 | == SYS_USB_CONNECTED) | ||
672 | retval = -1; // signal "aborted" to caller | ||
673 | // SYS_USB_CONNECTED won't be catched again by the switch() | ||
674 | |||
675 | switch (button) | 677 | switch (button) |
676 | { // set exit conditions | 678 | { // set exit conditions |
677 | case BUTTON_OFF: | 679 | case BUTTON_OFF: |
@@ -686,6 +688,10 @@ int PlayTick(int fd) | |||
686 | retval = 0; // signal "stopped" to caller | 688 | retval = 0; // signal "stopped" to caller |
687 | break; | 689 | break; |
688 | case VIDEO_STOP_SEEK: | 690 | case VIDEO_STOP_SEEK: |
691 | #ifdef VIDEO_STOP_SEEK_PRE | ||
692 | if (lastbutton != VIDEO_STOP_SEEK_PRE) | ||
693 | break; | ||
694 | #endif | ||
689 | if (gPlay.bSeeking) | 695 | if (gPlay.bSeeking) |
690 | { | 696 | { |
691 | gPlay.bSeeking = false; | 697 | gPlay.bSeeking = false; |
@@ -757,25 +763,32 @@ int PlayTick(int fd) | |||
757 | else | 763 | else |
758 | gPlay.nSeekAcc++; | 764 | gPlay.nSeekAcc++; |
759 | break; | 765 | break; |
760 | #if CONFIG_KEYPAD == RECORDER_PAD | 766 | #ifdef VIDEO_DEBUG |
761 | case BUTTON_F1: // debug key | 767 | case VIDEO_DEBUG: // debug key |
762 | case BUTTON_F1 | BUTTON_REPEAT: | 768 | case VIDEO_DEBUG | BUTTON_REPEAT: |
763 | DrawBuf(); // show buffer status | 769 | DrawBuf(); // show buffer status |
764 | gPlay.nTimeOSD = 30; | 770 | gPlay.nTimeOSD = 30; |
765 | gPlay.bDirtyOSD = true; | 771 | gPlay.bDirtyOSD = true; |
766 | break; | 772 | break; |
767 | case BUTTON_F2: // contrast down | 773 | #endif |
768 | case BUTTON_F2 | BUTTON_REPEAT: | 774 | case VIDEO_CONTRAST_DOWN: // contrast down |
775 | case VIDEO_CONTRAST_DOWN | BUTTON_REPEAT: | ||
769 | if (gPlay.bHasVideo) | 776 | if (gPlay.bHasVideo) |
770 | ChangeContrast(-1); | 777 | ChangeContrast(-1); |
771 | break; | 778 | break; |
772 | case BUTTON_F3: // contrast up | 779 | case VIDEO_CONTRAST_UP: // contrast up |
773 | case BUTTON_F3 | BUTTON_REPEAT: | 780 | case VIDEO_CONTRAST_UP | BUTTON_REPEAT: |
774 | if (gPlay.bHasVideo) | 781 | if (gPlay.bHasVideo) |
775 | ChangeContrast(1); | 782 | ChangeContrast(1); |
776 | break; | 783 | break; |
777 | #endif | 784 | default: |
785 | if (rb->default_event_handler_ex(button, Cleanup, &fd) | ||
786 | == SYS_USB_CONNECTED) | ||
787 | retval = -1; // signal "aborted" to caller | ||
788 | break; | ||
778 | } | 789 | } |
790 | |||
791 | lastbutton = button; | ||
779 | } /* if (button != BUTTON_NONE) */ | 792 | } /* if (button != BUTTON_NONE) */ |
780 | 793 | ||
781 | 794 | ||