Clean up main()
This commit is contained in:
parent
2f4587e40a
commit
36e5d15400
1 changed files with 20 additions and 11 deletions
23
src/main.cpp
23
src/main.cpp
|
@ -1,6 +1,7 @@
|
|||
#include "camera.hpp"
|
||||
#if !defined(NDEBUG)
|
||||
# include <iostream>
|
||||
# include <iomanip>
|
||||
#endif
|
||||
#include <opencv2/flann.hpp>
|
||||
#include <climits>
|
||||
|
@ -21,22 +22,30 @@ std::ostream& operator<< (std::ostream& stream, const FrameFormat& value) {
|
|||
} //namespace mgs
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
try {
|
||||
mgs::Camera cam("/dev/video0", {}, false);
|
||||
cam.set_frame_size({1280, 720, MjpegFormat});
|
||||
std::cout << mgs::FrameFormat{1280, 720, MjpegFormat} << '\n';
|
||||
|
||||
namespace {
|
||||
#if !defined(NDEBUG)
|
||||
void print_supported_frame_formats (const mgs::Camera& cam) {
|
||||
const auto curr_frame_size = cam.frame_size();
|
||||
|
||||
std::cout << "Supported frame formats:\n";
|
||||
int count = 0;
|
||||
for (const auto& size : cam.supported_frame_sizes()) {
|
||||
std::cout << size;
|
||||
std::cout << std::setw(2) << ++count << " - " << size;
|
||||
|
||||
if (curr_frame_size == size)
|
||||
std::cout << " *";
|
||||
std::cout << '\n';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} //unnamed namespace
|
||||
|
||||
int main() {
|
||||
try {
|
||||
mgs::Camera cam("/dev/video0", {}, false);
|
||||
cam.set_frame_size({1280, 720, MjpegFormat});
|
||||
|
||||
print_supported_frame_formats(cam);
|
||||
cam.start_streaming();
|
||||
|
||||
std::vector<char> my_frame;
|
||||
|
|
Loading…
Reference in a new issue