forked from bluecherrydvr/bluecherry-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtsp-streaminfo.c
59 lines (48 loc) · 1.01 KB
/
rtsp-streaminfo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* Copyright (C) 2010 Bluecherry, LLC
*
* Confidential, all rights reserved. No distribution is permitted.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
static void usage(void)
{
fprintf(stderr, "Usage: rtsp-streaminfo rtsp://[USERINFO@]"
"SERVER[:PORT]/PATH_TO_SDP\n\n");
exit(EXIT_FAILURE);
}
int main(int argc, char* argv[])
{
AVFormatContext *fmt_ctx;
int opt;
char *url;
while ((opt = getopt(argc, argv, "h")) != -1) {
switch (opt) {
case 'h':
default:
usage();
}
}
if (argc <= optind)
usage();
url = argv[optind++];
av_register_all();
if (av_open_input_file(&fmt_ctx, url, NULL, 0, NULL) != 0) {
fprintf(stderr, "Could not open URI\n");
exit(1);
}
if (av_find_stream_info(fmt_ctx) < 0) {
fprintf(stderr, "Could not find stream info\n");
exit(1);
}
dump_format(fmt_ctx, 0, url, 0);
exit(0);
}