37 case AVERROR(EIO):
return "-EIO";
38 case AVERROR(ENOMEM):
return "-ENOMEM";
39 case AVERROR(EINVAL):
return "-EINVAL";
49 strcpy(buffer,
" NOPTS ");
53 snprintf(buffer, 60,
"%c%"PRId64
".%06"PRId64
"", ts<0 ?
'-' :
' ',
FFABS(ts)/1000000,
FFABS(ts)%1000000);
56 int main(
int argc,
char **argv)
60 int i,
ret, stream_id;
69 for(i=2; i<argc; i+=2){
70 if (!strcmp(argv[i],
"-seekforw")){
71 seekfirst = atoi(argv[i+1]);
72 }
else if(!strcmp(argv[i],
"-seekback")){
73 seekfirst = atoi(argv[i+1]);
75 }
else if(!strcmp(argv[i],
"-frames")){
76 frame_count = atoi(argv[i+1]);
77 }
else if(!strcmp(argv[i],
"-duration")){
78 duration = atoi(argv[i+1]);
79 }
else if(!strcmp(argv[i],
"-usetoc")) {
87 av_dict_set(&format_opts,
"sample_rate",
"22050", 0);
93 printf(
"usage: %s input_file\n"
103 fprintf(stderr,
"cannot open %s\n", filename);
109 fprintf(stderr,
"%s: could not find codec parameters\n", filename);
123 for(j=0; j<frame_count; j++) {
130 printf(
"ret:%-10s st:%2d flags:%d dts:%s pts:%s pos:%7" PRId64
" size:%6d",
ret_str(ret), pkt.
stream_index, pkt.
flags, dts_buf, ts_buf, pkt.
pos, pkt.
size);
133 printf(
"ret:%s",
ret_str(ret));
149 ts_str(ts_buf, timestamp, stream_id < 0 ? AV_TIME_BASE_Q : st->time_base);
150 printf(
"ret:%-10s st:%2d flags:%d ts:%s\n",
ret_str(ret), stream_id, i&1, ts_buf);
void av_free_packet(AVPacket *pkt)
Free a packet.
int64_t pos
byte position in stream, -1 if unknown
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
AVStream ** streams
A list of all streams in the file.
#define AVERROR_EOF
End of file.
AVDictionary * format_opts
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
static void ts_str(char buffer[60], int64_t ts, AVRational base)
int flags
A combination of AV_PKT_FLAG values.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
#define AV_TIME_BASE
Internal time base represented as integer.
static const char * ret_str(int v)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int main(int argc, char **argv)
rational number numerator/denominator
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
common internal and external API header
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
This structure stores compressed data.
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.