VideoRenderer.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #include <cstdint>
  2. #include <memory>
  3. #include <iostream>
  4. #include "PCANBasic.h"
  5. #include "api/video/video_frame.h"
  6. #include "../common/comm.h"
  7. #include "api.h"
  8. #include "VideoRenderer.h"
  9. #include "message_queue.h"
  10. VideoRenderer::VideoRenderer()
  11. {
  12. start_=false;
  13. }
  14. VideoRenderer::~VideoRenderer()
  15. {
  16. }
  17. /*
  18. void VideoRenderer::SetRenderSize(int32_t width,int32_t height)
  19. {
  20. SetSize(width,height);
  21. }
  22. void VideoRenderer::SetSize(int32_t width, int32_t height)
  23. {
  24. if (width_ == width && height_ == height) {
  25. return;
  26. }
  27. width_ = width;
  28. height_ = height;
  29. image_.reset(new uint8_t[width * height * 4]);
  30. }
  31. */
  32. void VideoRenderer::FrameCallback(void* user_data,void* data,const int32_t stride,const int32_t frame_width,const int32_t frame_height)
  33. {
  34. std::cout<<"FrameCallback"<<std::endl;
  35. // auto ptr = static_cast<VideoRenderer *>(user_data);
  36. // ptr->OnArgb32FrameReady(data, stride, frame_width, frame_height);
  37. }
  38. void VideoRenderer::OnArgb32FrameReady(const void* data, const int stride, const int frame_width, const int frame_height)
  39. {
  40. /*
  41. if(start_==false) return;
  42. std::cout<<frame_width<<","<<frame_height<<std::endl;
  43. */
  44. }
  45. void VideoRenderer::StartRender(bool bStart)
  46. {
  47. start_=bStart;
  48. }