libvideorender.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include "ivideorenderinterface.h"
  3. #include <SDL2/SDL.h>
  4. #include <SDL2/SDL_video.h>
  5. #include <SDL2/SDL_render.h>
  6. #include <SDL2/SDL_rect.h>
  7. #include <SDL2/SDL_mutex.h>
  8. class VideoRenderImpl : public IVideoRender
  9. {
  10. public:
  11. VideoRenderImpl(videorender_callback_t* pCallback);
  12. ~VideoRenderImpl();
  13. int VideoRenderSetParam(videorender_param_t* tparam);
  14. int StartVideoRender();
  15. int StopVideoRender();
  16. void VideoRenderDestroy();
  17. int ShowVideoWindow();
  18. int HideVideoWindow();
  19. int RenderVideoFrame(video_frame* pframe, RVC_RendererFlip eFlipType = RVC_FLIP_NONE);
  20. int SetWindowProperty(videorender_param_t* tparam);
  21. SDL_PixelFormatEnum GetPixelFormat();
  22. void ConVert24to32(unsigned char* image_in, unsigned char* image_out, int w, int h);
  23. bool GetReFreshFlag();
  24. void RenderLog(const char* fmt, ...);
  25. private:
  26. SDL_Window* m_sdl_window;
  27. SDL_Texture* m_rending_texture;
  28. SDL_Renderer* m_renderer;
  29. videorender_callback_t m_callback;
  30. SDL_Thread *m_refresh_thread;
  31. bool m_refresh_flag;
  32. int m_cx;
  33. int m_cy;
  34. uint32_t m_videowidth;
  35. uint32_t m_videoheight;
  36. uint32_t m_width;
  37. uint32_t m_height;
  38. uint32_t m_flags;
  39. int m_videoformat;
  40. bool m_bmoveable;
  41. };