CPicturePlayer.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef __CPICTURE_PLAYER_H__
  2. #define __CPICTURE_PLAYER_H__
  3. #include <stdio.h>
  4. #include <stdint.h>
  5. #include <stdbool.h>
  6. #include <semaphore.h>
  7. #include "ipicdatastruct.h"
  8. #ifdef __cplusplus
  9. extern "C"
  10. {
  11. #endif // __cplusplus
  12. #if defined(_WIN32)
  13. #include <SDL.h>
  14. #include <SDL_video.h>
  15. #include <SDL_render.h>
  16. #include <SDL_rect.h>
  17. #include <SDL_mutex.h>
  18. #include <SDL_image.h>
  19. #else
  20. #include <SDL2/SDL.h>
  21. #include <SDL2/SDL_video.h>
  22. #include <SDL2/SDL_render.h>
  23. #include <SDL2/SDL_rect.h>
  24. #include <SDL2/SDL_mutex.h>
  25. #include <SDL2/SDL_image.h>
  26. #endif
  27. #ifdef __cplusplus
  28. }
  29. #endif // __cplusplus
  30. #ifndef MAX_FILECOUNT
  31. #define MAX_FILECOUNT 32
  32. #endif // !MAX_FILECOUNT
  33. #ifndef MAX_PATH
  34. #define MAX_PATH 260
  35. #endif
  36. #ifndef MAX_DISPLAYNUM
  37. #define MAX_DISPLAYNUM 5
  38. #endif // !MAX_DISPLAYNUM
  39. typedef struct rvc_picture_player_param_s {
  40. int icx;
  41. int icy;
  42. uint8_t uwindow_width;
  43. uint8_t uwindow_height;
  44. bool bfull_screen;
  45. bool bprim_monitor;
  46. int nfile_cnt;
  47. int nplay_cnt;
  48. int nplay_interval;
  49. char strroot_path[MAX_PATH];
  50. char strfile_names[MAX_FILECOUNT][MAX_PATH];
  51. }rvc_picture_player_param_t;
  52. class CPicturePlayer
  53. {
  54. public:
  55. CPicturePlayer(CPicHostApi* pHostApi);
  56. ~CPicturePlayer();
  57. int InitParam(rvc_picture_player_param_t* tparam);
  58. int DeInit();
  59. bool StartPicPlay();
  60. int StopPicPlay();
  61. bool GetPicPlayingFlag();
  62. bool SetPicPlayingFlag(bool bret);
  63. size_t GetVideoDisplayInfo();
  64. public:
  65. SDL_Window* m_window;
  66. CPicHostApi* m_pHostApi;
  67. int m_nfile_cnt;
  68. int m_nplay_cnt;
  69. int m_nplay_interval;
  70. char m_strroot_path[MAX_PATH];
  71. char m_strfile_names[MAX_FILECOUNT][MAX_PATH];
  72. int m_show_width;
  73. int m_show_height;
  74. bool m_busrstop;
  75. private:
  76. bool m_bplaying;
  77. char* m_stricopath;
  78. SDL_Thread* m_thid;
  79. SDL_DisplayMode m_dispalymode[MAX_DISPLAYNUM];
  80. sem_t m_play_exit_sem;
  81. };
  82. #endif