diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/video.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/apps/plugins/video.c b/apps/plugins/video.c index 234017d6f2..ce7611d389 100644 --- a/apps/plugins/video.c +++ b/apps/plugins/video.c | |||
@@ -272,6 +272,35 @@ void ChangeVolume(int delta) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | // helper function to change the LCD contrast by a certain amount, +/- | ||
276 | void ChangeContrast(int delta) | ||
277 | { | ||
278 | static int mycontrast = -1; /* the "permanent" value while running */ | ||
279 | int contrast; /* updated value */ | ||
280 | |||
281 | if (mycontrast == -1) | ||
282 | mycontrast = rb->global_settings->contrast; | ||
283 | |||
284 | contrast = mycontrast + delta; | ||
285 | if (contrast > 63) contrast = 63; | ||
286 | else if (contrast < 5) contrast = 5; | ||
287 | if (contrast != mycontrast) | ||
288 | { | ||
289 | rb->lcd_set_contrast(contrast); | ||
290 | mycontrast = contrast; | ||
291 | rb->snprintf(gPrint, sizeof(gPrint), "Contrast: %d", contrast); | ||
292 | rb->lcd_puts(0, 7, gPrint); | ||
293 | if (gPlay.state == paused) // we have to draw ourselves | ||
294 | rb->lcd_update_rect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | ||
295 | else // let the display time do it | ||
296 | { | ||
297 | gPlay.nTimeOSD = 50; // display it for 50 frames | ||
298 | gPlay.bDirtyOSD = true; // let the refresh copy it to LCD | ||
299 | } | ||
300 | } | ||
301 | } | ||
302 | |||
303 | |||
275 | // sync the video to the current audio | 304 | // sync the video to the current audio |
276 | void SyncVideo(void) | 305 | void SyncVideo(void) |
277 | { | 306 | { |
@@ -681,6 +710,16 @@ int PlayTick(int fd) | |||
681 | gPlay.nTimeOSD = 30; | 710 | gPlay.nTimeOSD = 30; |
682 | gPlay.bDirtyOSD = true; | 711 | gPlay.bDirtyOSD = true; |
683 | break; | 712 | break; |
713 | case BUTTON_F2: // contrast down | ||
714 | case BUTTON_F2 | BUTTON_REPEAT: | ||
715 | if (gPlay.bHasVideo) | ||
716 | ChangeContrast(-1); | ||
717 | break; | ||
718 | case BUTTON_F3: // contrast up | ||
719 | case BUTTON_F3 | BUTTON_REPEAT: | ||
720 | if (gPlay.bHasVideo) | ||
721 | ChangeContrast(1); | ||
722 | break; | ||
684 | } | 723 | } |
685 | } /* if (button != BUTTON_NONE) */ | 724 | } /* if (button != BUTTON_NONE) */ |
686 | 725 | ||
@@ -836,6 +875,9 @@ int main(char* filename) | |||
836 | // restore normal backlight setting | 875 | // restore normal backlight setting |
837 | rb->backlight_set_timeout(rb->global_settings->backlight_timeout); | 876 | rb->backlight_set_timeout(rb->global_settings->backlight_timeout); |
838 | 877 | ||
878 | // restore normal contrast | ||
879 | rb->lcd_set_contrast(rb->global_settings->contrast); | ||
880 | |||
839 | if (retval < 0) // aborted? | 881 | if (retval < 0) // aborted? |
840 | { | 882 | { |
841 | return PLUGIN_USB_CONNECTED; | 883 | return PLUGIN_USB_CONNECTED; |