You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
seek-test: support manually forcing a seek to a specific position
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -63,6 +63,16 @@ int main(int argc, char **argv)
|
|||||||
int i, ret, stream_id;
|
int i, ret, stream_id;
|
||||||
int64_t timestamp;
|
int64_t timestamp;
|
||||||
AVDictionary *format_opts = NULL;
|
AVDictionary *format_opts = NULL;
|
||||||
|
int64_t seekfirst;
|
||||||
|
int firstback=0;
|
||||||
|
|
||||||
|
if(argc == 4 && !strcmp(argv[2], "-seekforw")){
|
||||||
|
seekfirst = atoi(argv[3]);
|
||||||
|
} else if(argc == 4 && !strcmp(argv[2], "-seekback")){
|
||||||
|
seekfirst = atoi(argv[3]);
|
||||||
|
firstback = 1;
|
||||||
|
} else
|
||||||
|
seekfirst = AV_NOPTS_VALUE;
|
||||||
|
|
||||||
av_dict_set(&format_opts, "channels", "1", 0);
|
av_dict_set(&format_opts, "channels", "1", 0);
|
||||||
av_dict_set(&format_opts, "sample_rate", "22050", 0);
|
av_dict_set(&format_opts, "sample_rate", "22050", 0);
|
||||||
@@ -70,7 +80,7 @@ int main(int argc, char **argv)
|
|||||||
/* initialize libavcodec, and register all codecs and formats */
|
/* initialize libavcodec, and register all codecs and formats */
|
||||||
av_register_all();
|
av_register_all();
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc < 2) {
|
||||||
printf("usage: %s input_file\n"
|
printf("usage: %s input_file\n"
|
||||||
"\n", argv[0]);
|
"\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -91,6 +101,10 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(seekfirst != AV_NOPTS_VALUE){
|
||||||
|
if(firstback) avformat_seek_file(ic, -1, INT64_MIN, seekfirst, seekfirst, 0);
|
||||||
|
else avformat_seek_file(ic, -1, seekfirst, seekfirst, INT64_MAX, 0);
|
||||||
|
}
|
||||||
for(i=0; ; i++){
|
for(i=0; ; i++){
|
||||||
AVPacket pkt = { 0 };
|
AVPacket pkt = { 0 };
|
||||||
AVStream *av_uninit(st);
|
AVStream *av_uninit(st);
|
||||||
|
Reference in New Issue
Block a user