video_encoder.h 792 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef REMOTEAR2_VIDEO_ENCODER_H
  2. #define REMOTEAR2_VIDEO_ENCODER_H
  3. #include <opencv2/core/types.hpp>
  4. #include <glad/gl.h> // make windows happy
  5. #include <cuda_gl_interop.h>
  6. #include <memory>
  7. class video_encoder {
  8. public:
  9. video_encoder();
  10. ~video_encoder();
  11. bool start_encode(cv::Size size, int fps, int bitrate,
  12. bool save_file = false, bool save_frame_length = true);
  13. void stop_encode();
  14. bool encode_frame(void *frame_ptr, void **output_ptr, size_t *output_size);
  15. bool encode_frame(cudaGraphicsResource *res, void **output_ptr, size_t *output_size);
  16. bool is_encoding();
  17. // force next frame to be IDR frame
  18. void refresh();
  19. private:
  20. struct impl;
  21. std::unique_ptr<impl> pimpl;
  22. };
  23. #endif //REMOTEAR2_VIDEO_ENCODER_H