mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
seek: Fix av_gen_search() so that seeks outside max/min do not successfully seek to random
points but rather seek to the min/max. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
7846280d1d
commit
27f7589ab1
@ -1621,6 +1621,11 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(ts_min >= target_ts){
|
||||
*ts_ret= ts_min;
|
||||
return pos_min;
|
||||
}
|
||||
|
||||
if(ts_max == AV_NOPTS_VALUE){
|
||||
int step= 1024;
|
||||
filesize = avio_size(s->pb);
|
||||
@ -1646,6 +1651,11 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
|
||||
pos_limit= pos_max;
|
||||
}
|
||||
|
||||
if(ts_max <= target_ts){
|
||||
*ts_ret= ts_max;
|
||||
return pos_max;
|
||||
}
|
||||
|
||||
if(ts_min > ts_max){
|
||||
return -1;
|
||||
}else if(ts_min == ts_max){
|
||||
|
@ -5,40 +5,37 @@ ret:-1 st:-1 flags:1 ts: 1.894167
|
||||
ret:-1 st: 0 flags:0 ts: 0.788000
|
||||
ret: 0 st: 0 flags:1 ts:-0.317000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
|
||||
ret:-1 st:-1 flags:0 ts: 2.576668
|
||||
ret: 0 st:-1 flags:0 ts: 2.576668
|
||||
ret: 0 st: 0 flags:1 dts: 2.124000 pts: 2.124000 pos: 34997 size: 558
|
||||
ret:-1 st:-1 flags:1 ts: 1.470835
|
||||
ret:-1 st: 0 flags:0 ts: 0.365000
|
||||
ret: 0 st: 0 flags:1 ts:-0.741000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
|
||||
ret:-1 st:-1 flags:0 ts: 2.153336
|
||||
ret: 0 st:-1 flags:0 ts: 2.153336
|
||||
ret: 0 st: 0 flags:1 dts: 2.124000 pts: 2.124000 pos: 34997 size: 558
|
||||
ret:-1 st:-1 flags:1 ts: 1.047503
|
||||
ret: 0 st: 0 flags:0 ts:-0.058000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
|
||||
ret:-1 st: 0 flags:1 ts: 2.836000
|
||||
ret: 0 st:-1 flags:0 ts: 1.730004
|
||||
ret: 0 st: 0 flags:1 dts:8589.800000 pts:8589.800000 pos: 65950 size: 32801
|
||||
ret: 0 st:-1 flags:1 ts: 0.624171
|
||||
ret: 0 st: 0 flags:1 dts: 0.256000 pts: 0.256000 pos: 65337 size: 400
|
||||
ret: 0 st: 0 flags:1 ts: 2.836000
|
||||
ret: 0 st: 0 flags:1 dts: 2.124000 pts: 2.124000 pos: 34997 size: 558
|
||||
ret:-1 st:-1 flags:0 ts: 1.730004
|
||||
ret:-1 st:-1 flags:1 ts: 0.624171
|
||||
ret: 0 st: 0 flags:0 ts:-0.482000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
|
||||
ret:-1 st: 0 flags:1 ts: 2.413000
|
||||
ret: 0 st: 0 flags:1 ts: 2.413000
|
||||
ret: 0 st: 0 flags:1 dts: 2.124000 pts: 2.124000 pos: 34997 size: 558
|
||||
ret: 0 st:-1 flags:0 ts: 1.306672
|
||||
ret: 0 st: 0 flags:1 dts:8589.800000 pts:8589.800000 pos: 65950 size: 32801
|
||||
ret: 0 st:-1 flags:1 ts: 0.200839
|
||||
ret: 0 st: 0 flags:1 dts: 0.034000 pts: 0.034000 pos: 839 size: 558
|
||||
ret: 0 st: 0 flags:1 dts:65.537000 pts:65.537000 pos: 87488 size: 6132
|
||||
ret:-1 st:-1 flags:1 ts: 0.200839
|
||||
ret: 0 st: 0 flags:0 ts:-0.905000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
|
||||
ret: 0 st: 0 flags:1 ts: 1.989000
|
||||
ret: 0 st: 0 flags:1 dts: 0.256000 pts: 0.256000 pos: 65337 size: 400
|
||||
ret: 0 st:-1 flags:0 ts: 0.883340
|
||||
ret: 0 st: 0 flags:1 dts: 3.378000 pts: 3.378000 pos: 55491 size: 558
|
||||
ret:-1 st: 0 flags:1 ts: 1.989000
|
||||
ret:-1 st:-1 flags:0 ts: 0.883340
|
||||
ret: 0 st:-1 flags:1 ts:-0.222493
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
|
||||
ret: 0 st: 0 flags:0 ts: 2.672000
|
||||
ret: 0 st: 0 flags:1 dts: 3.378000 pts: 3.378000 pos: 55491 size: 558
|
||||
ret: 0 st: 0 flags:1 ts: 1.566000
|
||||
ret: 0 st: 0 flags:1 dts: 0.256000 pts: 0.256000 pos: 65337 size: 400
|
||||
ret:-1 st: 0 flags:0 ts: 2.672000
|
||||
ret:-1 st: 0 flags:1 ts: 1.566000
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 0 flags:1 dts: 3.378000 pts: 3.378000 pos: 55491 size: 558
|
||||
ret: 0 st: 0 flags:1 dts: 1.567000 pts: 1.567000 pos: 25889 size: 556
|
||||
ret: 0 st:-1 flags:1 ts:-0.645825
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 271 size: 556
|
||||
|
@ -1,14 +1,16 @@
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size: 209
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos: -1 size: 209
|
||||
ret: 0 st: 0 flags:0 ts: 0.788000
|
||||
ret: 0 st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos: -1 size: 209
|
||||
ret: 0 st: 0 flags:1 ts:-0.317000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
|
||||
ret:-1 st: 1 flags:0 ts: 2.577000
|
||||
ret:-1 st: 1 flags:1 ts: 1.471000
|
||||
ret: 0 st: 1 flags:0 ts: 2.577000
|
||||
ret: 0 st: 1 flags:1 dts: 0.967000 pts: 0.967000 pos: -1 size: 209
|
||||
ret: 0 st: 1 flags:1 ts: 1.471000
|
||||
ret: 0 st: 1 flags:1 dts: 0.967000 pts: 0.967000 pos: -1 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.365002
|
||||
ret: 0 st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size: 209
|
||||
ret: 0 st:-1 flags:1 ts:-0.740831
|
||||
@ -19,7 +21,8 @@ ret: 0 st: 0 flags:1 ts: 1.048000
|
||||
ret: 0 st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos: -1 size: 209
|
||||
ret: 0 st: 1 flags:0 ts:-0.058000
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 29375 size: 208
|
||||
ret:-1 st: 1 flags:1 ts: 2.836000
|
||||
ret: 0 st: 1 flags:1 ts: 2.836000
|
||||
ret: 0 st: 1 flags:1 dts: 0.967000 pts: 0.967000 pos: -1 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 1.730004
|
||||
ret: 0 st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos: -1 size: 209
|
||||
ret: 0 st:-1 flags:1 ts: 0.624171
|
||||
@ -28,7 +31,8 @@ ret: 0 st: 0 flags:0 ts:-0.482000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
|
||||
ret: 0 st: 0 flags:1 ts: 2.413000
|
||||
ret: 0 st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos: -1 size: 209
|
||||
ret:-1 st: 1 flags:0 ts: 1.307000
|
||||
ret: 0 st: 1 flags:0 ts: 1.307000
|
||||
ret: 0 st: 1 flags:1 dts: 0.967000 pts: 0.967000 pos: -1 size: 209
|
||||
ret: 0 st: 1 flags:1 ts: 0.201000
|
||||
ret: 0 st: 1 flags:1 dts: 0.183000 pts: 0.183000 pos: 70975 size: 209
|
||||
ret: 0 st:-1 flags:0 ts:-0.904994
|
||||
@ -39,8 +43,10 @@ ret: 0 st: 0 flags:0 ts: 0.883000
|
||||
ret: 0 st: 1 flags:1 dts: 0.960000 pts: 0.960000 pos: -1 size: 209
|
||||
ret: 0 st: 0 flags:1 ts:-0.222000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 575 size: 28487
|
||||
ret:-1 st: 1 flags:0 ts: 2.672000
|
||||
ret:-1 st: 1 flags:1 ts: 1.566000
|
||||
ret: 0 st: 1 flags:0 ts: 2.672000
|
||||
ret: 0 st: 1 flags:1 dts: 0.967000 pts: 0.967000 pos: -1 size: 209
|
||||
ret: 0 st: 1 flags:1 ts: 1.566000
|
||||
ret: 0 st: 1 flags:1 dts: 0.967000 pts: 0.967000 pos: -1 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 1 flags:1 dts: 0.444000 pts: 0.444000 pos: 147775 size: 209
|
||||
ret: 0 st:-1 flags:1 ts:-0.645825
|
||||
|
@ -7,8 +7,10 @@ ret: 0 st: 0 flags:0 ts: 0.788000
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
|
||||
ret: 0 st: 0 flags:1 ts:-0.317000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
|
||||
ret:-1 st: 1 flags:0 ts: 2.577000
|
||||
ret:-1 st: 1 flags:1 ts: 1.471000
|
||||
ret: 0 st: 1 flags:0 ts: 2.577000
|
||||
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
|
||||
ret: 0 st: 1 flags:1 ts: 1.471000
|
||||
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
|
||||
ret: 0 st:-1 flags:0 ts: 0.365002
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
|
||||
ret: 0 st:-1 flags:1 ts:-0.740831
|
||||
@ -19,7 +21,8 @@ ret: 0 st: 0 flags:1 ts: 1.048000
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
|
||||
ret: 0 st: 1 flags:0 ts:-0.058000
|
||||
ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 31483 size: 278
|
||||
ret:-1 st: 1 flags:1 ts: 2.836000
|
||||
ret: 0 st: 1 flags:1 ts: 2.836000
|
||||
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
|
||||
ret: 0 st:-1 flags:0 ts: 1.730004
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
|
||||
ret: 0 st:-1 flags:1 ts: 0.624171
|
||||
@ -28,7 +31,8 @@ ret: 0 st: 0 flags:0 ts:-0.482000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
|
||||
ret: 0 st: 0 flags:1 ts: 2.413000
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
|
||||
ret:-1 st: 1 flags:0 ts: 1.307000
|
||||
ret: 0 st: 1 flags:0 ts: 1.307000
|
||||
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
|
||||
ret: 0 st: 1 flags:1 ts: 0.201000
|
||||
ret: 0 st: 1 flags:1 dts: 0.174000 pts: 0.174000 pos: 78969 size: 278
|
||||
ret: 0 st:-1 flags:0 ts:-0.904994
|
||||
@ -39,8 +43,10 @@ ret: 0 st: 0 flags:0 ts: 0.883000
|
||||
ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 314982 size: 31143
|
||||
ret: 0 st: 0 flags:1 ts:-0.222000
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 398 size: 31082
|
||||
ret:-1 st: 1 flags:0 ts: 2.672000
|
||||
ret:-1 st: 1 flags:1 ts: 1.566000
|
||||
ret: 0 st: 1 flags:0 ts: 2.672000
|
||||
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
|
||||
ret: 0 st: 1 flags:1 ts: 1.566000
|
||||
ret: 0 st: 1 flags:1 dts: 0.975000 pts: 0.975000 pos: 346128 size: 278
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 158515 size: 31134
|
||||
ret: 0 st:-1 flags:1 ts:-0.645825
|
||||
|
@ -1,10 +1,10 @@
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 0 flags:0 dts: 1.400000 pts: 1.440000 pos: 27072 size: 16433
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 0 flags:0 dts: 1.880000 pts: 1.920000 pos: 216012 size: 17441
|
||||
ret: 0 st: 0 flags:0 ts: 0.788333
|
||||
ret: 0 st: 0 flags:0 dts: 1.400000 pts: 1.440000 pos: 27072 size: 16433
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 0 flags:1 ts:-0.317500
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 1 flags:0 ts: 2.576667
|
||||
@ -12,7 +12,7 @@ ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
|
||||
ret: 0 st: 1 flags:1 ts: 1.470833
|
||||
ret: 0 st: 1 flags:1 dts: 1.400000 pts: 1.400000 pos: 172584 size: 208
|
||||
ret: 0 st:-1 flags:0 ts: 0.365002
|
||||
ret: 0 st: 0 flags:0 dts: 1.400000 pts: 1.440000 pos: 27072 size: 16433
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st:-1 flags:1 ts:-0.740831
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 0 flags:0 ts: 2.153333
|
||||
@ -20,7 +20,7 @@ ret: 0 st: 0 flags:0 dts: 2.160000 pts: 2.200000 pos: 325240 size: 12679
|
||||
ret: 0 st: 0 flags:1 ts: 1.047500
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 1 flags:0 ts:-0.058333
|
||||
ret: 0 st: 1 flags:1 dts: 1.765711 pts: 1.765711 pos: 322232 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 1.400000 pts: 1.400000 pos: 172584 size: 208
|
||||
ret: 0 st: 1 flags:1 ts: 2.835833
|
||||
ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
|
||||
ret: 0 st:-1 flags:0 ts: 1.730004
|
||||
@ -28,19 +28,19 @@ ret: 0 st: 1 flags:1 dts: 1.400000 pts: 1.400000 pos: 172584 size: 208
|
||||
ret: 0 st:-1 flags:1 ts: 0.624171
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 0 flags:0 ts:-0.481667
|
||||
ret: 0 st: 0 flags:0 dts: 1.400000 pts: 1.440000 pos: 27072 size: 16433
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 0 flags:1 ts: 2.412500
|
||||
ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
|
||||
ret: 0 st: 1 flags:0 ts: 1.306667
|
||||
ret: 0 st: 1 flags:1 dts: 1.765711 pts: 1.765711 pos: 322232 size: 209
|
||||
ret: 0 st: 1 flags:1 dts: 1.400000 pts: 1.400000 pos: 172584 size: 208
|
||||
ret: 0 st: 1 flags:1 ts: 0.200844
|
||||
ret: 0 st: 1 flags:1 dts: 1.400000 pts: 1.400000 pos: 172584 size: 208
|
||||
ret: 0 st:-1 flags:0 ts:-0.904994
|
||||
ret: 0 st: 0 flags:0 dts: 1.400000 pts: 1.440000 pos: 27072 size: 16433
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st:-1 flags:1 ts: 1.989173
|
||||
ret: 0 st: 0 flags:0 dts: 1.960000 pts: 2.000000 pos: 250980 size: 13438
|
||||
ret: 0 st: 0 flags:0 ts: 0.883344
|
||||
ret: 0 st: 0 flags:0 dts: 1.400000 pts: 1.440000 pos: 27072 size: 16433
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 0 flags:1 ts:-0.222489
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st: 1 flags:0 ts: 2.671678
|
||||
@ -48,6 +48,6 @@ ret: 0 st: 1 flags:1 dts: 2.131433 pts: 2.131433 pos: 403636 size: 209
|
||||
ret: 0 st: 1 flags:1 ts: 1.565844
|
||||
ret: 0 st: 1 flags:1 dts: 1.400000 pts: 1.400000 pos: 172584 size: 208
|
||||
ret: 0 st:-1 flags:0 ts: 0.460008
|
||||
ret: 0 st: 0 flags:0 dts: 1.400000 pts: 1.440000 pos: 27072 size: 16433
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
ret: 0 st:-1 flags:1 ts:-0.645825
|
||||
ret: 0 st: 0 flags:1 dts: 1.360000 pts: 1.400000 pos: 564 size: 24801
|
||||
|
@ -1,6 +1,6 @@
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 3604 size: 743
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 404 size: 743
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32404 size: 743
|
||||
ret: 0 st: 0 flags:0 ts: 0.788000
|
||||
|
@ -1,6 +1,6 @@
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
|
||||
ret: 0 st:-1 flags:0 ts:-1.000000
|
||||
ret: 0 st: 0 flags:1 dts: 0.186000 pts: 0.186000 pos: 3644 size: 743
|
||||
ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 444 size: 743
|
||||
ret: 0 st:-1 flags:1 ts: 1.894167
|
||||
ret: 0 st: 0 flags:1 dts: 1.858000 pts: 1.858000 pos: 32444 size: 743
|
||||
ret: 0 st: 0 flags:0 ts: 0.788000
|
||||
|
Loading…
Reference in New Issue
Block a user