CPicturePlayer.h 2.1 KB

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