|
|
@ -61,18 +61,25 @@ int main(int argc, char **argv) |
|
|
|
const char *filename; |
|
|
|
const char *filename; |
|
|
|
AVFormatContext *ic = NULL; |
|
|
|
AVFormatContext *ic = NULL; |
|
|
|
int i, ret, stream_id; |
|
|
|
int i, ret, stream_id; |
|
|
|
|
|
|
|
int j; |
|
|
|
int64_t timestamp; |
|
|
|
int64_t timestamp; |
|
|
|
AVDictionary *format_opts = NULL; |
|
|
|
AVDictionary *format_opts = NULL; |
|
|
|
int64_t seekfirst; |
|
|
|
int64_t seekfirst = AV_NOPTS_VALUE; |
|
|
|
int firstback=0; |
|
|
|
int firstback=0; |
|
|
|
|
|
|
|
int frame_count = 1; |
|
|
|
|
|
|
|
|
|
|
|
if(argc == 4 && !strcmp(argv[2], "-seekforw")){ |
|
|
|
for(i=2; i<argc; i+=2){ |
|
|
|
seekfirst = atoi(argv[3]); |
|
|
|
if (!strcmp(argv[i], "-seekforw")){ |
|
|
|
} else if(argc == 4 && !strcmp(argv[2], "-seekback")){ |
|
|
|
seekfirst = atoi(argv[i+1]); |
|
|
|
seekfirst = atoi(argv[3]); |
|
|
|
} else if(!strcmp(argv[i], "-seekback")){ |
|
|
|
|
|
|
|
seekfirst = atoi(argv[i+1]); |
|
|
|
firstback = 1; |
|
|
|
firstback = 1; |
|
|
|
} else |
|
|
|
} else if(!strcmp(argv[i], "-frames")){ |
|
|
|
seekfirst = AV_NOPTS_VALUE; |
|
|
|
frame_count = atoi(argv[i+1]); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
argc = 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
@ -111,6 +118,7 @@ int main(int argc, char **argv) |
|
|
|
char ts_buf[60]; |
|
|
|
char ts_buf[60]; |
|
|
|
|
|
|
|
|
|
|
|
if(ret>=0){ |
|
|
|
if(ret>=0){ |
|
|
|
|
|
|
|
for(j=0; j<frame_count; j++) { |
|
|
|
ret= av_read_frame(ic, &pkt); |
|
|
|
ret= av_read_frame(ic, &pkt); |
|
|
|
if(ret>=0){ |
|
|
|
if(ret>=0){ |
|
|
|
char dts_buf[60]; |
|
|
|
char dts_buf[60]; |
|
|
@ -123,6 +131,7 @@ int main(int argc, char **argv) |
|
|
|
printf("ret:%s", ret_str(ret)); // necessary to avoid trailing whitespace
|
|
|
|
printf("ret:%s", ret_str(ret)); // necessary to avoid trailing whitespace
|
|
|
|
printf("\n"); |
|
|
|
printf("\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(i>25) break; |
|
|
|
if(i>25) break; |
|
|
|
|
|
|
|
|
|
|
|