-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (34 loc) · 1004 Bytes
/
main.cpp
File metadata and controls
40 lines (34 loc) · 1004 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
#include "capture.hpp"
#include "display.hpp"
#include "filter.hpp"
#include <iostream>
int main() {
const auto width = 720;
const auto height = 480;
auto capture = new Capture("/dev/video0","v4l2",width,height);
auto err = capture->init();
if (err != 0) {
std::cout << "Error initalizing capture device" << std::endl;
exit(err);
}
auto display = new Display(width,height);
err = display->init();
if (err != 0) {
std::cout << "Error initalizing display" << std::endl;
exit(err);
}
auto filter = new Filter(width,height);
while (!display->done() && !capture->done()) {
int pitch;
uint8_t *pixels;
err = display->lock((void **)&pixels,&pitch);
if (err !=0) {
std::cout << "Error locking display" << std::endl;
exit(err);
}
capture->decode(filter->scanlines(pixels,pitch));
display->render();
}
delete display;
delete capture;
}