27 static int usage(
const char *argv0,
int ret)
29 fprintf(stderr,
"%s [-b bytespersec] [-d duration] input_url output_url\n", argv0);
33 int main(
int argc,
char **argv)
36 const char *input_url =
NULL, *output_url =
NULL;
37 int64_t stream_pos = 0;
45 for (i = 1; i < argc; i++) {
46 if (!strcmp(argv[i],
"-b") && i + 1 < argc) {
47 bps = atoi(argv[i + 1]);
49 }
else if (!strcmp(argv[i],
"-d") && i + 1 < argc) {
52 }
else if (!input_url) {
54 }
else if (!output_url) {
57 return usage(argv[0], 1);
61 return usage(argv[0], 1);
66 fprintf(stderr,
"Unable to open %s: %s\n", input_url, errbuf);
73 fprintf(stderr,
"Unable to get size of %s: %s\n", input_url, errbuf);
81 fprintf(stderr,
"Unable to open %s: %s\n", output_url, errbuf);
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define AVIO_FLAG_READ
read-only
#define AVIO_FLAG_WRITE
write-only
int av_usleep(unsigned usec)
Sleep for a period of time.
int main(int argc, char **argv)
static int64_t start_time
int avformat_network_init(void)
Do global initialization of network components.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int avio_close(AVIOContext *s)
Close the resource accessed by the AVIOContext s and free it.
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
#define AV_TIME_BASE
Internal time base represented as integer.
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
int avio_open2(AVIOContext **s, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options)
Create and initialize a AVIOContext for accessing the resource indicated by url.
static int usage(const char *argv0, int ret)
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
Put a description of the AVERROR code errnum in errbuf.
void av_register_all(void)
Initialize libavformat and register all the muxers, demuxers and protocols.