-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (31 loc) · 725 Bytes
/
Copy pathmain.cpp
File metadata and controls
44 lines (31 loc) · 725 Bytes
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
#include <cstdlib>
#include <thread>
#include <iostream>
#include "netstream_reader.h"
class VideoObserver :public NetStreamReaderObserver
{
public:
VideoObserver(){}
~VideoObserver(){}
void OnDecodedFrame(const AVFrame *pFrame) override {
std::cout << "w=" << pFrame->width
<< ",h=" << pFrame->height
<< std::endl;
}
};
int main(int argc, char *argv[])
{
if (argc <= 1) {
std::cout << "missing parameter: rtsp URL" << std::endl;
return 0;
}
std::shared_ptr<NetStreamReader> reader(NetStreamReader::create(0));
VideoObserver observer;
int ret = reader->OpenStream(argv[1], &observer);
if (ret < 0) {
return 0;
}
while (1) {
std::this_thread::sleep_for(std::chrono::seconds(10));
}
}