]> git.sesse.net Git - ffmpeg/commitdiff
ffplay: disallow seeking before the start of the file
authorMarton Balint <cus@passwd.hu>
Thu, 22 Nov 2012 23:22:35 +0000 (00:22 +0100)
committerMarton Balint <cus@passwd.hu>
Wed, 28 Nov 2012 20:39:50 +0000 (21:39 +0100)
In timestamp based seeking we update the external clock to the seek target,
therefore we should use sane timestamps even if libavformat could handle
seeking before the start of the file.

Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay.c

index 5ba5164173ec6739707eb5471871983ca6fac4bf..c5ad70fd4322a5daef4f92c03b68404333c91344 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -2984,6 +2984,8 @@ static void event_loop(VideoState *cur_stream)
                     } else {
                         pos = get_master_clock(cur_stream);
                         pos += incr;
+                        if (cur_stream->ic->start_time != AV_NOPTS_VALUE && pos < cur_stream->ic->start_time / (double)AV_TIME_BASE)
+                            pos = cur_stream->ic->start_time / (double)AV_TIME_BASE;
                         stream_seek(cur_stream, (int64_t)(pos * AV_TIME_BASE), (int64_t)(incr * AV_TIME_BASE), 0);
                     }
                 break;