2006-08-20 23:12:56 +00:00
|
|
|
#include "plugin.h"
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "lib/helper.h"
|
2006-08-20 23:12:56 +00:00
|
|
|
#include "lib/configfile.h"
|
|
|
|
|
2007-12-29 19:46:35 +00:00
|
|
|
#include "mpegplayer.h"
|
2006-08-20 23:12:56 +00:00
|
|
|
#include "mpeg_settings.h"
|
|
|
|
|
|
|
|
struct mpeg_settings settings;
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2007-12-29 19:46:35 +00:00
|
|
|
#define THUMB_DELAY (75*HZ/100)
|
2007-10-09 20:42:20 +00:00
|
|
|
|
|
|
|
/* button definitions */
|
|
|
|
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_ON
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_OFF
|
2007-10-09 20:42:20 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
2007-10-09 20:42:20 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_UP BUTTON_SCROLL_FWD
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_SCROLL_BACK
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_MENU
|
2007-10-09 20:42:20 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_RC_SELECT (BUTTON_RC_PLAY | BUTTON_REL)
|
|
|
|
#define MPEG_START_TIME_RC_LEFT BUTTON_RC_REW
|
|
|
|
#define MPEG_START_TIME_RC_RIGHT BUTTON_RC_FF
|
|
|
|
#define MPEG_START_TIME_RC_UP BUTTON_RC_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RC_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_RC_EXIT (BUTTON_RC_PLAY | BUTTON_REPEAT)
|
2008-01-27 00:18:29 +00:00
|
|
|
|
2008-05-02 00:38:11 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
2008-05-02 00:38:11 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_RC_SELECT (BUTTON_RC_PLAY | BUTTON_REL)
|
|
|
|
#define MPEG_START_TIME_RC_LEFT BUTTON_RC_REW
|
|
|
|
#define MPEG_START_TIME_RC_RIGHT BUTTON_RC_FF
|
|
|
|
#define MPEG_START_TIME_RC_UP BUTTON_RC_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RC_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_RC_EXIT (BUTTON_RC_PLAY | BUTTON_REPEAT)
|
2009-02-03 10:55:30 +00:00
|
|
|
|
2007-10-09 20:42:20 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_SCROLL_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_SCROLL_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2009-05-13 08:27:36 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD)
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_SCROLL_BACK
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_SCROLL_FWD
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2009-05-13 08:27:36 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_SCROLL_BACK
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_SCROLL_FWD
|
2009-05-13 08:27:36 +00:00
|
|
|
#define MPEG_START_TIME_EXIT (BUTTON_HOME|BUTTON_REPEAT)
|
|
|
|
|
2008-12-12 19:50:49 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == SANSA_M200_PAD)
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2007-10-25 07:44:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE500_PAD
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_RC_HEART
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_RC_PLAY
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_RC_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_RC_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_RC_VOL_DOWN
|
2008-01-12 05:45:38 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
2007-10-25 07:44:56 +00:00
|
|
|
|
2008-03-01 22:55:09 +00:00
|
|
|
#elif CONFIG_KEYPAD == MROBE100_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_MENU
|
2008-03-01 22:55:09 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2008-03-25 23:21:36 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_RC_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_RC_REW
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RC_FF
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_RC_VOL_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_RC_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_RC_REC
|
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
2008-03-22 22:03:34 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2008-10-07 16:38:28 +00:00
|
|
|
#elif CONFIG_KEYPAD == IAUDIO67_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_MENU
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_STOP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2008-12-04 21:28:56 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
2008-12-08 09:51:42 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
2008-12-04 21:28:56 +00:00
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_MENU
|
2008-12-04 21:28:56 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_BACK
|
|
|
|
|
2014-03-21 21:16:02 +00:00
|
|
|
#elif (CONFIG_KEYPAD == CREATIVE_ZENXFI3_PAD)
|
|
|
|
#define MPEG_START_TIME_SELECT (BUTTON_PLAY|BUTTON_REL)
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_BACK
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_MENU
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT (BUTTON_PLAY|BUTTON_REPEAT)
|
|
|
|
|
2009-01-24 22:41:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
2009-12-07 18:23:25 +00:00
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
2010-11-03 02:45:53 +00:00
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD6330_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
2009-12-07 18:23:25 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_PREV
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_NEXT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
2009-01-24 22:41:55 +00:00
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2010-01-13 12:55:52 +00:00
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
2009-01-24 22:41:55 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2009-04-07 23:41:44 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX747_PAD
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2009-08-31 21:11:32 +00:00
|
|
|
#elif CONFIG_KEYPAD == ONDAVX777_PAD
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2014-05-22 21:34:52 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YH820_PAD) || \
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)
|
2009-08-04 03:08:32 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2015-07-19 23:50:26 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_REW
|
2009-08-04 03:08:32 +00:00
|
|
|
|
2010-02-14 21:56:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_PREV
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_NEXT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_OK
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_CANCEL
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_REC
|
|
|
|
|
2010-04-26 21:40:00 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
2010-11-02 10:44:34 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_FUNC
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_REW
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_FF
|
2010-04-26 21:40:00 +00:00
|
|
|
#define MPEG_START_TIME_UP BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_REC
|
|
|
|
|
2010-11-30 10:52:14 +00:00
|
|
|
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_ENTER
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_REW
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_FF
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_REC
|
|
|
|
|
2011-10-02 17:35:25 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2011-11-16 14:08:01 +00:00
|
|
|
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
Initial commit of the Samsung YP-R0 port.
This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.
The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).
Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.
This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.
Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.
Flyspray: FS#12348
Author: Lorenzo Miori, myself
Merry christmas to ypr0 owners! :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 11:56:46 +00:00
|
|
|
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_BACK
|
|
|
|
|
2012-04-06 16:17:27 +00:00
|
|
|
#elif (CONFIG_KEYPAD == HM60X_PAD) || (CONFIG_KEYPAD == HM801_PAD)
|
2012-03-23 18:32:50 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2014-06-30 18:24:15 +00:00
|
|
|
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_BACK
|
|
|
|
|
2014-07-17 08:40:17 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_BACK
|
|
|
|
|
2014-08-30 11:15:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == DX50_PAD
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_VOL_DOWN
|
|
|
|
|
2018-02-22 22:42:29 +00:00
|
|
|
#elif CONFIG_KEYPAD == CREATIVE_ZENXFI2_PAD
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2018-03-02 20:53:55 +00:00
|
|
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_SELECT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_LEFT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_UP
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_DOWN
|
2018-06-14 07:09:24 +00:00
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
2018-03-02 20:53:55 +00:00
|
|
|
|
2018-06-28 10:24:26 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_PREV
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_NEXT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_HOME
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_OPTION
|
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == XDUOO_X3II_PAD || CONFIG_KEYPAD == XDUOO_X20_PAD
|
2018-11-05 12:01:55 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_PREV
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_NEXT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_HOME
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_OPTION
|
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2020-10-03 22:17:11 +00:00
|
|
|
#elif CONFIG_KEYPAD == FIIO_M3K_PAD
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_PREV
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_NEXT
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_HOME
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_OPTION
|
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == IHIFI_770_PAD || CONFIG_KEYPAD == IHIFI_800_PAD
|
2018-06-29 20:09:28 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_HOME
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_VOL_DOWN
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_PREV
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_NEXT
|
|
|
|
#define MPEG_START_TIME_LEFT2 (BUTTON_POWER + BUTTON_HOME)
|
|
|
|
#define MPEG_START_TIME_RIGHT2 (BUTTON_POWER + BUTTON_VOL_DOWN)
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2020-10-08 13:47:40 +00:00
|
|
|
#elif CONFIG_KEYPAD == EROSQ_PAD
|
2018-06-29 20:09:28 +00:00
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_PLAY
|
2020-10-08 13:47:40 +00:00
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_SCROLL_BACK
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_SCROLL_FWD
|
2018-06-29 20:09:28 +00:00
|
|
|
#define MPEG_START_TIME_UP BUTTON_PREV
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_NEXT
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_POWER
|
|
|
|
|
2007-10-09 20:42:20 +00:00
|
|
|
#else
|
2008-03-01 22:55:09 +00:00
|
|
|
#error No keymap defined!
|
2007-10-09 20:42:20 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef MPEG_START_TIME_SELECT
|
|
|
|
#define MPEG_START_TIME_SELECT BUTTON_CENTER
|
|
|
|
#endif
|
|
|
|
#ifndef MPEG_START_TIME_LEFT
|
|
|
|
#define MPEG_START_TIME_LEFT BUTTON_MIDLEFT
|
|
|
|
#endif
|
|
|
|
#ifndef MPEG_START_TIME_RIGHT
|
|
|
|
#define MPEG_START_TIME_RIGHT BUTTON_MIDRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef MPEG_START_TIME_UP
|
|
|
|
#define MPEG_START_TIME_UP BUTTON_TOPMIDDLE
|
|
|
|
#endif
|
|
|
|
#ifndef MPEG_START_TIME_DOWN
|
|
|
|
#define MPEG_START_TIME_DOWN BUTTON_BOTTOMMIDDLE
|
|
|
|
#endif
|
2010-01-13 12:55:52 +00:00
|
|
|
#ifndef MPEG_START_TIME_LEFT2
|
|
|
|
#define MPEG_START_TIME_LEFT2 BUTTON_TOPRIGHT
|
|
|
|
#endif
|
|
|
|
#ifndef MPEG_START_TIME_RIGHT2
|
|
|
|
#define MPEG_START_TIME_RIGHT2 BUTTON_TOPLEFT
|
|
|
|
#endif
|
2008-04-27 15:30:19 +00:00
|
|
|
#ifndef MPEG_START_TIME_EXIT
|
|
|
|
#define MPEG_START_TIME_EXIT BUTTON_TOPLEFT
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2006-08-20 23:12:56 +00:00
|
|
|
static struct configdata config[] =
|
|
|
|
{
|
2009-01-17 22:53:12 +00:00
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.showfps }, "Show FPS", NULL},
|
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.limitfps }, "Limit FPS", NULL},
|
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.skipframes }, "Skip frames", NULL},
|
|
|
|
{TYPE_INT, 0, INT_MAX, { .int_p = &settings.resume_count }, "Resume count",
|
|
|
|
NULL},
|
|
|
|
{TYPE_INT, 0, MPEG_RESUME_NUM_OPTIONS,
|
|
|
|
{ .int_p = &settings.resume_options }, "Resume options", NULL},
|
2010-01-13 12:55:52 +00:00
|
|
|
#if MPEG_OPTION_DITHERING_ENABLED
|
2009-01-17 22:53:12 +00:00
|
|
|
{TYPE_INT, 0, INT_MAX, { .int_p = &settings.displayoptions },
|
|
|
|
"Display options", NULL},
|
2007-09-25 02:59:42 +00:00
|
|
|
#endif
|
2009-01-17 22:53:12 +00:00
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.tone_controls }, "Tone controls",
|
|
|
|
NULL},
|
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.channel_modes }, "Channel modes",
|
|
|
|
NULL},
|
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.crossfeed }, "Crossfeed", NULL},
|
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.equalizer }, "Equalizer", NULL},
|
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.dithering }, "Dithering", NULL},
|
2010-11-26 12:32:00 +00:00
|
|
|
{TYPE_INT, 0, 2, { .int_p = &settings.play_mode }, "Play mode", NULL},
|
2008-05-18 00:14:34 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
2009-01-17 22:53:12 +00:00
|
|
|
{TYPE_INT, -1, INT_MAX, { .int_p = &settings.backlight_brightness },
|
|
|
|
"Backlight brightness", NULL},
|
2008-05-18 00:14:34 +00:00
|
|
|
#endif
|
2007-09-25 02:59:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const struct opt_items noyes[2] = {
|
2019-07-20 21:32:49 +00:00
|
|
|
{ STR(LANG_SET_BOOL_NO) },
|
|
|
|
{ STR(LANG_SET_BOOL_YES) },
|
2006-08-20 23:12:56 +00:00
|
|
|
};
|
|
|
|
|
2010-11-26 12:32:00 +00:00
|
|
|
static const struct opt_items singleall[2] = {
|
2019-07-20 21:32:49 +00:00
|
|
|
{ STR(LANG_SINGLE) },
|
|
|
|
{ STR(LANG_ALL) },
|
2007-10-21 16:44:13 +00:00
|
|
|
};
|
|
|
|
|
2008-02-01 02:25:15 +00:00
|
|
|
static const struct opt_items globaloff[2] = {
|
2019-07-20 21:32:49 +00:00
|
|
|
{ STR(LANG_OFF) },
|
|
|
|
{ STR(LANG_USE_SOUND_SETTING) },
|
2008-02-01 02:25:15 +00:00
|
|
|
};
|
|
|
|
|
2009-08-27 14:24:58 +00:00
|
|
|
static void mpeg_settings(void);
|
2008-01-12 05:45:38 +00:00
|
|
|
static bool mpeg_set_option(const char* string,
|
|
|
|
void* variable,
|
|
|
|
enum optiontype type,
|
|
|
|
const struct opt_items* options,
|
|
|
|
int numoptions,
|
|
|
|
void (*function)(int))
|
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2008-01-12 05:45:38 +00:00
|
|
|
|
|
|
|
/* This eats SYS_POWEROFF - :\ */
|
|
|
|
bool usb = rb->set_option(string, variable, type, options, numoptions,
|
|
|
|
function);
|
|
|
|
|
|
|
|
if (usb)
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_set();
|
2008-01-12 05:45:38 +00:00
|
|
|
|
|
|
|
return usb;
|
2007-10-16 14:23:50 +00:00
|
|
|
}
|
2007-09-25 02:59:42 +00:00
|
|
|
|
2008-05-18 00:25:04 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS /* Only used for this atm */
|
2008-05-18 00:14:34 +00:00
|
|
|
static bool mpeg_set_int(const char *string, const char *unit,
|
|
|
|
int voice_unit, const int *variable,
|
|
|
|
void (*function)(int), int step,
|
|
|
|
int min,
|
|
|
|
int max,
|
2019-07-20 21:32:49 +00:00
|
|
|
const char* (*formatter)(char*, size_t, int, const char*),
|
|
|
|
int32_t (*get_talk_id)(int, int))
|
2008-05-18 00:14:34 +00:00
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2008-05-18 00:14:34 +00:00
|
|
|
|
2019-07-20 21:32:49 +00:00
|
|
|
bool usb = rb->set_int_ex(string, unit, voice_unit, variable, function,
|
|
|
|
step, min, max, formatter, get_talk_id);
|
2008-05-18 00:14:34 +00:00
|
|
|
|
|
|
|
if (usb)
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_set();
|
2008-05-18 00:14:34 +00:00
|
|
|
|
|
|
|
return usb;
|
|
|
|
}
|
|
|
|
|
2019-07-20 21:32:49 +00:00
|
|
|
static int32_t backlight_brightness_getlang(int value, int unit)
|
|
|
|
{
|
|
|
|
if (value < 0)
|
|
|
|
return LANG_USE_COMMON_SETTING;
|
|
|
|
|
|
|
|
return TALK_ID(value + MIN_BRIGHTNESS_SETTING, unit);
|
|
|
|
}
|
|
|
|
|
2008-05-18 00:14:34 +00:00
|
|
|
void mpeg_backlight_update_brightness(int value)
|
|
|
|
{
|
|
|
|
if (value >= 0)
|
|
|
|
{
|
|
|
|
value += MIN_BRIGHTNESS_SETTING;
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_brightness_set(value);
|
2008-05-18 00:14:34 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-01-16 10:34:40 +00:00
|
|
|
backlight_brightness_use_setting();
|
2008-05-18 00:14:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void backlight_brightness_function(int value)
|
|
|
|
{
|
|
|
|
mpeg_backlight_update_brightness(value);
|
|
|
|
}
|
|
|
|
|
2009-08-20 16:47:44 +00:00
|
|
|
static const char* backlight_brightness_formatter(char *buf, size_t length,
|
|
|
|
int value, const char *input)
|
2008-05-18 00:14:34 +00:00
|
|
|
{
|
2009-08-20 16:47:44 +00:00
|
|
|
(void)input;
|
|
|
|
|
2008-05-18 00:14:34 +00:00
|
|
|
if (value < 0)
|
2019-07-20 21:32:49 +00:00
|
|
|
return rb->str(LANG_USE_COMMON_SETTING);
|
2008-05-18 00:14:34 +00:00
|
|
|
else
|
|
|
|
rb->snprintf(buf, length, "%d", value + MIN_BRIGHTNESS_SETTING);
|
2009-08-20 16:47:44 +00:00
|
|
|
return buf;
|
2008-05-18 00:14:34 +00:00
|
|
|
}
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
|
|
|
|
2008-02-01 02:25:15 +00:00
|
|
|
/* Sync a particular audio setting to global or mpegplayer forced off */
|
|
|
|
static void sync_audio_setting(int setting, bool global)
|
|
|
|
{
|
|
|
|
switch (setting)
|
|
|
|
{
|
|
|
|
case MPEG_AUDIO_TONE_CONTROLS:
|
2010-05-15 13:09:45 +00:00
|
|
|
#ifdef AUDIOHW_HAVE_BASS
|
2011-10-10 01:39:56 +00:00
|
|
|
rb->sound_set(SOUND_BASS, (global || settings.tone_controls)
|
|
|
|
? rb->global_settings->bass
|
|
|
|
: rb->sound_default(SOUND_BASS));
|
2010-05-15 13:09:45 +00:00
|
|
|
#endif
|
|
|
|
#ifdef AUDIOHW_HAVE_TREBLE
|
2011-10-10 01:39:56 +00:00
|
|
|
rb->sound_set(SOUND_TREBLE, (global || settings.tone_controls)
|
|
|
|
? rb->global_settings->treble
|
2011-10-10 01:50:28 +00:00
|
|
|
: rb->sound_default(SOUND_TREBLE));
|
2010-05-15 13:09:45 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AUDIOHW_HAVE_EQ
|
2011-10-10 01:39:56 +00:00
|
|
|
for (int band = 0;; band++)
|
2010-05-15 13:09:45 +00:00
|
|
|
{
|
2011-10-10 01:39:56 +00:00
|
|
|
int setting = rb->sound_enum_hw_eq_band_setting(band, AUDIOHW_EQ_GAIN);
|
2010-05-15 13:09:45 +00:00
|
|
|
|
|
|
|
if (setting == -1)
|
|
|
|
break;
|
|
|
|
|
2011-10-10 01:39:56 +00:00
|
|
|
rb->sound_set(setting, (global || settings.tone_controls)
|
|
|
|
? rb->global_settings->hw_eq_bands[band].gain
|
|
|
|
: rb->sound_default(setting));
|
2010-05-15 13:09:45 +00:00
|
|
|
}
|
|
|
|
#endif /* AUDIOHW_HAVE_EQ */
|
2008-02-01 02:25:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_CHANNEL_MODES:
|
2011-10-10 01:39:56 +00:00
|
|
|
rb->sound_set(SOUND_CHANNELS, (global || settings.channel_modes)
|
|
|
|
? rb->global_settings->channel_config
|
|
|
|
: SOUND_CHAN_STEREO);
|
2008-02-01 02:25:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_CROSSFEED:
|
2012-05-01 07:58:27 +00:00
|
|
|
rb->dsp_set_crossfeed_type((global || settings.crossfeed) ?
|
|
|
|
rb->global_settings->crossfeed :
|
|
|
|
CROSSFEED_TYPE_NONE);
|
2008-02-01 02:25:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_EQUALIZER:
|
2012-03-27 23:52:15 +00:00
|
|
|
rb->dsp_eq_enable((global || settings.equalizer) ?
|
|
|
|
rb->global_settings->eq_enabled : false);
|
2008-02-01 02:25:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_DITHERING:
|
|
|
|
rb->dsp_dither_enable((global || settings.dithering) ?
|
|
|
|
rb->global_settings->dithering_enabled : false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sync all audio settings to global or mpegplayer forced off */
|
|
|
|
static void sync_audio_settings(bool global)
|
|
|
|
{
|
|
|
|
static const int setting_index[] =
|
|
|
|
{
|
|
|
|
MPEG_AUDIO_TONE_CONTROLS,
|
|
|
|
MPEG_AUDIO_CHANNEL_MODES,
|
|
|
|
MPEG_AUDIO_CROSSFEED,
|
|
|
|
MPEG_AUDIO_EQUALIZER,
|
|
|
|
MPEG_AUDIO_DITHERING,
|
|
|
|
};
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAYLEN(setting_index); i++)
|
|
|
|
{
|
|
|
|
sync_audio_setting(setting_index[i], global);
|
|
|
|
}
|
|
|
|
}
|
2008-01-12 05:45:38 +00:00
|
|
|
|
2008-01-09 22:19:25 +00:00
|
|
|
#ifndef HAVE_LCD_COLOR
|
|
|
|
/* Cheapo splash implementation for the grey surface */
|
|
|
|
static void grey_splash(int ticks, const unsigned char *fmt, ...)
|
|
|
|
{
|
|
|
|
unsigned char buffer[256];
|
|
|
|
int x, y, w, h;
|
|
|
|
int oldfg, oldmode;
|
|
|
|
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
|
|
|
rb->vsnprintf(buffer, sizeof (buffer), fmt, ap);
|
|
|
|
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
grey_getstringsize(buffer, &w, &h);
|
|
|
|
|
|
|
|
oldfg = grey_get_foreground();
|
|
|
|
oldmode = grey_get_drawmode();
|
|
|
|
|
|
|
|
grey_set_drawmode(DRMODE_FG);
|
|
|
|
grey_set_foreground(GREY_LIGHTGRAY);
|
|
|
|
|
|
|
|
x = (LCD_WIDTH - w) / 2;
|
|
|
|
y = (LCD_HEIGHT - h) / 2;
|
|
|
|
|
|
|
|
grey_fillrect(x - 1, y - 1, w + 2, h + 2);
|
|
|
|
|
|
|
|
grey_set_foreground(GREY_BLACK);
|
|
|
|
|
|
|
|
grey_putsxy(x, y, buffer);
|
|
|
|
grey_drawrect(x - 2, y - 2, w + 4, h + 4);
|
|
|
|
|
|
|
|
grey_set_foreground(oldfg);
|
|
|
|
grey_set_drawmode(oldmode);
|
|
|
|
|
|
|
|
grey_update();
|
|
|
|
|
|
|
|
if (ticks > 0)
|
|
|
|
rb->sleep(ticks);
|
|
|
|
}
|
|
|
|
#endif /* !HAVE_LCD_COLOR */
|
|
|
|
|
2007-12-29 19:46:35 +00:00
|
|
|
static void show_loading(struct vo_rect *rc)
|
2007-10-09 20:42:20 +00:00
|
|
|
{
|
2010-06-04 08:43:32 +00:00
|
|
|
int oldmode = mylcd_get_drawmode();
|
|
|
|
mylcd_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
|
|
|
|
mylcd_fillrect(rc->l-1, rc->t-1, rc->r - rc->l + 2, rc->b - rc->t + 2);
|
|
|
|
mylcd_set_drawmode(oldmode);
|
|
|
|
mylcd_splash(0, "Loading...");
|
2007-12-29 19:46:35 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
static void draw_slider(uint32_t range, uint32_t pos, struct vo_rect *rc)
|
2007-12-29 19:46:35 +00:00
|
|
|
{
|
|
|
|
#define SLIDER_WIDTH (LCD_WIDTH-SLIDER_LMARGIN-SLIDER_RMARGIN)
|
|
|
|
#define SLIDER_X SLIDER_LMARGIN
|
|
|
|
#define SLIDER_Y (LCD_HEIGHT-SLIDER_HEIGHT-SLIDER_BMARGIN)
|
|
|
|
#define SLIDER_HEIGHT 8
|
|
|
|
#define SLIDER_TEXTMARGIN 1
|
|
|
|
#define SLIDER_LMARGIN 1
|
|
|
|
#define SLIDER_RMARGIN 1
|
|
|
|
#define SLIDER_TMARGIN 1
|
|
|
|
#define SLIDER_BMARGIN 1
|
|
|
|
#define SCREEN_MARGIN 1
|
|
|
|
|
|
|
|
struct hms hms;
|
|
|
|
char str[32];
|
|
|
|
int text_w, text_h, text_y;
|
|
|
|
|
|
|
|
/* Put positition on left */
|
|
|
|
ts_to_hms(pos, &hms);
|
|
|
|
hms_format(str, sizeof(str), &hms);
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_getstringsize(str, NULL, &text_h);
|
2007-12-29 19:46:35 +00:00
|
|
|
text_y = SLIDER_Y - SLIDER_TEXTMARGIN - text_h;
|
|
|
|
|
|
|
|
if (rc == NULL)
|
|
|
|
{
|
2010-06-04 08:43:32 +00:00
|
|
|
int oldmode = mylcd_get_drawmode();
|
|
|
|
mylcd_set_drawmode(DRMODE_BG | DRMODE_INVERSEVID);
|
|
|
|
mylcd_fillrect(SLIDER_X, text_y, SLIDER_WIDTH,
|
2008-01-09 22:19:25 +00:00
|
|
|
LCD_HEIGHT - SLIDER_BMARGIN - text_y
|
|
|
|
- SLIDER_TMARGIN);
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_set_drawmode(oldmode);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_putsxy(SLIDER_X, text_y, str);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
|
|
|
/* Put duration on right */
|
|
|
|
ts_to_hms(range, &hms);
|
|
|
|
hms_format(str, sizeof(str), &hms);
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_getstringsize(str, &text_w, NULL);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_putsxy(SLIDER_X + SLIDER_WIDTH - text_w, text_y, str);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
|
|
|
/* Draw slider */
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_drawrect(SLIDER_X, SLIDER_Y, SLIDER_WIDTH, SLIDER_HEIGHT);
|
|
|
|
mylcd_fillrect(SLIDER_X, SLIDER_Y,
|
|
|
|
muldiv_uint32(pos, SLIDER_WIDTH, range),
|
|
|
|
SLIDER_HEIGHT);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
|
|
|
/* Update screen */
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_update_rect(SLIDER_X, text_y - SLIDER_TMARGIN, SLIDER_WIDTH,
|
|
|
|
LCD_HEIGHT - SLIDER_BMARGIN - text_y + SLIDER_TEXTMARGIN);
|
2007-12-29 19:46:35 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Just return slider rectangle */
|
|
|
|
rc->l = SLIDER_X;
|
|
|
|
rc->t = text_y - SLIDER_TMARGIN;
|
|
|
|
rc->r = rc->l + SLIDER_WIDTH;
|
|
|
|
rc->b = rc->t + LCD_HEIGHT - SLIDER_BMARGIN - text_y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
static bool display_thumb_image(const struct vo_rect *rc)
|
2007-12-29 19:46:35 +00:00
|
|
|
{
|
2011-01-03 16:41:19 +00:00
|
|
|
bool retval = true;
|
|
|
|
unsigned ltgray = MYLCD_LIGHTGRAY;
|
|
|
|
unsigned dkgray = MYLCD_DARKGRAY;
|
|
|
|
|
|
|
|
int oldcolor = mylcd_get_foreground();
|
|
|
|
|
2007-12-29 19:46:35 +00:00
|
|
|
if (!stream_display_thumb(rc))
|
|
|
|
{
|
2011-01-03 16:41:19 +00:00
|
|
|
/* Display "No Frame" and erase any border */
|
|
|
|
const char * const str = "No Frame";
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
mylcd_getstringsize(str, &w, &h);
|
|
|
|
x = (rc->r + rc->l - w) / 2;
|
|
|
|
y = (rc->b + rc->t - h) / 2;
|
|
|
|
mylcd_putsxy(x, y, str);
|
|
|
|
|
|
|
|
mylcd_update_rect(x, y, w, h);
|
|
|
|
|
|
|
|
ltgray = dkgray = mylcd_get_background();
|
|
|
|
retval = false;
|
2007-12-29 19:46:35 +00:00
|
|
|
}
|
|
|
|
|
2011-01-03 16:41:19 +00:00
|
|
|
/* Draw a raised border around the frame (or erase if no frame) */
|
|
|
|
|
|
|
|
mylcd_set_foreground(ltgray);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_hline(rc->l-1, rc->r-1, rc->t-1);
|
|
|
|
mylcd_vline(rc->l-1, rc->t, rc->b-1);
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2011-01-03 16:41:19 +00:00
|
|
|
mylcd_set_foreground(dkgray);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_hline(rc->l-1, rc->r, rc->b);
|
|
|
|
mylcd_vline(rc->r, rc->t-1, rc->b);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_set_foreground(oldcolor);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_update_rect(rc->l-1, rc->t-1, rc->r - rc->l + 2, 1);
|
|
|
|
mylcd_update_rect(rc->l-1, rc->t, 1, rc->b - rc->t);
|
|
|
|
mylcd_update_rect(rc->l-1, rc->b, rc->r - rc->l + 2, 1);
|
|
|
|
mylcd_update_rect(rc->r, rc->t, 1, rc->b - rc->t);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2011-01-03 16:41:19 +00:00
|
|
|
return retval;
|
2007-12-29 19:46:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Add an amount to the specified time - with saturation */
|
2008-01-12 05:45:38 +00:00
|
|
|
static uint32_t increment_time(uint32_t val, int32_t amount, uint32_t range)
|
2007-12-29 19:46:35 +00:00
|
|
|
{
|
|
|
|
if (amount < 0)
|
|
|
|
{
|
|
|
|
uint32_t off = -amount;
|
|
|
|
if (range > off && val >= off)
|
|
|
|
val -= off;
|
|
|
|
else
|
|
|
|
val = 0;
|
|
|
|
}
|
|
|
|
else if (amount > 0)
|
|
|
|
{
|
|
|
|
uint32_t off = amount;
|
|
|
|
if (range > off && val <= range - off)
|
|
|
|
val += off;
|
|
|
|
else
|
|
|
|
val = range;
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
2007-10-09 20:42:20 +00:00
|
|
|
}
|
|
|
|
|
2009-10-20 22:17:13 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
2014-03-14 22:15:16 +00:00
|
|
|
static void get_start_time_lcd_enable_hook(unsigned short id, void *param)
|
2008-05-28 10:17:16 +00:00
|
|
|
{
|
2014-03-14 22:15:16 +00:00
|
|
|
(void)id;
|
2009-10-20 21:54:59 +00:00
|
|
|
(void)param;
|
2008-05-28 10:17:16 +00:00
|
|
|
rb->queue_post(rb->button_queue, LCD_ENABLE_EVENT_0, 0);
|
|
|
|
}
|
|
|
|
#endif /* HAVE_LCD_ENABLE */
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
static int get_start_time(uint32_t duration)
|
2007-10-09 20:42:20 +00:00
|
|
|
{
|
|
|
|
int button = 0;
|
2007-12-29 19:46:35 +00:00
|
|
|
int tmo = TIMEOUT_NOBLOCK;
|
|
|
|
uint32_t resume_time = settings.resume_time;
|
|
|
|
struct vo_rect rc_vid, rc_bound;
|
|
|
|
uint32_t aspect_vid, aspect_bound;
|
2019-07-20 21:32:49 +00:00
|
|
|
bool sliding = false;
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
enum state_enum slider_state = STATE0;
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-06-04 08:43:32 +00:00
|
|
|
mylcd_clear_display();
|
|
|
|
mylcd_update();
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2009-10-20 22:17:13 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
2014-03-14 22:15:16 +00:00
|
|
|
rb->add_event(LCD_EVENT_ACTIVATION, get_start_time_lcd_enable_hook);
|
2008-05-28 10:17:16 +00:00
|
|
|
#endif
|
|
|
|
|
2007-12-29 19:46:35 +00:00
|
|
|
draw_slider(0, 100, &rc_bound);
|
|
|
|
rc_bound.b = rc_bound.t - SLIDER_TMARGIN;
|
|
|
|
rc_bound.t = SCREEN_MARGIN;
|
|
|
|
|
|
|
|
DEBUGF("rc_bound: %d, %d, %d, %d\n", rc_bound.l, rc_bound.t,
|
|
|
|
rc_bound.r, rc_bound.b);
|
|
|
|
|
|
|
|
rc_vid.l = rc_vid.t = 0;
|
|
|
|
if (!stream_vo_get_size((struct vo_ext *)&rc_vid.r))
|
2007-10-09 20:42:20 +00:00
|
|
|
{
|
2007-12-29 19:46:35 +00:00
|
|
|
/* Can't get size - fill whole thing */
|
|
|
|
rc_vid.r = rc_bound.r - rc_bound.l;
|
|
|
|
rc_vid.b = rc_bound.b - rc_bound.t;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get aspect ratio of bounding rectangle and video in u16.16 */
|
|
|
|
aspect_bound = ((rc_bound.r - rc_bound.l) << 16) /
|
|
|
|
(rc_bound.b - rc_bound.t);
|
|
|
|
|
2007-12-29 20:06:42 +00:00
|
|
|
DEBUGF("aspect_bound: %u.%02u\n", (unsigned)(aspect_bound >> 16),
|
|
|
|
(unsigned)(100*(aspect_bound & 0xffff) >> 16));
|
2007-12-29 19:46:35 +00:00
|
|
|
|
|
|
|
aspect_vid = (rc_vid.r << 16) / rc_vid.b;
|
|
|
|
|
2007-12-29 20:06:42 +00:00
|
|
|
DEBUGF("aspect_vid: %u.%02u\n", (unsigned)(aspect_vid >> 16),
|
|
|
|
(unsigned)(100*(aspect_vid & 0xffff) >> 16));
|
2007-12-29 19:46:35 +00:00
|
|
|
|
|
|
|
if (aspect_vid >= aspect_bound)
|
|
|
|
{
|
|
|
|
/* Video proportionally wider than or same as bounding rectangle */
|
|
|
|
if (rc_vid.r > rc_bound.r - rc_bound.l)
|
|
|
|
{
|
|
|
|
rc_vid.r = rc_bound.r - rc_bound.l;
|
|
|
|
rc_vid.b = (rc_vid.r << 16) / aspect_vid;
|
|
|
|
}
|
|
|
|
/* else already fits */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Video proportionally narrower than bounding rectangle */
|
|
|
|
if (rc_vid.b > rc_bound.b - rc_bound.t)
|
|
|
|
{
|
|
|
|
rc_vid.b = rc_bound.b - rc_bound.t;
|
|
|
|
rc_vid.r = (aspect_vid * rc_vid.b) >> 16;
|
|
|
|
}
|
|
|
|
/* else already fits */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Even width and height >= 2 */
|
|
|
|
rc_vid.r = (rc_vid.r < 2) ? 2 : (rc_vid.r & ~1);
|
|
|
|
rc_vid.b = (rc_vid.b < 2) ? 2 : (rc_vid.b & ~1);
|
|
|
|
|
|
|
|
/* Center display in bounding rectangle */
|
|
|
|
rc_vid.l = ((rc_bound.l + rc_bound.r) - rc_vid.r) / 2;
|
|
|
|
rc_vid.r += rc_vid.l;
|
|
|
|
|
|
|
|
rc_vid.t = ((rc_bound.t + rc_bound.b) - rc_vid.b) / 2;
|
|
|
|
rc_vid.b += rc_vid.t;
|
|
|
|
|
|
|
|
DEBUGF("rc_vid: %d, %d, %d, %d\n", rc_vid.l, rc_vid.t,
|
|
|
|
rc_vid.r, rc_vid.b);
|
|
|
|
|
|
|
|
#ifndef HAVE_LCD_COLOR
|
2008-01-09 22:19:25 +00:00
|
|
|
stream_gray_show(true);
|
2007-12-29 19:46:35 +00:00
|
|
|
#endif
|
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
while (slider_state < STATE9)
|
2007-12-29 19:46:35 +00:00
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
button = mpeg_button_get(tmo);
|
2008-01-12 05:45:38 +00:00
|
|
|
|
2007-10-09 20:42:20 +00:00
|
|
|
switch (button)
|
|
|
|
{
|
2007-12-29 19:46:35 +00:00
|
|
|
case BUTTON_NONE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Coarse (1 minute) control */
|
2008-01-12 05:45:38 +00:00
|
|
|
case MPEG_START_TIME_DOWN:
|
|
|
|
case MPEG_START_TIME_DOWN | BUTTON_REPEAT:
|
2008-01-27 00:46:31 +00:00
|
|
|
#ifdef MPEG_START_TIME_RC_DOWN
|
2008-01-27 00:18:29 +00:00
|
|
|
case MPEG_START_TIME_RC_DOWN:
|
|
|
|
case MPEG_START_TIME_RC_DOWN | BUTTON_REPEAT:
|
|
|
|
#endif
|
2007-12-29 19:46:35 +00:00
|
|
|
resume_time = increment_time(resume_time, -60*TS_SECOND, duration);
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE0;
|
2007-12-29 19:46:35 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
case MPEG_START_TIME_UP:
|
|
|
|
case MPEG_START_TIME_UP | BUTTON_REPEAT:
|
2008-01-27 00:46:31 +00:00
|
|
|
#ifdef MPEG_START_TIME_RC_UP
|
2008-01-27 00:18:29 +00:00
|
|
|
case MPEG_START_TIME_RC_UP:
|
|
|
|
case MPEG_START_TIME_RC_UP | BUTTON_REPEAT:
|
|
|
|
#endif
|
2007-12-29 19:46:35 +00:00
|
|
|
resume_time = increment_time(resume_time, 60*TS_SECOND, duration);
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE0;
|
2007-12-29 19:46:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* Fine (1 second) control */
|
2008-01-12 05:45:38 +00:00
|
|
|
case MPEG_START_TIME_LEFT:
|
|
|
|
case MPEG_START_TIME_LEFT | BUTTON_REPEAT:
|
2008-01-27 00:46:31 +00:00
|
|
|
#ifdef MPEG_START_TIME_RC_LEFT
|
2008-01-27 00:18:29 +00:00
|
|
|
case MPEG_START_TIME_RC_LEFT:
|
|
|
|
case MPEG_START_TIME_RC_LEFT | BUTTON_REPEAT:
|
|
|
|
#endif
|
2010-01-13 12:55:52 +00:00
|
|
|
#ifdef MPEG_START_TIME_LEFT2
|
|
|
|
case MPEG_START_TIME_LEFT2:
|
|
|
|
case MPEG_START_TIME_LEFT2 | BUTTON_REPEAT:
|
2007-10-09 20:42:20 +00:00
|
|
|
#endif
|
2007-12-29 19:46:35 +00:00
|
|
|
resume_time = increment_time(resume_time, -TS_SECOND, duration);
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE0;
|
2007-12-29 19:46:35 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
case MPEG_START_TIME_RIGHT:
|
|
|
|
case MPEG_START_TIME_RIGHT | BUTTON_REPEAT:
|
2008-01-27 00:46:31 +00:00
|
|
|
#ifdef MPEG_START_TIME_RC_RIGHT
|
2008-01-27 00:18:29 +00:00
|
|
|
case MPEG_START_TIME_RC_RIGHT:
|
|
|
|
case MPEG_START_TIME_RC_RIGHT | BUTTON_REPEAT:
|
|
|
|
#endif
|
2010-01-13 12:55:52 +00:00
|
|
|
#ifdef MPEG_START_TIME_RIGHT2
|
|
|
|
case MPEG_START_TIME_RIGHT2:
|
|
|
|
case MPEG_START_TIME_RIGHT2 | BUTTON_REPEAT:
|
2007-12-29 19:46:35 +00:00
|
|
|
#endif
|
|
|
|
resume_time = increment_time(resume_time, TS_SECOND, duration);
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE0;
|
2007-12-29 19:46:35 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
case MPEG_START_TIME_SELECT:
|
2008-01-27 00:46:31 +00:00
|
|
|
#ifdef MPEG_START_TIME_RC_SELECT
|
2008-01-27 00:18:29 +00:00
|
|
|
case MPEG_START_TIME_RC_SELECT:
|
|
|
|
#endif
|
2007-12-29 19:46:35 +00:00
|
|
|
settings.resume_time = resume_time;
|
2008-01-12 05:45:38 +00:00
|
|
|
button = MPEG_START_SEEK;
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE9;
|
2007-12-29 19:46:35 +00:00
|
|
|
break;
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
case MPEG_START_TIME_EXIT:
|
2008-01-27 00:46:31 +00:00
|
|
|
#ifdef MPEG_START_TIME_RC_EXIT
|
2008-01-27 00:18:29 +00:00
|
|
|
case MPEG_START_TIME_RC_EXIT:
|
|
|
|
#endif
|
2008-01-12 05:45:38 +00:00
|
|
|
button = MPEG_START_EXIT;
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE9;
|
2008-01-12 05:45:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
button = MPEG_START_QUIT;
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE9;
|
2008-01-12 05:45:38 +00:00
|
|
|
break;
|
|
|
|
|
2008-05-28 10:17:16 +00:00
|
|
|
#ifdef HAVE_LCD_ENABLE
|
|
|
|
case LCD_ENABLE_EVENT_0:
|
2010-01-13 12:55:52 +00:00
|
|
|
if (slider_state == STATE2)
|
2008-05-28 10:17:16 +00:00
|
|
|
display_thumb_image(&rc_vid);
|
|
|
|
continue;
|
|
|
|
#endif
|
|
|
|
|
2007-12-29 19:46:35 +00:00
|
|
|
default:
|
|
|
|
rb->default_event_handler(button);
|
|
|
|
rb->yield();
|
|
|
|
continue;
|
2007-10-09 20:42:20 +00:00
|
|
|
}
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
switch (slider_state)
|
2007-10-09 20:42:20 +00:00
|
|
|
{
|
2010-01-13 12:55:52 +00:00
|
|
|
case STATE0:
|
2019-07-20 21:32:49 +00:00
|
|
|
if (!sliding)
|
|
|
|
{
|
|
|
|
if (rb->global_settings->talk_menu)
|
|
|
|
{
|
|
|
|
rb->talk_disable(true);
|
|
|
|
#ifdef PLUGIN_USE_IRAM
|
|
|
|
mpegplayer_iram_restore();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
trigger_cpu_boost();
|
|
|
|
sliding = true;
|
|
|
|
}
|
2007-12-29 19:46:35 +00:00
|
|
|
stream_seek(resume_time, SEEK_SET);
|
|
|
|
show_loading(&rc_bound);
|
|
|
|
draw_slider(duration, resume_time, NULL);
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE1;
|
2007-12-29 19:46:35 +00:00
|
|
|
tmo = THUMB_DELAY;
|
|
|
|
break;
|
2010-01-13 12:55:52 +00:00
|
|
|
case STATE1:
|
2007-12-29 19:46:35 +00:00
|
|
|
display_thumb_image(&rc_vid);
|
2010-01-13 12:55:52 +00:00
|
|
|
slider_state = STATE2;
|
2007-12-29 19:46:35 +00:00
|
|
|
tmo = TIMEOUT_BLOCK;
|
2019-07-20 21:32:49 +00:00
|
|
|
if (sliding)
|
|
|
|
{
|
|
|
|
cancel_cpu_boost();
|
|
|
|
if (rb->global_settings->talk_menu)
|
|
|
|
{
|
|
|
|
#ifdef PLUGIN_USE_IRAM
|
|
|
|
mpegplayer_iram_preserve();
|
|
|
|
#endif
|
|
|
|
rb->talk_disable(false);
|
|
|
|
rb->talk_value(resume_time / TS_SECOND, UNIT_TIME, false);
|
|
|
|
rb->talk_value(resume_time * 100 / duration, UNIT_PERCENT, true);
|
|
|
|
}
|
|
|
|
sliding = false;
|
|
|
|
}
|
2007-12-29 19:46:35 +00:00
|
|
|
default:
|
|
|
|
break;
|
2007-10-09 20:42:20 +00:00
|
|
|
}
|
2008-01-12 05:45:38 +00:00
|
|
|
|
|
|
|
rb->yield();
|
2007-10-09 20:42:20 +00:00
|
|
|
}
|
|
|
|
|
2009-03-17 02:43:47 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
2009-10-20 21:54:59 +00:00
|
|
|
rb->remove_event(LCD_EVENT_ACTIVATION, get_start_time_lcd_enable_hook);
|
2008-05-28 10:17:16 +00:00
|
|
|
#endif
|
2009-03-17 02:43:47 +00:00
|
|
|
#ifndef HAVE_LCD_COLOR
|
2007-12-29 19:46:35 +00:00
|
|
|
stream_gray_show(false);
|
2008-01-09 22:19:25 +00:00
|
|
|
grey_clear_display();
|
|
|
|
grey_update();
|
2007-12-29 19:46:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
cancel_cpu_boost();
|
|
|
|
|
2007-10-16 14:23:50 +00:00
|
|
|
return button;
|
2007-10-09 20:42:20 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
static int show_start_menu(uint32_t duration)
|
2007-10-09 20:42:20 +00:00
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
int selected = 0;
|
2007-10-09 20:42:20 +00:00
|
|
|
int result = 0;
|
2008-01-12 05:45:38 +00:00
|
|
|
bool menu_quit = false;
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Mpegplayer Menu", mpeg_sysevent_callback,
|
2019-07-20 21:32:49 +00:00
|
|
|
ID2P(LANG_RESTART_PLAYBACK),
|
|
|
|
ID2P(LANG_RESUME_PLAYBACK),
|
|
|
|
ID2P(LANG_SET_RESUME_TIME),
|
|
|
|
ID2P(LANG_SETTINGS),
|
|
|
|
ID2P(LANG_MENU_QUIT));
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2019-07-20 21:32:49 +00:00
|
|
|
if (rb->global_settings->talk_menu)
|
|
|
|
{
|
|
|
|
#ifdef PLUGIN_USE_IRAM
|
|
|
|
mpegplayer_iram_preserve();
|
|
|
|
#endif
|
|
|
|
rb->talk_disable(false);
|
|
|
|
}
|
2007-10-16 14:23:50 +00:00
|
|
|
|
2007-10-09 20:42:20 +00:00
|
|
|
rb->button_clear_queue();
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
while (!menu_quit)
|
2007-10-09 20:42:20 +00:00
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2009-06-16 04:25:21 +00:00
|
|
|
result = rb->do_menu(&menu, &selected, NULL, false);
|
2007-10-09 20:42:20 +00:00
|
|
|
|
|
|
|
switch (result)
|
|
|
|
{
|
2008-01-12 05:45:38 +00:00
|
|
|
case MPEG_START_RESTART:
|
|
|
|
settings.resume_time = 0;
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_START_RESUME:
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_START_SEEK:
|
|
|
|
if (!stream_can_seek())
|
2007-12-29 19:46:35 +00:00
|
|
|
{
|
2019-07-20 21:32:49 +00:00
|
|
|
rb->splash(HZ, ID2P(LANG_UNAVAILABLE));
|
2007-10-16 14:23:50 +00:00
|
|
|
break;
|
2008-01-12 05:45:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
result = get_start_time(duration);
|
|
|
|
|
|
|
|
if (result != MPEG_START_EXIT)
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_START_SETTINGS:
|
2009-08-27 14:24:58 +00:00
|
|
|
mpeg_settings();
|
|
|
|
break;
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
default:
|
|
|
|
result = MPEG_START_QUIT;
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
if (mpeg_sysevent() != 0)
|
2008-01-12 05:45:38 +00:00
|
|
|
{
|
|
|
|
result = MPEG_START_QUIT;
|
|
|
|
menu_quit = true;
|
2007-10-09 20:42:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-20 21:32:49 +00:00
|
|
|
if (rb->global_settings->talk_menu)
|
|
|
|
{
|
|
|
|
rb->talk_disable(true);
|
|
|
|
#ifdef PLUGIN_USE_IRAM
|
|
|
|
mpegplayer_iram_restore();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-10-16 14:23:50 +00:00
|
|
|
return result;
|
2007-10-09 20:42:20 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
/* Return the desired resume action */
|
|
|
|
int mpeg_start_menu(uint32_t duration)
|
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2008-01-12 05:45:38 +00:00
|
|
|
|
|
|
|
switch (settings.resume_options)
|
|
|
|
{
|
|
|
|
case MPEG_RESUME_MENU_IF_INCOMPLETE:
|
|
|
|
if (!stream_can_seek() || settings.resume_time == 0)
|
|
|
|
{
|
|
|
|
case MPEG_RESUME_RESTART:
|
|
|
|
settings.resume_time = 0;
|
|
|
|
return MPEG_START_RESTART;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
case MPEG_RESUME_MENU_ALWAYS:
|
|
|
|
return show_start_menu(duration);
|
|
|
|
case MPEG_RESUME_ALWAYS:
|
|
|
|
return MPEG_START_SEEK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-27 14:24:58 +00:00
|
|
|
int mpeg_menu(void)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Mpegplayer Menu", mpeg_sysevent_callback,
|
2019-07-20 21:32:49 +00:00
|
|
|
ID2P(LANG_SETTINGS),
|
|
|
|
ID2P(LANG_RESUME_PLAYBACK),
|
|
|
|
ID2P(LANG_MENU_QUIT));
|
|
|
|
|
|
|
|
if (rb->global_settings->talk_menu)
|
|
|
|
{
|
|
|
|
#ifdef PLUGIN_USE_IRAM
|
|
|
|
mpegplayer_iram_preserve();
|
|
|
|
#endif
|
|
|
|
rb->talk_disable(false);
|
|
|
|
}
|
2009-08-27 14:24:58 +00:00
|
|
|
|
|
|
|
rb->button_clear_queue();
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2009-08-27 14:24:58 +00:00
|
|
|
|
|
|
|
result = rb->do_menu(&menu, NULL, NULL, false);
|
|
|
|
|
|
|
|
switch (result)
|
|
|
|
{
|
|
|
|
case MPEG_MENU_SETTINGS:
|
|
|
|
mpeg_settings();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_MENU_RESUME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_MENU_QUIT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
if (mpeg_sysevent() != 0)
|
2009-08-27 14:24:58 +00:00
|
|
|
result = MPEG_MENU_QUIT;
|
|
|
|
|
2019-07-20 21:32:49 +00:00
|
|
|
if (rb->global_settings->talk_menu)
|
|
|
|
{
|
|
|
|
rb->talk_disable(true);
|
|
|
|
#ifdef PLUGIN_USE_IRAM
|
|
|
|
mpegplayer_iram_restore();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2009-08-27 14:24:58 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
static void display_options(void)
|
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
int selected = 0;
|
2008-01-12 05:45:38 +00:00
|
|
|
int result;
|
|
|
|
bool menu_quit = false;
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Display Options", mpeg_sysevent_callback,
|
2008-01-12 05:45:38 +00:00
|
|
|
#if MPEG_OPTION_DITHERING_ENABLED
|
2019-07-20 21:32:49 +00:00
|
|
|
ID2P(LANG_DITHERING),
|
2008-01-12 05:45:38 +00:00
|
|
|
#endif
|
2019-07-20 21:32:49 +00:00
|
|
|
ID2P(LANG_DISPLAY_FPS),
|
|
|
|
ID2P(LANG_LIMIT_FPS),
|
|
|
|
ID2P(LANG_SKIP_FRAMES),
|
2008-05-18 00:14:34 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
2019-07-20 21:32:49 +00:00
|
|
|
ID2P(LANG_BACKLIGHT_BRIGHTNESS),
|
2008-05-18 00:14:34 +00:00
|
|
|
#endif
|
2009-06-16 04:25:21 +00:00
|
|
|
);
|
2008-01-12 05:45:38 +00:00
|
|
|
|
|
|
|
rb->button_clear_queue();
|
|
|
|
|
|
|
|
while (!menu_quit)
|
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2009-06-16 04:25:21 +00:00
|
|
|
result = rb->do_menu(&menu, &selected, NULL, false);
|
2008-01-12 05:45:38 +00:00
|
|
|
|
|
|
|
switch (result)
|
|
|
|
{
|
|
|
|
#if MPEG_OPTION_DITHERING_ENABLED
|
|
|
|
case MPEG_OPTION_DITHERING:
|
|
|
|
result = (settings.displayoptions & LCD_YUV_DITHER) ? 1 : 0;
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_DITHERING), &result, INT, noyes, 2, NULL);
|
2008-01-12 05:45:38 +00:00
|
|
|
settings.displayoptions =
|
|
|
|
(settings.displayoptions & ~LCD_YUV_DITHER)
|
|
|
|
| ((result != 0) ? LCD_YUV_DITHER : 0);
|
|
|
|
rb->lcd_yuv_set_options(settings.displayoptions);
|
|
|
|
break;
|
|
|
|
#endif /* MPEG_OPTION_DITHERING_ENABLED */
|
|
|
|
|
|
|
|
case MPEG_OPTION_DISPLAY_FPS:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_DISPLAY_FPS), &settings.showfps, INT,
|
2008-01-12 05:45:38 +00:00
|
|
|
noyes, 2, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_OPTION_LIMIT_FPS:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_LIMIT_FPS), &settings.limitfps, INT,
|
2008-01-12 05:45:38 +00:00
|
|
|
noyes, 2, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_OPTION_SKIP_FRAMES:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_SKIP_FRAMES), &settings.skipframes, INT,
|
2008-01-12 05:45:38 +00:00
|
|
|
noyes, 2, NULL);
|
|
|
|
break;
|
|
|
|
|
2008-05-18 00:14:34 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
case MPEG_OPTION_BACKLIGHT_BRIGHTNESS:
|
|
|
|
result = settings.backlight_brightness;
|
|
|
|
mpeg_backlight_update_brightness(result);
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_int(rb->str(LANG_BACKLIGHT_BRIGHTNESS), NULL, UNIT_INT, &result,
|
2008-05-18 00:14:34 +00:00
|
|
|
backlight_brightness_function, 1, -1,
|
|
|
|
MAX_BRIGHTNESS_SETTING - MIN_BRIGHTNESS_SETTING,
|
2019-07-20 21:32:49 +00:00
|
|
|
backlight_brightness_formatter,
|
|
|
|
backlight_brightness_getlang);
|
2008-05-18 00:14:34 +00:00
|
|
|
settings.backlight_brightness = result;
|
|
|
|
mpeg_backlight_update_brightness(-1);
|
|
|
|
break;
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
default:
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
if (mpeg_sysevent() != 0)
|
2008-01-12 05:45:38 +00:00
|
|
|
menu_quit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-01 02:25:15 +00:00
|
|
|
static void audio_options(void)
|
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
int selected = 0;
|
2008-02-01 02:25:15 +00:00
|
|
|
int result;
|
|
|
|
bool menu_quit = false;
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Audio Options", mpeg_sysevent_callback,
|
2019-07-20 21:32:49 +00:00
|
|
|
ID2P(LANG_TONE_CONTROLS),
|
|
|
|
ID2P(LANG_CHANNEL_CONFIGURATION),
|
|
|
|
ID2P(LANG_CROSSFEED),
|
|
|
|
ID2P(LANG_EQUALIZER),
|
|
|
|
ID2P(LANG_DITHERING));
|
2008-02-01 02:25:15 +00:00
|
|
|
|
|
|
|
rb->button_clear_queue();
|
|
|
|
|
|
|
|
while (!menu_quit)
|
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2009-06-16 04:25:21 +00:00
|
|
|
result = rb->do_menu(&menu, &selected, NULL, false);
|
2008-02-01 02:25:15 +00:00
|
|
|
|
|
|
|
switch (result)
|
|
|
|
{
|
|
|
|
case MPEG_AUDIO_TONE_CONTROLS:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_TONE_CONTROLS), &settings.tone_controls, INT,
|
2008-02-01 02:25:15 +00:00
|
|
|
globaloff, 2, NULL);
|
|
|
|
sync_audio_setting(result, false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_CHANNEL_MODES:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_CHANNEL_CONFIGURATION), &settings.channel_modes,
|
2008-02-01 02:25:15 +00:00
|
|
|
INT, globaloff, 2, NULL);
|
|
|
|
sync_audio_setting(result, false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_CROSSFEED:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_CROSSFEED), &settings.crossfeed, INT,
|
2008-02-01 02:25:15 +00:00
|
|
|
globaloff, 2, NULL);
|
|
|
|
sync_audio_setting(result, false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_EQUALIZER:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_EQUALIZER), &settings.equalizer, INT,
|
2008-02-01 02:25:15 +00:00
|
|
|
globaloff, 2, NULL);
|
|
|
|
sync_audio_setting(result, false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MPEG_AUDIO_DITHERING:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_DITHERING), &settings.dithering, INT,
|
2008-02-01 02:25:15 +00:00
|
|
|
globaloff, 2, NULL);
|
|
|
|
sync_audio_setting(result, false);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
if (mpeg_sysevent() != 0)
|
2008-02-01 02:25:15 +00:00
|
|
|
menu_quit = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
static void resume_options(void)
|
|
|
|
{
|
|
|
|
static const struct opt_items items[MPEG_RESUME_NUM_OPTIONS] = {
|
|
|
|
[MPEG_RESUME_MENU_ALWAYS] =
|
2019-07-20 21:32:49 +00:00
|
|
|
{ STR(LANG_FORCE_START_MENU) },
|
2008-01-12 05:45:38 +00:00
|
|
|
[MPEG_RESUME_MENU_IF_INCOMPLETE] =
|
2019-07-20 21:32:49 +00:00
|
|
|
{ STR(LANG_CONDITIONAL_START_MENU) },
|
2008-01-12 05:45:38 +00:00
|
|
|
[MPEG_RESUME_ALWAYS] =
|
2019-07-20 21:32:49 +00:00
|
|
|
{ STR(LANG_AUTO_RESUME) },
|
2008-01-12 05:45:38 +00:00
|
|
|
[MPEG_RESUME_RESTART] =
|
2019-07-20 21:32:49 +00:00
|
|
|
{ STR(LANG_RESTART_PLAYBACK) },
|
2008-01-12 05:45:38 +00:00
|
|
|
};
|
|
|
|
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_MENU_RESUME_OPTIONS), &settings.resume_options,
|
2008-01-12 05:45:38 +00:00
|
|
|
INT, items, MPEG_RESUME_NUM_OPTIONS, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void clear_resume_count(void)
|
2007-10-09 20:42:20 +00:00
|
|
|
{
|
2010-01-13 12:55:52 +00:00
|
|
|
settings.resume_count = 0;
|
2007-12-29 19:46:35 +00:00
|
|
|
configfile_save(SETTINGS_FILENAME, config, ARRAYLEN(config),
|
2007-10-09 20:42:20 +00:00
|
|
|
SETTINGS_VERSION);
|
|
|
|
}
|
|
|
|
|
2009-08-27 14:24:58 +00:00
|
|
|
static void mpeg_settings(void)
|
2006-08-20 23:12:56 +00:00
|
|
|
{
|
2009-06-16 04:25:21 +00:00
|
|
|
int selected = 0;
|
2006-08-20 23:12:56 +00:00
|
|
|
int result;
|
2008-01-12 05:45:38 +00:00
|
|
|
bool menu_quit = false;
|
2009-06-16 04:25:21 +00:00
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
MENUITEM_STRINGLIST(menu, "Settings", mpeg_sysevent_callback,
|
2019-07-20 21:32:49 +00:00
|
|
|
ID2P(LANG_MENU_DISPLAY_OPTIONS),
|
|
|
|
ID2P(LANG_MENU_AUDIO_OPTIONS),
|
|
|
|
ID2P(LANG_MENU_RESUME_OPTIONS),
|
|
|
|
ID2P(LANG_MENU_PLAY_MODE),
|
|
|
|
ID2P(LANG_CLEAR_ALL_RESUMES));
|
2006-08-20 23:12:56 +00:00
|
|
|
|
|
|
|
rb->button_clear_queue();
|
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
while (!menu_quit)
|
2007-10-16 14:23:50 +00:00
|
|
|
{
|
2010-12-22 11:20:07 +00:00
|
|
|
mpeg_sysevent_clear();
|
2008-01-12 05:45:38 +00:00
|
|
|
|
2009-08-27 14:41:20 +00:00
|
|
|
result = rb->do_menu(&menu, &selected, NULL, false);
|
2006-08-20 23:12:56 +00:00
|
|
|
|
2008-01-12 05:45:38 +00:00
|
|
|
switch (result)
|
2006-08-20 23:12:56 +00:00
|
|
|
{
|
2009-08-27 14:24:58 +00:00
|
|
|
case MPEG_SETTING_DISPLAY_SETTINGS:
|
2008-01-12 05:45:38 +00:00
|
|
|
display_options();
|
|
|
|
break;
|
|
|
|
|
2009-08-27 14:24:58 +00:00
|
|
|
case MPEG_SETTING_AUDIO_SETTINGS:
|
2008-02-01 02:25:15 +00:00
|
|
|
audio_options();
|
|
|
|
break;
|
|
|
|
|
2009-08-27 14:24:58 +00:00
|
|
|
case MPEG_SETTING_ENABLE_START_MENU:
|
2008-01-12 05:45:38 +00:00
|
|
|
resume_options();
|
|
|
|
break;
|
|
|
|
|
2010-11-26 12:32:00 +00:00
|
|
|
case MPEG_SETTING_PLAY_MODE:
|
2019-07-20 21:32:49 +00:00
|
|
|
mpeg_set_option(rb->str(LANG_MENU_PLAY_MODE), &settings.play_mode,
|
2010-11-26 12:32:00 +00:00
|
|
|
INT, singleall, 2, NULL);
|
|
|
|
break;
|
|
|
|
|
2009-08-27 14:24:58 +00:00
|
|
|
case MPEG_SETTING_CLEAR_RESUMES:
|
2008-01-12 05:45:38 +00:00
|
|
|
clear_resume_count();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
menu_quit = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-12-22 11:20:07 +00:00
|
|
|
if (mpeg_sysevent() != 0)
|
2008-01-12 05:45:38 +00:00
|
|
|
menu_quit = true;
|
2006-08-20 23:12:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-09 20:42:20 +00:00
|
|
|
void init_settings(const char* filename)
|
2006-08-20 23:12:56 +00:00
|
|
|
{
|
|
|
|
/* Set the default settings */
|
|
|
|
settings.showfps = 0; /* Do not show FPS */
|
2007-03-22 09:18:46 +00:00
|
|
|
settings.limitfps = 1; /* Limit FPS */
|
|
|
|
settings.skipframes = 1; /* Skip frames */
|
2010-11-26 12:32:00 +00:00
|
|
|
settings.play_mode = 0; /* Play single video */
|
2008-01-12 05:45:38 +00:00
|
|
|
settings.resume_options = MPEG_RESUME_MENU_ALWAYS; /* Enable start menu */
|
2010-01-13 12:55:52 +00:00
|
|
|
settings.resume_count = 0;
|
2008-05-18 00:14:34 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
settings.backlight_brightness = -1; /* Use default setting */
|
|
|
|
#endif
|
2007-12-29 19:46:35 +00:00
|
|
|
#if MPEG_OPTION_DITHERING_ENABLED
|
2007-09-25 02:59:42 +00:00
|
|
|
settings.displayoptions = 0; /* No visual effects */
|
|
|
|
#endif
|
2008-02-01 02:25:15 +00:00
|
|
|
settings.tone_controls = false;
|
|
|
|
settings.channel_modes = false;
|
|
|
|
settings.crossfeed = false;
|
|
|
|
settings.equalizer = false;
|
|
|
|
settings.dithering = false;
|
2006-08-20 23:12:56 +00:00
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
if (configfile_load(SETTINGS_FILENAME, config, ARRAYLEN(config),
|
2007-10-16 14:23:50 +00:00
|
|
|
SETTINGS_MIN_VERSION) < 0)
|
2006-08-20 23:12:56 +00:00
|
|
|
{
|
2007-10-09 20:42:20 +00:00
|
|
|
/* Generate a new config file with default values */
|
2010-01-13 12:55:52 +00:00
|
|
|
configfile_save(SETTINGS_FILENAME, config, ARRAYLEN(config),
|
2006-08-20 23:12:56 +00:00
|
|
|
SETTINGS_VERSION);
|
|
|
|
}
|
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
rb->strlcpy(settings.resume_filename, filename, MAX_PATH);
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
/* get the resume time for the current mpeg if it exists */
|
2007-10-09 20:42:20 +00:00
|
|
|
if ((settings.resume_time = configfile_get_value
|
|
|
|
(SETTINGS_FILENAME, filename)) < 0)
|
|
|
|
{
|
|
|
|
settings.resume_time = 0;
|
|
|
|
}
|
2008-02-01 02:25:15 +00:00
|
|
|
|
2010-01-13 12:55:52 +00:00
|
|
|
#if MPEG_OPTION_DITHERING_ENABLED
|
|
|
|
rb->lcd_yuv_set_options(settings.displayoptions);
|
|
|
|
#endif
|
|
|
|
|
2008-02-01 02:25:15 +00:00
|
|
|
/* Set our audio options */
|
|
|
|
sync_audio_settings(false);
|
2006-08-20 23:12:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void save_settings(void)
|
|
|
|
{
|
2010-01-13 12:55:52 +00:00
|
|
|
unsigned i;
|
|
|
|
for (i = 0; i < ARRAYLEN(config); i++)
|
|
|
|
{
|
|
|
|
configfile_update_entry(SETTINGS_FILENAME, config[i].name,
|
|
|
|
*(config[i].int_p));
|
|
|
|
}
|
2006-08-20 23:12:56 +00:00
|
|
|
|
2007-10-09 20:42:20 +00:00
|
|
|
/* If this was a new resume entry then update the total resume count */
|
|
|
|
if (configfile_update_entry(SETTINGS_FILENAME, settings.resume_filename,
|
|
|
|
settings.resume_time) == 0)
|
|
|
|
{
|
|
|
|
configfile_update_entry(SETTINGS_FILENAME, "Resume count",
|
|
|
|
++settings.resume_count);
|
2006-08-20 23:12:56 +00:00
|
|
|
}
|
2007-10-09 20:42:20 +00:00
|
|
|
|
2008-02-01 02:25:15 +00:00
|
|
|
/* Restore audio options */
|
|
|
|
sync_audio_settings(true);
|
2006-08-20 23:12:56 +00:00
|
|
|
}
|