diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2010-12-22 11:20:07 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2010-12-22 11:20:07 +0000 |
| commit | 9b4522bacec8cf1eb8ff69684cf959c0bb732c0d (patch) | |
| tree | a939f4cd549f7def0feed75d9d5728a213bd5c22 /apps/plugins/mpegplayer/mpeg_misc.c | |
| parent | 303aefc406a99cb47f41ed39283a3881f4c7f401 (diff) | |
| download | rockbox-9b4522bacec8cf1eb8ff69684cf959c0bb732c0d.zip rockbox-9b4522bacec8cf1eb8ff69684cf959c0bb732c0d.tar.gz rockbox-9b4522bacec8cf1eb8ff69684cf959c0bb732c0d.tar.bz2 rockbox-9b4522bacec8cf1eb8ff69684cf959c0bb732c0d.tar.xz | |
MPEGPlayer: Some UI tweaking and bugfixing
* Allow skip-to-beginning in single-play mode; there is no 3-second delay in that case.
* Properly handle and keep track of pauses caused by headphone removal.
* Improve skipping over bad files - search in skip direction and allow it to be ended with the stop key.
* Add the system message processing done elsewhere to all button queue waits.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28875 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer/mpeg_misc.c')
| -rw-r--r-- | apps/plugins/mpegplayer/mpeg_misc.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/apps/plugins/mpegplayer/mpeg_misc.c b/apps/plugins/mpegplayer/mpeg_misc.c index e201aa6..d9e0333 100644 --- a/apps/plugins/mpegplayer/mpeg_misc.c +++ b/apps/plugins/mpegplayer/mpeg_misc.c @@ -162,3 +162,58 @@ void list_enum_items(void **list, list++; /* Item still there */ } } + + +/** System events **/ +static long mpeg_sysevent_id; + +void mpeg_sysevent_clear(void) +{ + mpeg_sysevent_id = 0; +} + +void mpeg_sysevent_set(void) +{ + /* Nonzero and won't invoke anything in default event handler */ + mpeg_sysevent_id = ACTION_STD_CANCEL; +} + +long mpeg_sysevent(void) +{ + return mpeg_sysevent_id; +} + +int mpeg_sysevent_callback(int btn, const struct menu_item_ex *menu) +{ + switch (btn) + { + case SYS_USB_CONNECTED: + case SYS_POWEROFF: + mpeg_sysevent_id = btn; + return ACTION_STD_CANCEL; + } + + return btn; + (void)menu; +} + +void mpeg_sysevent_handle(void) +{ + long id = mpeg_sysevent(); + if (id != 0) + rb->default_event_handler(id); +} + + +/** Buttons **/ + +int mpeg_button_get(int timeout) +{ + int button; + + mpeg_sysevent_clear(); + button = timeout == TIMEOUT_BLOCK ? rb->button_get(true) : + rb->button_get_w_tmo(timeout); + return mpeg_sysevent_callback(button, NULL); +} + |