Commit 33d1d97a19 for ffmpeg
commit 33d1d97a195daa227f9b8390637fb390dcc20f3d
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Thu Oct 15 17:19:59 2026 +0200
libavformat/tests/seek: add an option to set the start of a forward seek
The first seek done with -seekforw asks for a range that starts at the
target, so it can never land before it. Add -seekmin to start the range
earlier, as ffplay does for its forward seeks, so that tests can show
how such a seek lands.
diff --git a/libavformat/tests/seek.c b/libavformat/tests/seek.c
index 61219e8086..32f685310f 100644
--- a/libavformat/tests/seek.c
+++ b/libavformat/tests/seek.c
@@ -63,6 +63,7 @@ int main(int argc, char **argv)
int64_t timestamp;
AVDictionary *format_opts = NULL;
int64_t seekfirst = AV_NOPTS_VALUE;
+ int64_t seekfirst_min = AV_NOPTS_VALUE;
int firstback=0;
int frame_count = 1;
int duration = 4;
@@ -74,6 +75,8 @@ int main(int argc, char **argv)
} else if(!strcmp(argv[i], "-seekback")){
seekfirst = atoi(argv[i+1]);
firstback = 1;
+ } else if(!strcmp(argv[i], "-seekmin")){
+ seekfirst_min = atoi(argv[i+1]);
} else if(!strcmp(argv[i], "-stream_id")){
seekfirst_stream = atoi(argv[i+1]);
} else if(!strcmp(argv[i], "-frames")){
@@ -117,7 +120,9 @@ int main(int argc, char **argv)
if(seekfirst != AV_NOPTS_VALUE){
if(firstback) avformat_seek_file(ic, seekfirst_stream, INT64_MIN, seekfirst, seekfirst, 0);
- else avformat_seek_file(ic, seekfirst_stream, seekfirst, seekfirst, INT64_MAX, 0);
+ else avformat_seek_file(ic, seekfirst_stream,
+ seekfirst_min != AV_NOPTS_VALUE ? seekfirst_min : seekfirst,
+ seekfirst, INT64_MAX, 0);
}
for(i=0; ; i++){
AVPacket pkt = { 0 };