Index: apps/onplay.c =================================================================== --- apps/onplay.c (revision 27804) +++ apps/onplay.c (working copy) @@ -970,6 +970,61 @@ gui_syncpitchscreen_run, NULL, NULL, Icon_Audio); #endif +static bool jump_to_time(void) +{ + char typed_pos[7]="000000"; + struct mp3entry* id3 = audio_current_track(); + unsigned long pos; + unsigned int i; + pos=(id3->elapsed /1000); + i=pos/3600; /* hours*/ + if(i>99) return false; + typed_pos[0]=(i/10) +48; + typed_pos[1]=(i %10) +48; + pos-=(i *3600); + i=pos/60; + if(i>59) return false; + typed_pos[2]=(i/10) +48; + typed_pos[3]=(i %10) +48; + i=pos %60; + if(i>59) return false; + typed_pos[4]=(i/10) +48; + typed_pos[5]=(i %10) +48; + if(kbd_input(typed_pos,7)) + return false; + + i=strlen(typed_pos) -1; + for(pos=0; pos<=i; pos++) + if((typed_pos[pos]-=48)>9) + return false; /*string must contain only digits*/ + pos=typed_pos[i]; + if(i>=1) pos+=(typed_pos[i-1] *10); + if(i>=2) pos+=(typed_pos[i-2] *60); + if(i>=3) pos+=(typed_pos[i-3] *600); + if(i>=4) pos+=(typed_pos[i-4] *3600); + if(i==5) pos+=(typed_pos[i-5] *36000); + pos*=1000; /*conversion to miliseconds*/ + if (!(audio_status() & AUDIO_STATUS_PLAY)) + { + return false; + } + else + { +#if (CONFIG_CODEC == SWCODEC) + audio_pre_ff_rewind(); + audio_ff_rewind(pos); +#else + audio_pause(); + audio_ff_rewind(pos); + audio_resume(); +#endif + return true; + } +} + +MENUITEM_FUNCTION(jump_to_time_item, 0, ID2P(LANG_JUMP_TO_TIME), + jump_to_time, NULL, NULL, Icon_NOICON); + /* CONTEXT_[TREE|ID3DB] items */ static int clipboard_callback(int action,const struct menu_item_ex *this_item); MENUITEM_FUNCTION(rename_file_item, 0, ID2P(LANG_RENAME), @@ -1140,7 +1195,7 @@ &pictureflow_item, #endif &browse_id3_item, &list_viewers_item, - &delete_file_item, &view_cue_item, + &delete_file_item, &view_cue_item, &jump_to_time_item, #ifdef HAVE_PITCHSCREEN &pitch_screen_item, #endif Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang (revision 27804) +++ apps/lang/english.lang (working copy) @@ -12619,3 +12619,17 @@ *: "Update on Stop" + + id: LANG_JUMP_TO_TIME + desc: Shown in WPS context menu, jumps to a specified time in a playing track + user: core + + *: "Jump to time" + + + *: "Jump to time" + + + *: "jump to time" + +