mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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
This commit is contained in:
parent
e26a83355a
commit
a11d11aaa8
21
ffplay.c
21
ffplay.c
@ -1609,7 +1609,7 @@ void toggle_audio_display(void)
|
|||||||
void event_loop(void)
|
void event_loop(void)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
double incr, pos;
|
double incr, pos, frac;
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
SDL_WaitEvent(&event);
|
SDL_WaitEvent(&event);
|
||||||
@ -1660,6 +1660,24 @@ void event_loop(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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:
|
case SDL_VIDEORESIZE:
|
||||||
if (cur_stream) {
|
if (cur_stream) {
|
||||||
screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
|
screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0,
|
||||||
@ -1790,6 +1808,7 @@ void show_help(void)
|
|||||||
"w show audio waves\n"
|
"w show audio waves\n"
|
||||||
"left/right seek backward/forward 10 seconds\n"
|
"left/right seek backward/forward 10 seconds\n"
|
||||||
"down/up seek backward/forward 1 minute\n"
|
"down/up seek backward/forward 1 minute\n"
|
||||||
|
"mouse click seek to percentage in file corresponding to fraction of width\n"
|
||||||
);
|
);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user