main.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #include "simple_mq.h"
  2. #include "utility.hpp"
  3. #include "variable_defs.h"
  4. #include <spdlog/spdlog.h>
  5. #include <GLFW/glfw3.h>
  6. #include <cassert>
  7. using namespace simple_mq_singleton;
  8. extern GLFWwindow *main_window;
  9. void initialize_mq();
  10. void load_config();
  11. void initialize_cuda();
  12. void initialize_main_window();
  13. void cleanup();
  14. void prepare_imgui_frame();
  15. void handle_imgui_events();
  16. bool is_capturing();
  17. bool is_encoding();
  18. void wait_camera_frames();
  19. void process_camera_frames();
  20. void render_main_window();
  21. void generate_output_frame();
  22. int main() {
  23. #ifndef NDEBUG
  24. spdlog::set_level(spdlog::level::trace);
  25. #endif
  26. // initialize many staffs
  27. initialize_mq();
  28. initialize_cuda();
  29. load_config();
  30. initialize_main_window();
  31. while (!glfwWindowShouldClose(main_window)) {
  32. RESET_TIMER;
  33. prepare_imgui_frame();
  34. handle_imgui_events();
  35. if (is_capturing()) {
  36. wait_camera_frames();
  37. process_camera_frames();
  38. if (is_encoding()) {
  39. generate_output_frame();
  40. }
  41. }
  42. render_main_window();
  43. }
  44. cleanup();
  45. return 0;
  46. }