framestream2 (with rigtorp/SPSCQueue)

This commit is contained in:
2024-04-25 14:13:51 +02:00
parent d52a1a44f8
commit f46d0a713d
9 changed files with 632 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
#include "./chat_gui/theme.hpp"
#include "./start_screen.hpp"
#include "./content/sdl_video_frame_stream2.hpp"
#include <memory>
#include <iostream>
@@ -58,6 +59,26 @@ int main(int argc, char** argv) {
}
}
// optionally init audio and camera
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
std::cerr << "SDL_Init AUDIO failed (" << SDL_GetError() << ")\n";
}
if (SDL_Init(SDL_INIT_CAMERA) < 0) {
std::cerr << "SDL_Init CAMERA failed (" << SDL_GetError() << ")\n";
} else { // HACK
SDLVideoCameraContent vcc;
auto* reader = vcc.aquireReader();
for (size_t i = 0; i < 200; i++) {
std::this_thread::sleep_for(std::chrono::milliseconds(50));
auto new_frame_opt = reader->getNext();
if (new_frame_opt.has_value()) {
std::cout << "video frame was " << new_frame_opt.value().surface->w << "x" << new_frame_opt.value().surface->h << " " << new_frame_opt.value().timestampNS << "ns\n";
}
}
vcc.releaseReader(reader);
}
std::cout << "after sdl video stuffery\n";
IMGUI_CHECKVERSION();
ImGui::CreateContext();