forked from len0rd/rockbox
FS#7997 - mpegplayer - enable/disable start menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15250 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
8941d2bfa2
commit
d4f382252d
4 changed files with 54 additions and 10 deletions
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -78,9 +78,9 @@ void vo_draw_frame_thumb (uint8_t * const * buf)
|
|||
for (c=0;c<image_height/4;c++)
|
||||
{
|
||||
*(tmpbuf[1]+c*image_width/4+r) =
|
||||
*(buf[1]+2*c*image_width/2+2*r);
|
||||
*(buf[1]+c*image_width+2*r);
|
||||
*(tmpbuf[2]+c*image_width/4+r) =
|
||||
*(buf[2]+2*c*image_width/2+2*r);
|
||||
*(buf[2]+c*image_width+2*r);
|
||||
}
|
||||
#else
|
||||
for (r=0;r<image_width/2;r++)
|
||||
|
@ -92,9 +92,9 @@ void vo_draw_frame_thumb (uint8_t * const * buf)
|
|||
for (c=0;c<image_height/4;c++)
|
||||
{
|
||||
*(tmpbuf[1]+(image_width/4-1-r)*image_height/4+c) =
|
||||
*(buf[1]+2*c*image_width/2+2*r);
|
||||
*(buf[1]+c*image_width+2*r);
|
||||
*(tmpbuf[2]+(image_width/4-1-r)*image_height/4+c) =
|
||||
*(buf[2]+2*c*image_width/2+2*r);
|
||||
*(buf[2]+c*image_width+2*r);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -148,12 +148,12 @@ void vo_setup(const mpeg2_sequence_t * sequence)
|
|||
image_width=sequence->width;
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue