diff options
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_misc.h | 20 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_parser.c | 22 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_settings.c | 203 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 31 |
4 files changed, 115 insertions, 161 deletions
diff --git a/apps/plugins/mpegplayer/mpeg_misc.h b/apps/plugins/mpegplayer/mpeg_misc.h index aeaba56d44..7bac7eb255 100644 --- a/apps/plugins/mpegplayer/mpeg_misc.h +++ b/apps/plugins/mpegplayer/mpeg_misc.h @@ -31,16 +31,16 @@ /* Generic states for when things are too simple to care about naming them */ enum state_enum { - state0 = 0, - state1, - state2, - state3, - state4, - state5, - state6, - state7, - state8, - state9, + STATE0 = 0, + STATE1, + STATE2, + STATE3, + STATE4, + STATE5, + STATE6, + STATE7, + STATE8, + STATE9, }; /* Macros for comparing memory bytes to a series of constant bytes in an diff --git a/apps/plugins/mpegplayer/mpeg_parser.c b/apps/plugins/mpegplayer/mpeg_parser.c index 30793e0350..e14c51337f 100644 --- a/apps/plugins/mpegplayer/mpeg_parser.c +++ b/apps/plugins/mpegplayer/mpeg_parser.c @@ -354,7 +354,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) uint32_t time_right = str_parser.end_pts; uint32_t pts = 0; uint32_t prevpts = 0; - enum state_enum state = state0; + enum state_enum state = STATE0; struct stream_scan sk; /* Initial estimate taken from average bitrate - later interpolations are @@ -372,7 +372,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) sk.dir = SSCAN_REVERSE; - while (state < state9) + while (state < STATE9) { uint32_t currpts; sk.pos = pos_new; @@ -422,7 +422,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) pos_new = pos_right; } - state = state2; /* Last scan was early */ + state = STATE2; /* Last scan was early */ sk.dir = SSCAN_REVERSE; DEBUGF(">> tl:%u t:%u ct:%u tr:%u\n pl:%ld pn:%ld pr:%ld\n", @@ -450,7 +450,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) pos_new += pos_left - pos_adj; - state = state3; /* Last scan was late */ + state = STATE3; /* Last scan was late */ sk.dir = SSCAN_REVERSE; DEBUGF("<< tl:%u t:%u ct:%u tr:%u\n pl:%ld pn:%ld pr:%ld\n", @@ -465,7 +465,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) (unsigned)time_right, pos_left, pos_new, pos_right); pts = currpts; pos = sk.pos; - state = state9; + state = STATE9; } } else @@ -474,17 +474,17 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) switch (state) { - case state1: + case STATE1: /* We already tried the bruteforce scan and failed again - no * more stamps could possibly exist in the interval */ DEBUGF("!! no timestamp 2x\n"); break; - case state0: + case STATE0: /* Hardly likely except at very beginning - just do L->R scan * to find something */ DEBUGF("!! no timestamp on first probe: %ld\n", sk.pos); - case state2: - case state3: + case STATE2: + case STATE3: /* Could just be missing timestamps because the interval is * narrowing down. A large block of data from another stream * may also be in the midst of our chosen points which could @@ -495,7 +495,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) DEBUGF("?? tl:%u t:%u ct:%u tr:%u\n pl:%ld pn:%ld pr:%ld\n", (unsigned)time_left, (unsigned)time, (unsigned)currpts, (unsigned)time_right, pos_left, pos_new, pos_right); - state = state1; + state = STATE1; break; default: DEBUGF("?? Invalid state: %d\n", state); @@ -506,7 +506,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) if (currpts == prevpts) { DEBUGF("!! currpts == prevpts (stop)\n"); - state = state9; + state = STATE9; } prevpts = currpts; diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index 1ad1503d3f..9bf0c37a8d 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c @@ -13,16 +13,16 @@ struct mpeg_settings settings; #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \ (CONFIG_KEYPAD == IRIVER_H300_PAD) #define MPEG_START_TIME_SELECT BUTTON_ON -#define MPEG_START_TIME_RIGHT BUTTON_RIGHT #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_OFF #elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) #define MPEG_START_TIME_SELECT BUTTON_PLAY -#define MPEG_START_TIME_RIGHT BUTTON_RIGHT #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 @@ -31,8 +31,8 @@ struct mpeg_settings settings; (CONFIG_KEYPAD == IPOD_3G_PAD) || \ (CONFIG_KEYPAD == IPOD_1G2G_PAD) #define MPEG_START_TIME_SELECT BUTTON_SELECT -#define MPEG_START_TIME_RIGHT BUTTON_RIGHT #define MPEG_START_TIME_LEFT BUTTON_LEFT +#define MPEG_START_TIME_RIGHT BUTTON_RIGHT #define MPEG_START_TIME_UP BUTTON_SCROLL_FWD #define MPEG_START_TIME_DOWN BUTTON_SCROLL_BACK #define MPEG_START_TIME_EXIT BUTTON_MENU @@ -43,16 +43,16 @@ struct mpeg_settings settings; #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_SCROLL_DOWN BUTTON_VOL_DOWN -#define MPEG_START_TIME_SCROLL_UP BUTTON_VOL_UP +#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP +#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN #define MPEG_START_TIME_EXIT BUTTON_POWER -#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) +#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) #elif CONFIG_KEYPAD == GIGABEAT_S_PAD #define MPEG_START_TIME_SELECT BUTTON_SELECT @@ -60,16 +60,16 @@ struct mpeg_settings settings; #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_SCROLL_DOWN BUTTON_VOL_DOWN -#define MPEG_START_TIME_SCROLL_UP BUTTON_VOL_UP +#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP +#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN #define MPEG_START_TIME_EXIT BUTTON_POWER -#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) +#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) #elif CONFIG_KEYPAD == IRIVER_H10_PAD #define MPEG_START_TIME_SELECT BUTTON_PLAY @@ -81,44 +81,44 @@ struct mpeg_settings settings; #elif (CONFIG_KEYPAD == SANSA_E200_PAD) #define MPEG_START_TIME_SELECT BUTTON_SELECT -#define MPEG_START_TIME_SCROLL_UP BUTTON_SCROLL_BACK -#define MPEG_START_TIME_SCROLL_DOWN BUTTON_SCROLL_FWD #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_SCROLL_BACK +#define MPEG_START_TIME_RIGHT2 BUTTON_SCROLL_FWD #define MPEG_START_TIME_EXIT BUTTON_POWER #elif (CONFIG_KEYPAD == SANSA_FUZE_PAD) #define MPEG_START_TIME_SELECT BUTTON_SELECT -#define MPEG_START_TIME_SCROLL_UP BUTTON_SCROLL_BACK -#define MPEG_START_TIME_SCROLL_DOWN BUTTON_SCROLL_FWD #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_SCROLL_BACK +#define MPEG_START_TIME_RIGHT2 BUTTON_SCROLL_FWD #define MPEG_START_TIME_EXIT (BUTTON_HOME|BUTTON_REPEAT) #elif (CONFIG_KEYPAD == SANSA_C200_PAD) || \ (CONFIG_KEYPAD == SANSA_CLIP_PAD) || \ (CONFIG_KEYPAD == SANSA_M200_PAD) #define MPEG_START_TIME_SELECT BUTTON_SELECT -#define MPEG_START_TIME_SCROLL_UP BUTTON_VOL_UP -#define MPEG_START_TIME_SCROLL_DOWN BUTTON_VOL_DOWN #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 +#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN #define MPEG_START_TIME_EXIT BUTTON_POWER #elif CONFIG_KEYPAD == MROBE500_PAD #define MPEG_START_TIME_SELECT BUTTON_RC_HEART -#define MPEG_START_TIME_SCROLL_UP BUTTON_RC_VOL_UP -#define MPEG_START_TIME_SCROLL_DOWN BUTTON_RC_VOL_DOWN #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 +#define MPEG_START_TIME_LEFT2 BUTTON_RC_VOL_UP +#define MPEG_START_TIME_RIGHT2 BUTTON_RC_VOL_DOWN #define MPEG_START_TIME_EXIT BUTTON_POWER #elif CONFIG_KEYPAD == MROBE100_PAD @@ -127,8 +127,8 @@ struct mpeg_settings settings; #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_SCROLL_DOWN BUTTON_MENU -#define MPEG_START_TIME_SCROLL_UP BUTTON_PLAY +#define MPEG_START_TIME_LEFT2 BUTTON_PLAY +#define MPEG_START_TIME_RIGHT2 BUTTON_MENU #define MPEG_START_TIME_EXIT BUTTON_POWER #elif CONFIG_KEYPAD == IAUDIO_M3_PAD @@ -152,12 +152,12 @@ struct mpeg_settings settings; #elif CONFIG_KEYPAD == CREATIVEZVM_PAD #define MPEG_START_TIME_SELECT BUTTON_SELECT -#define MPEG_START_TIME_SCROLL_UP BUTTON_PLAY -#define MPEG_START_TIME_SCROLL_DOWN BUTTON_MENU #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_PLAY +#define MPEG_START_TIME_RIGHT2 BUTTON_MENU #define MPEG_START_TIME_EXIT BUTTON_BACK #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD @@ -166,8 +166,8 @@ struct mpeg_settings settings; #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_SCROLL_DOWN BUTTON_VOL_DOWN -#define MPEG_START_TIME_SCROLL_UP BUTTON_VOL_UP +#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP +#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN #define MPEG_START_TIME_EXIT BUTTON_POWER #elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD @@ -176,8 +176,8 @@ struct mpeg_settings settings; #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_SCROLL_DOWN BUTTON_VOL_DOWN -#define MPEG_START_TIME_SCROLL_UP BUTTON_VOL_UP +#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP +#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN #define MPEG_START_TIME_EXIT BUTTON_POWER #elif CONFIG_KEYPAD == ONDAVX747_PAD @@ -192,8 +192,8 @@ struct mpeg_settings settings; #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_SCROLL_DOWN BUTTON_FFWD -#define MPEG_START_TIME_SCROLL_UP BUTTON_REW +#define MPEG_START_TIME_LEFT2 BUTTON_REW +#define MPEG_START_TIME_RIGHT2 BUTTON_FFWD #define MPEG_START_TIME_EXIT BUTTON_REC #else @@ -204,12 +204,6 @@ struct mpeg_settings settings; #ifndef MPEG_START_TIME_SELECT #define MPEG_START_TIME_SELECT BUTTON_CENTER #endif -#ifndef MPEG_START_TIME_SCROLL_UP -#define MPEG_START_TIME_SCROLL_UP BUTTON_TOPRIGHT -#endif -#ifndef MPEG_START_TIME_SCROLL_DOWN -#define MPEG_START_TIME_SCROLL_DOWN BUTTON_TOPLEFT -#endif #ifndef MPEG_START_TIME_LEFT #define MPEG_START_TIME_LEFT BUTTON_MIDLEFT #endif @@ -222,6 +216,12 @@ struct mpeg_settings settings; #ifndef MPEG_START_TIME_DOWN #define MPEG_START_TIME_DOWN BUTTON_BOTTOMMIDDLE #endif +#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 #ifndef MPEG_START_TIME_EXIT #define MPEG_START_TIME_EXIT BUTTON_TOPLEFT #endif @@ -236,7 +236,7 @@ static struct configdata config[] = NULL}, {TYPE_INT, 0, MPEG_RESUME_NUM_OPTIONS, { .int_p = &settings.resume_options }, "Resume options", NULL}, -#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) || defined(SANSA_FUZE) || defined(SANSA_E200V2) +#if MPEG_OPTION_DITHERING_ENABLED {TYPE_INT, 0, INT_MAX, { .int_p = &settings.displayoptions }, "Display options", NULL}, #endif @@ -624,7 +624,7 @@ static int get_start_time(uint32_t duration) struct vo_rect rc_vid, rc_bound; uint32_t aspect_vid, aspect_bound; - enum state_enum slider_state = state0; + enum state_enum slider_state = STATE0; lcd_(clear_display)(); lcd_(update)(); @@ -699,7 +699,7 @@ static int get_start_time(uint32_t duration) stream_gray_show(true); #endif - while (slider_state < state9) + while (slider_state < STATE9) { mpeg_menu_sysevent_clear(); button = tmo == TIMEOUT_BLOCK ? @@ -720,7 +720,7 @@ static int get_start_time(uint32_t duration) case MPEG_START_TIME_RC_DOWN | BUTTON_REPEAT: #endif resume_time = increment_time(resume_time, -60*TS_SECOND, duration); - slider_state = state0; + slider_state = STATE0; break; case MPEG_START_TIME_UP: @@ -730,7 +730,7 @@ static int get_start_time(uint32_t duration) case MPEG_START_TIME_RC_UP | BUTTON_REPEAT: #endif resume_time = increment_time(resume_time, 60*TS_SECOND, duration); - slider_state = state0; + slider_state = STATE0; break; /* Fine (1 second) control */ @@ -740,12 +740,12 @@ static int get_start_time(uint32_t duration) case MPEG_START_TIME_RC_LEFT: case MPEG_START_TIME_RC_LEFT | BUTTON_REPEAT: #endif -#ifdef MPEG_START_TIME_SCROLL_UP - case MPEG_START_TIME_SCROLL_UP: - case MPEG_START_TIME_SCROLL_UP | BUTTON_REPEAT: +#ifdef MPEG_START_TIME_LEFT2 + case MPEG_START_TIME_LEFT2: + case MPEG_START_TIME_LEFT2 | BUTTON_REPEAT: #endif resume_time = increment_time(resume_time, -TS_SECOND, duration); - slider_state = state0; + slider_state = STATE0; break; case MPEG_START_TIME_RIGHT: @@ -754,12 +754,12 @@ static int get_start_time(uint32_t duration) case MPEG_START_TIME_RC_RIGHT: case MPEG_START_TIME_RC_RIGHT | BUTTON_REPEAT: #endif -#ifdef MPEG_START_TIME_SCROLL_DOWN - case MPEG_START_TIME_SCROLL_DOWN: - case MPEG_START_TIME_SCROLL_DOWN | BUTTON_REPEAT: +#ifdef MPEG_START_TIME_RIGHT2 + case MPEG_START_TIME_RIGHT2: + case MPEG_START_TIME_RIGHT2 | BUTTON_REPEAT: #endif resume_time = increment_time(resume_time, TS_SECOND, duration); - slider_state = state0; + slider_state = STATE0; break; case MPEG_START_TIME_SELECT: @@ -768,7 +768,7 @@ static int get_start_time(uint32_t duration) #endif settings.resume_time = resume_time; button = MPEG_START_SEEK; - slider_state = state9; + slider_state = STATE9; break; case MPEG_START_TIME_EXIT: @@ -776,17 +776,17 @@ static int get_start_time(uint32_t duration) case MPEG_START_TIME_RC_EXIT: #endif button = MPEG_START_EXIT; - slider_state = state9; + slider_state = STATE9; break; case ACTION_STD_CANCEL: button = MPEG_START_QUIT; - slider_state = state9; + slider_state = STATE9; break; #ifdef HAVE_LCD_ENABLE case LCD_ENABLE_EVENT_0: - if (slider_state == state2) + if (slider_state == STATE2) display_thumb_image(&rc_vid); continue; #endif @@ -799,18 +799,18 @@ static int get_start_time(uint32_t duration) switch (slider_state) { - case state0: + case STATE0: trigger_cpu_boost(); stream_seek(resume_time, SEEK_SET); show_loading(&rc_bound); draw_slider(duration, resume_time, NULL); - slider_state = state1; + slider_state = STATE1; tmo = THUMB_DELAY; break; - case state1: + case STATE1: display_thumb_image(&rc_vid); - slider_state = state2; - case state2: + slider_state = STATE2; + case STATE2: cancel_cpu_boost(); tmo = TIMEOUT_BLOCK; default: @@ -968,7 +968,6 @@ int mpeg_menu(void) return result; } -/** MPEG Menu **/ static void display_options(void) { int selected = 0; @@ -1121,13 +1120,9 @@ static void resume_options(void) static void clear_resume_count(void) { + settings.resume_count = 0; configfile_save(SETTINGS_FILENAME, config, ARRAYLEN(config), SETTINGS_VERSION); - - settings.resume_count = 0; - - /* add this place holder so the count is above resume entries */ - configfile_update_entry(SETTINGS_FILENAME, "Resume count", 0); } static void mpeg_settings(void) @@ -1188,7 +1183,7 @@ void init_settings(const char* filename) settings.limitfps = 1; /* Limit FPS */ settings.skipframes = 1; /* Skip frames */ settings.resume_options = MPEG_RESUME_MENU_ALWAYS; /* Enable start menu */ - settings.resume_count = -1; + settings.resume_count = 0; #ifdef HAVE_BACKLIGHT_BRIGHTNESS settings.backlight_brightness = -1; /* Use default setting */ #endif @@ -1201,55 +1196,39 @@ void init_settings(const char* filename) settings.equalizer = false; settings.dithering = false; - if (configfile_load(SETTINGS_FILENAME, config, - sizeof(config)/sizeof(*config), + if (configfile_load(SETTINGS_FILENAME, config, ARRAYLEN(config), SETTINGS_MIN_VERSION) < 0) { /* Generate a new config file with default values */ - configfile_save(SETTINGS_FILENAME, config, - sizeof(config)/sizeof(*config), + configfile_save(SETTINGS_FILENAME, config, ARRAYLEN(config), SETTINGS_VERSION); } -#if MPEG_OPTION_DITHERING_ENABLED - if ((settings.displayoptions = - configfile_get_value(SETTINGS_FILENAME, "Display options")) < 0) - { - configfile_update_entry(SETTINGS_FILENAME, "Display options", - (settings.displayoptions=0)); - } - rb->lcd_yuv_set_options(settings.displayoptions); -#endif - - if (settings.resume_count < 0) - { - settings.resume_count = 0; - configfile_update_entry(SETTINGS_FILENAME, "Resume count", 0); - } - - rb->snprintf(settings.resume_filename, MAX_PATH, "%s", filename); + rb->strlcpy(settings.resume_filename, filename, MAX_PATH); - /* get the resume time for the current mpeg if it exist */ + /* get the resume time for the current mpeg if it exists */ if ((settings.resume_time = configfile_get_value (SETTINGS_FILENAME, filename)) < 0) { settings.resume_time = 0; } +#if MPEG_OPTION_DITHERING_ENABLED + rb->lcd_yuv_set_options(settings.displayoptions); +#endif + /* Set our audio options */ sync_audio_settings(false); } void save_settings(void) { - configfile_update_entry(SETTINGS_FILENAME, "Show FPS", - settings.showfps); - configfile_update_entry(SETTINGS_FILENAME, "Limit FPS", - settings.limitfps); - configfile_update_entry(SETTINGS_FILENAME, "Skip frames", - settings.skipframes); - configfile_update_entry(SETTINGS_FILENAME, "Resume options", - settings.resume_options); + unsigned i; + for (i = 0; i < ARRAYLEN(config); i++) + { + configfile_update_entry(SETTINGS_FILENAME, config[i].name, + *(config[i].int_p)); + } /* If this was a new resume entry then update the total resume count */ if (configfile_update_entry(SETTINGS_FILENAME, settings.resume_filename, @@ -1259,26 +1238,6 @@ void save_settings(void) ++settings.resume_count); } -#ifdef HAVE_BACKLIGHT_BRIGHTNESS - configfile_update_entry(SETTINGS_FILENAME, "Backlight brightness", - settings.backlight_brightness); -#endif - -#if MPEG_OPTION_DITHERING_ENABLED - configfile_update_entry(SETTINGS_FILENAME, "Display options", - settings.displayoptions); -#endif - configfile_update_entry(SETTINGS_FILENAME, "Tone controls", - settings.tone_controls); - configfile_update_entry(SETTINGS_FILENAME, "Channel modes", - settings.channel_modes); - configfile_update_entry(SETTINGS_FILENAME, "Crossfeed", - settings.crossfeed); - configfile_update_entry(SETTINGS_FILENAME, "Equalizer", - settings.equalizer); - configfile_update_entry(SETTINGS_FILENAME, "Dithering", - settings.dithering); - /* Restore audio options */ sync_audio_settings(true); } diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 7a2578506d..155c601762 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -151,6 +151,7 @@ PLUGIN_IRAM_DECLARE #define MPEG_VOLUP2 BUTTON_VOL_UP #define MPEG_RW BUTTON_UP #define MPEG_FF BUTTON_DOWN + #define MPEG_RC_MENU BUTTON_RC_DSP #define MPEG_RC_STOP (BUTTON_RC_PLAY | BUTTON_REPEAT) #define MPEG_RC_PAUSE (BUTTON_RC_PLAY | BUTTON_REL) @@ -170,6 +171,7 @@ PLUGIN_IRAM_DECLARE #define MPEG_VOLUP2 BUTTON_VOL_UP #define MPEG_RW BUTTON_UP #define MPEG_FF BUTTON_DOWN + #define MPEG_RC_MENU BUTTON_RC_DSP #define MPEG_RC_STOP (BUTTON_RC_PLAY | BUTTON_REPEAT) #define MPEG_RC_PAUSE (BUTTON_RC_PLAY | BUTTON_REL) @@ -337,7 +339,7 @@ CONFIG_KEYPAD == SANSA_M200_PAD /* One thing we can do here for targets with remotes is having a display * always on the remote instead of always forcing a popup on the main display */ -#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ +#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ /* 3% of 30min file == 54s step size */ #define MIN_FF_REWIND_STEP (TS_SECOND/2) #define WVS_MIN_UPDATE_INTERVAL (HZ/2) @@ -467,18 +469,7 @@ static void draw_clear_area(int x, int y, int width, int height) static void draw_clear_area_rect(const struct vo_rect *rc) { - int x = rc->l; - int y = rc->t; - int width = rc->r - rc->l; - int height = rc->b - rc->t; -#ifdef HAVE_LCD_COLOR - rb->screen_clear_area(rb->screens[SCREEN_MAIN], _X, _Y, _W, _H); -#else - int oldmode = grey_get_drawmode(); - grey_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); - grey_fillrect(_X, _Y, _W, _H); - grey_set_drawmode(oldmode); -#endif + draw_clear_area(rc->l, rc->t, rc->r - rc->l, rc->b - rc->t); } static void draw_fillrect(int x, int y, int width, int height) @@ -572,7 +563,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src, src_end = src + width; dst = rb->lcd_framebuffer + (LCD_WIDTH - y) + x*LCD_WIDTH; - do + do { const unsigned char *src_col = src++; unsigned data = *src_col >> src_y; @@ -582,7 +573,7 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src, dst_end = dst_col - height; dst += LCD_WIDTH; - do + do { dst_col--; @@ -882,7 +873,7 @@ static void wvs_refresh_time(void) hms_format(buf, sizeof (buf), &hms); draw_clear_area_rect(&wvs.time_rect); - draw_putsxy_oriented(wvs.time_rect.l, wvs.time_rect.t, buf); + draw_putsxy_oriented(wvs.time_rect.l, wvs.time_rect.t, buf); vo_rect_union(&wvs.update_rect, &wvs.update_rect, &wvs.prog_rect); @@ -1588,6 +1579,10 @@ static void button_loop(void) /* The menu can change the font, so restore */ rb->lcd_setfont(FONT_SYSFIXED); +#ifdef HAVE_LCD_COLOR + rb->lcd_set_foreground(LCD_WHITE); + rb->lcd_set_background(LCD_BLACK); +#endif switch (result) { @@ -1739,7 +1734,7 @@ enum plugin_status plugin_start(const void* parameter) rb->lcd_clear_display(); rb->lcd_update(); - save_settings(); /* Save settings (if they have changed) */ + save_settings(); status = PLUGIN_OK; mpeg_menu_sysevent_handle(); @@ -1757,7 +1752,7 @@ enum plugin_status plugin_start(const void* parameter) rb->splashf(HZ*2, errstring, err); } } - + #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_YUV) rb->lcd_set_mode(LCD_MODE_RGB565); #endif |