-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (24 loc) · 817 Bytes
/
main.cpp
File metadata and controls
35 lines (24 loc) · 817 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
import Camera;
import VideoFrame;
import Encoder;
#include <iostream>
#include <fstream>
int main() {
VideoFrame::VideoFramesQueue queue{};
auto oCameraInfo = Camera::run(queue);
if (!oCameraInfo.has_value()) {
std::cout << "Failed to start camera" << std::endl;
return -1;
}
std::cout << "HET" << std::endl;
VideoFrame::EncodedVideoFramesQueue encodedVideoFramesQueue{};
Encoder::run(oCameraInfo.value(), queue, encodedVideoFramesQueue);
std::ofstream myfile{};
myfile.open("encoded.h264", std::ios::binary);
while (true) {
auto frame = encodedVideoFramesQueue.pop();
std::cout << "Received encoded frame" << std::endl;
myfile.write(reinterpret_cast<const char *>(frame.data.data()), frame.data.size());
}
return 0;
}