diff options
author | Michel Bardiaux <mbardiaux@peaktime.be> | 2003-11-28 22:19:01 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-11-28 22:19:01 +0300 |
commit | a11d11aaa877e9df763cdf4d38e8fb0e58d24d9d (patch) | |
tree | 06722dd250b2ca94daa3d67e1c455478781cc9dd /ffplay.c | |
parent | e26a83355a2a56f25d7a871d617b1367bd6fb295 (diff) |
seek by mouse in ffplay patch by (Michel Bardiaux <mbardiaux at peaktime dot be>)
Originally committed as revision 2535 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r-- | ffplay.c | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -1609,7 +1609,7 @@ void toggle_audio_display(void) void event_loop(void) { SDL_Event event; - double incr, pos; + double incr, pos, frac; for(;;) { SDL_WaitEvent(&event); @@ -1660,6 +1660,24 @@ void event_loop(void) break; } break; + case SDL_MOUSEBUTTONDOWN: + if (cur_stream) { + int ns, hh, mm, ss; + int tns, thh, tmm, tss; + tns = cur_stream->ic->duration/1000000LL; + thh = tns/3600; + tmm = (tns%3600)/60; + tss = (tns%60); + frac = (double)event.button.x/(double)cur_stream->width; + ns = frac*tns; + hh = ns/3600; + mm = (ns%3600)/60; + ss = (ns%60); + fprintf(stderr, "Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d) \n", frac*100, + hh, mm, ss, thh, tmm, tss); + stream_seek(cur_stream, (int64_t)(cur_stream->ic->start_time+frac*cur_stream->ic->duration)); + } + break; case SDL_VIDEORESIZE: if (cur_stream) { screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, @@ -1790,6 +1808,7 @@ void show_help(void) "w show audio waves\n" "left/right seek backward/forward 10 seconds\n" "down/up seek backward/forward 1 minute\n" + "mouse click seek to percentage in file corresponding to fraction of width\n" ); exit(1); } |