CPicturePlayer.h 1.7 KB

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