Index: input/input.c =================================================================== --- input/input.c (revision 24596) +++ input/input.c (working copy) @@ -39,6 +39,8 @@ #include "ar.h" +#include + /// This array defines all known commands. /// The first field is an id used to recognize the command without too many strcmp. /// The second is obviously the command name. @@ -1059,7 +1061,17 @@ key_down[num_key_down] = code; num_key_down++; last_key_down = GetTimer(); - ar_state = 0; + ar_state = 0; + // seek on mouse click + if (mouseseek && code == MOUSE_BTN0 && (vo_dheight-mouse_pos_y) < 50) { // if mouse is on bottom and click on mouse button + char str_cmd[20]; + if (vo_fs) seek_mouse_pos = (float)((float)(mouse_pos_x)/(float)vo_screenwidth); // calculate seek position + else seek_mouse_pos = (float)((float)(mouse_pos_x)/(float)vo_dwidth); + sprintf(str_cmd, "seek %.4f 1", seek_mouse_pos*100.0f); // generate command + ret = mp_input_parse_cmd(str_cmd); + if(ret) + return ret; + } return NULL; } // key released Index: libvo/x11_common.c =================================================================== --- libvo/x11_common.c (revision 24596) +++ libvo/x11_common.c (working copy) @@ -74,6 +74,13 @@ static int timeout_save = 0; static int kdescreensaver_was_running = 0; +// seek on mouse click +int mouseseek = 1; +int mouse_pos_x = 0; +int mouse_pos_y = 0; +int visible_cursor = 1; +float seek_mouse_pos = 0.0f; + char *mDisplayName = NULL; Display *mDisplay = NULL; Window mRootWin; @@ -184,6 +191,7 @@ if (bm_no != None) XFreePixmap(disp, bm_no); XFreeColors(disp,colormap,&black.pixel,1,0); + visible_cursor = 0; // set mouse visibility status } void vo_showcursor(Display * disp, Window win) @@ -191,6 +199,7 @@ if (WinID == 0) return; XDefineCursor(disp, win, 0); + visible_cursor = 1; // set mouse visibility status } static int x11_errorhandler(Display * display, XErrorEvent * event) @@ -1090,7 +1099,9 @@ ret |= VO_EVENT_KEYPRESS; } break; - case MotionNotify: + case MotionNotify: + mouse_pos_x = Event.xmotion.x; + mouse_pos_y = Event.xmotion.y; if(enable_mouse_movements) { char cmd_str[40]; Index: libvo/video_out.h =================================================================== --- libvo/video_out.h (revision 24596) +++ libvo/video_out.h (working copy) @@ -194,6 +194,13 @@ extern int xinerama_x; extern int xinerama_y; +// seek on mouse click +extern int mouseseek; +extern int mouse_pos_x; +extern int mouse_pos_y; +extern int visible_cursor; +extern float seek_mouse_pos; + // correct resolution/bpp on screen: (should be autodetected by vo_init()) extern int vo_depthonscreen; extern int vo_screenwidth; Index: libvo/vo_xv.c =================================================================== --- libvo/vo_xv.c (revision 24596) +++ libvo/vo_xv.c (working copy) @@ -464,7 +464,11 @@ } static inline void put_xvimage( XvImage * xvi ) -{ +{ + // seek on mouse click + static int bol = 0; + int ww, hh; + #ifdef HAVE_SHM if (Shmem_Flag) { @@ -483,6 +487,23 @@ vo_dwidth + vo_panscan_x, vo_dheight + vo_panscan_y); } + // seek on mouse click + if (mouseseek) { + hh = (vo_fs)?vo_screenheight:vo_dheight; + ww = (vo_fs)?vo_screenwidth:vo_dwidth; + if (hh-mouse_pos_y < 20 && visible_cursor) { // show progress bar on bottom, if mouse is on bottom and is visible + bol = 1; + XSetForeground( mDisplay, vo_gc, 0x333333); + XFillRectangle( mDisplay, vo_window, vo_gc, 2, hh-12, ww-4, 5); + + XSetForeground( mDisplay, vo_gc, 0xFF0000); + XFillRectangle( mDisplay, vo_window, vo_gc, 2, hh-12, (ww-4)*seek_mouse_pos, 5); + } else if (bol){ // if mouse leave progress bar, clear bar + bol = 0; + XSetForeground( mDisplay, vo_gc, 0x0); + XFillRectangle( mDisplay, vo_window, vo_gc, 2, hh-12, ww-4, 5); + } + } } static void check_events(void) Index: mplayer.c =================================================================== --- mplayer.c (revision 24596) +++ mplayer.c (working copy) @@ -3404,7 +3404,12 @@ time_frame += frame_time / playback_speed; // for nosound } } - + + // seek on mouse click + if (mouseseek && mpctx->demuxer->video->sh) { + sh_video_t *sh_video = mpctx->demuxer->video->sh; + seek_mouse_pos = (float)sh_video->pts/demuxer_get_time_length(mpctx->demuxer); // set video position + } // ========================================================================== // current_module="draw_osd"; Index: cfg-mplayer.h =================================================================== --- cfg-mplayer.h (revision 24596) +++ cfg-mplayer.h (working copy) @@ -25,6 +25,7 @@ extern float vo_panscanrange; /* only used at startup (setting these values from configfile) */ extern char *vo_geometry; +extern int mouseseek; extern int opt_screen_size_x; extern int opt_screen_size_y; @@ -177,6 +178,10 @@ {"dfbopts", "-dfbopts has been removed. Use -vf directfb:dfbopts=... instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, #endif #endif + + // seek on mouse click + {"mouseseek", &mouseseek, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"nomouseseek", &mouseseek, CONF_TYPE_FLAG, 0, 1, 0, NULL}, // force window width/height or resolution (with -vm) {"x", &opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL},