mirrorplayer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef MIRRORPLAYER_H
  2. #define MIRRORPLAYER_H
  3. #include "devicemanage.h"
  4. #include <semaphore.h>
  5. class MirrorPlayer
  6. {
  7. public:
  8. MirrorPlayer();
  9. bool Initialize();
  10. void SetLinkstatusCallback(void (*callback)(int, void*), void* parameter);
  11. void SetVideoStartCallback(FUNCVIDEOSTART funcVideoStart);
  12. void SetVideoInfoCallback(FUNCVIDEOINFO funcVideoInfo);
  13. bool GetInserted() const {
  14. return m_bInserted;
  15. }
  16. bool GetConnected() const {
  17. return m_bConnected;
  18. }
  19. bool startServer();
  20. void setController(Controller *controller);
  21. void SetInsertPath(char *pBuffer);
  22. bool SetPlayForeground(bool bForeground);//前后台切换
  23. bool ExitLink();
  24. bool RestartLink();
  25. void Start();
  26. void Stop();
  27. void Key(int key);
  28. bool WirelessConnect(char *pAddress);
  29. void WirelessDisConnect(char *pAddress);
  30. void SetIPAddress(char *pAddress);
  31. void updateDevice();
  32. void getIP();
  33. void stopServer();
  34. private:
  35. void onVideoStartCallback(bool start, int width, int height);
  36. void onVideoInfoCallback(int width, int height, unsigned char* data, int length);
  37. static void usb_insert_callback_func(bool insert, void* parameter);
  38. static void server_finished_callback_func(void* parameter);
  39. static void server_removed_callback_func(void* parameter);
  40. static void vertical_callback(bool bVertical);
  41. private:
  42. DeviceManage m_deviceManage;
  43. void* m_parameter;
  44. void (*m_callback)(int, void *);
  45. string m_serial="";
  46. //UsbManager* m_pUsbManger;
  47. FUNCVIDEOSTART mFuncVideoStart;
  48. FUNCVIDEOINFO mFuncVideoInfo;
  49. bool m_bInserted;
  50. char* m_pAddress;
  51. //连接上的状态
  52. bool m_bConnected;
  53. int m_idVendor;
  54. sem_t m_signalStart;
  55. Controller *m_controller;
  56. };
  57. #endif // MIRRORPLAYER_H