From d4f382252d01102d997281a1f2cb58ffd6b33f97 Mon Sep 17 00:00:00 2001 From: Robert Kukla Date: Sun, 21 Oct 2007 16:44:13 +0000 Subject: FS#7997 - mpegplayer - enable/disable start menu git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15250 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/mpegplayer/mpeg_settings.c | 43 +++++++++++++++++++++++++++++ apps/plugins/mpegplayer/mpeg_settings.h | 2 ++ apps/plugins/mpegplayer/mpegplayer.c | 1 - apps/plugins/mpegplayer/video_out_rockbox.c | 18 ++++++------ 4 files changed, 54 insertions(+), 10 deletions(-) (limited to 'apps/plugins/mpegplayer') diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index 9e6fa57fb5..0a717aeaac 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c @@ -101,6 +101,8 @@ static struct configdata config[] = {TYPE_INT, 0, 2, &settings.skipframes, "Skip frames", NULL, NULL}, {TYPE_INT, 0, INT_MAX, &settings.resume_count, "Resume count", NULL, NULL}, + {TYPE_INT, 0, 2, &settings.enable_start_menu, "Enable start menu", + NULL, NULL}, #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) {TYPE_INT, 0, INT_MAX, &settings.displayoptions, "Display options", NULL, NULL}, @@ -112,6 +114,11 @@ static const struct opt_items noyes[2] = { { "Yes", -1 }, }; +static const struct opt_items enabledisable[2] = { + { "Disable", -1 }, + { "Enable", -1 }, +}; + static void display_options(void) { int result; @@ -329,6 +336,32 @@ enum mpeg_start_id mpeg_start_menu(int play_time, int in_file) char resume_str[32]; int time_hol = (int)(settings.resume_time/2); int time_rem = ((settings.resume_time%2)==0) ? 0 : 5; + + if (settings.enable_start_menu == 0) + { + rb->snprintf(resume_str, sizeof(resume_str), + "Yes (min): %d.%d", time_hol, time_rem); + + struct opt_items resume_no_yes[2] = + { + { "No", -1 }, + { resume_str, -1 }, + }; + if (settings.resume_time == 0) + return MPEG_START_RESTART; + + rb->set_option("Resume", &result, INT, + resume_no_yes, 2, NULL); + + if (result == 0) + { + settings.resume_time = 0; + return MPEG_START_RESTART; + } + else + return MPEG_START_RESUME; + } + rb->snprintf(resume_str, sizeof(resume_str), "Resume time (min): %d.%d", time_hol, time_rem); @@ -414,6 +447,8 @@ enum mpeg_menu_id mpeg_menu(void) struct menu_item items[] = { [MPEG_MENU_DISPLAY_SETTINGS] = { "Display Options", NULL }, + [MPEG_MENU_ENABLE_START_MENU] = + { "Start menu", NULL }, [MPEG_MENU_CLEAR_RESUMES] = { clear_str, NULL }, [MPEG_MENU_QUIT] = @@ -434,6 +469,11 @@ enum mpeg_menu_id mpeg_menu(void) case MPEG_MENU_DISPLAY_SETTINGS: display_options(); break; + case MPEG_MENU_ENABLE_START_MENU: + rb->set_option("Start menu", + &settings.enable_start_menu, + INT, enabledisable, 2, NULL); + break; case MPEG_MENU_CLEAR_RESUMES: clear_resume_count(); rb->snprintf(clear_str, sizeof(clear_str), @@ -462,6 +502,7 @@ void init_settings(const char* filename) settings.showfps = 0; /* Do not show FPS */ settings.limitfps = 1; /* Limit FPS */ settings.skipframes = 1; /* Skip frames */ + settings.enable_start_menu = 1; /* Enable start menu */ settings.resume_count = -1; #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) settings.displayoptions = 0; /* No visual effects */ @@ -513,6 +554,8 @@ void save_settings(void) settings.limitfps); configfile_update_entry(SETTINGS_FILENAME, "Skip frames", settings.skipframes); + configfile_update_entry(SETTINGS_FILENAME, "Enable start menu", + settings.enable_start_menu); /* If this was a new resume entry then update the total resume count */ if (configfile_update_entry(SETTINGS_FILENAME, settings.resume_filename, diff --git a/apps/plugins/mpegplayer/mpeg_settings.h b/apps/plugins/mpegplayer/mpeg_settings.h index 37ceda7225..613a345307 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.h +++ b/apps/plugins/mpegplayer/mpeg_settings.h @@ -22,6 +22,7 @@ enum mpeg_start_id enum mpeg_menu_id { MPEG_MENU_DISPLAY_SETTINGS, + MPEG_MENU_ENABLE_START_MENU, MPEG_MENU_CLEAR_RESUMES, MPEG_MENU_QUIT, }; @@ -30,6 +31,7 @@ struct mpeg_settings { int showfps; /* flag to display fps */ int limitfps; /* flag to limit fps */ int skipframes; /* flag to skip frames */ + int enable_start_menu; /* flag to enable/disable start menu */ int resume_count; /* total # of resumes in config file */ int resume_time; /* resume time for current mpeg (in half minutes) */ char resume_filename[128]; /* filename of current mpeg */ diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 37ac1fa78c..e77031b76e 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -2402,7 +2402,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) /* seek start time */ seek_pos = seek_PTS( in_file, start_time, 0 ); - rb->lseek(in_file,seek_pos,SEEK_SET); video_thumb_print = 0; audio_sync_start = 0; audio_sync_time = 0; diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c index 490f04411f..9dd8d6a467 100644 --- a/apps/plugins/mpegplayer/video_out_rockbox.c +++ b/apps/plugins/mpegplayer/video_out_rockbox.c @@ -78,9 +78,9 @@ void vo_draw_frame_thumb (uint8_t * const * buf) for (c=0;cwidth; image_height=sequence->height; - tmpbufa = (uint8_t*)mpeg2_malloc(sizeof(uint8_t)*image_width/2* - image_height/2, -2); - tmpbufb = (uint8_t*)mpeg2_malloc(sizeof(uint8_t)*image_width/4* - image_height/4, -2); - tmpbufc = (uint8_t*)mpeg2_malloc(sizeof(uint8_t)*image_width/4* + tmpbufa = (uint8_t*)mpeg2_malloc(sizeof(uint8_t)*image_width* image_height/4, -2); + tmpbufb = (uint8_t*)mpeg2_malloc(sizeof(uint8_t)*image_width* + image_height/16, -2); + tmpbufc = (uint8_t*)mpeg2_malloc(sizeof(uint8_t)*image_width* + image_height/16, -2); tmpbuf[0] = tmpbufa; tmpbuf[1] = tmpbufb; tmpbuf[2] = tmpbufc; -- cgit v1.2.3