image_streamer.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef DEPTHGUIDE_IMAGE_STREAMER_H
  2. #define DEPTHGUIDE_IMAGE_STREAMER_H
  3. #include "core/object_manager.h"
  4. #include "core/cuda_helper.hpp"
  5. #include <memory>
  6. class image_streamer {
  7. public:
  8. using io_context = boost::asio::io_context;
  9. struct create_config {
  10. // image must be valid before start
  11. obj_name_type img_name = invalid_obj_name;
  12. // extra data will be placed at the start of the stream
  13. // receiver must do the same parsing work for proper work
  14. obj_name_type ext_name = invalid_obj_name; // data_type
  15. std::optional<int> frame_rate;
  16. io_context *asio_ctx = nullptr;
  17. // for encoder
  18. CUcontext *cuda_ctx = nullptr;
  19. smart_cuda_stream *stream = nullptr;
  20. };
  21. explicit image_streamer(create_config conf);
  22. ~image_streamer();
  23. void show();
  24. void change_frame_rate(int fps);
  25. using sig_req_size_type = boost::signals2::signal<void(cv::Size)>;
  26. sig_req_size_type sig_req_size;
  27. private:
  28. struct impl;
  29. std::unique_ptr<impl> pimpl;
  30. };
  31. #endif //DEPTHGUIDE_IMAGE_STREAMER_H