Multimedia.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef MULTIMEDIA_H
  2. #define MULTIMEDIA_H
  3. #include "MultimediaService.h"
  4. #include "BusinessLogic/Audio.h"
  5. #include <QObject>
  6. #include <QScopedPointer>
  7. enum MusicPlayType{
  8. M_Undefile=-1,
  9. M_UsbMusic,
  10. M_SdMusic,
  11. M_BtMusic,
  12. };
  13. class MultimediaPrivate;
  14. class Multimedia
  15. : public QObject
  16. {
  17. Q_OBJECT
  18. Q_DISABLE_COPY(Multimedia)
  19. #ifdef g_Multimedia
  20. #undef g_Multimedia
  21. #endif
  22. #define g_Multimedia (Multimedia::instance())
  23. public:
  24. inline static Multimedia* instance() {
  25. static Multimedia* multimedia(new Multimedia(qApp));
  26. return multimedia;
  27. }
  28. enum Status {
  29. S_Undefine = -1,
  30. S_Start,
  31. S_Stop,
  32. };
  33. enum ImageFocus {
  34. F_Undefine = -1,
  35. F_ImageSDFocus,
  36. F_ImageUSBFocus,
  37. F_ImageUnfocus,
  38. };
  39. void startMultimedia();
  40. void setImageFocus(const Multimedia::ImageFocus focus);
  41. void reset();
  42. void musicPlayerSetPlayModeToggle();
  43. void musicPlayerSetPlayMode(const int mode);
  44. void musicPlayerSetPlayStatusToggle();
  45. void musicPlayerSetPlayStatus(const int status);
  46. void musicPlayerPlayListViewIndex(const int type, const int index, const int millesimal);
  47. void musicPlayerPlayPreviousListViewIndex();
  48. void musicPlayerPlayNextListViewIndex();
  49. void musicPlayerSeekToMillesimal(const int millesimal);
  50. void musicPlayerExit();
  51. void imagePlayerPlayListViewIndex(const int type, const int index);
  52. void imagePlayerPlayPreviousListViewIndex();
  53. void imagePlayerPlayNextListViewIndex();
  54. void imagePlayerRotateImage();
  55. void imagePlayerZoomInImage();
  56. void imagePlayerZoomOutImage();
  57. void videoPlayerSetPlayModeToggle();
  58. void videoPlayerSetPlayStatusToggle();
  59. void videoPlayerSetPlayStatus(const int status);
  60. void videoPlayerPlayListViewIndex(const int type, const int index, const int x, const int y, const int width, const int height, const int millesimal) ;
  61. void videoPlayerPlayPreviousListViewIndex();
  62. void videoPlayerPlayNextListViewIndex();
  63. void videoPlayerSeekToMillesimal(const int millesimal);
  64. void videoPlayerExit();
  65. void videoPlayerVisible(const bool flag);
  66. void videoPlayerSetPlayMode(const int mode);
  67. void videoPlayerSetGeometry(int x,int y,int width,int height);
  68. void writeCmdToMplayer(QString cmd);
  69. Multimedia::ImageFocus getImageFocus();
  70. DeviceWatcherStatus getDeviceStatus(const DeviceWatcherType type);
  71. DeviceWatcherType getDeviceActiveType();
  72. bool musicListEmpty(const DeviceWatcherType type);
  73. bool imageListEmpty(const DeviceWatcherType type);
  74. bool videoListEmpty(const DeviceWatcherType type);
  75. signals:
  76. void onMultimediaChange(const Multimedia::Status status);
  77. void onDeviceWatcherStatus(const int type, const int status);
  78. void onMusicPlayerPlayMode(const int mode);
  79. void onMusicPlayerPlayStatus(const int type, const int status);
  80. void onMusicPlayerElapsedInformation(const int elapsedTime,
  81. const int elapsedMillesimal);
  82. void onMusicPlayerID3TagChange(const int type,
  83. const int index,
  84. const QString &fileName,
  85. const QString& title,
  86. const QString& artist,
  87. const QString& album,
  88. const int endTime);
  89. void onMusicPlayerFileNames(const int type, const QString &xml);
  90. void onImagePlayerFileNames(const int type, const QString &xml);
  91. void onImagePlayerPlayStatus(const int type, const int status);
  92. void onImagePlayerChange(const int type, const QString &filePath, const int index, const int percent, const int rotate);
  93. void onVideoPlayerPlayMode(const int mode);
  94. void onVideoPlayerShowStatus(const int status);
  95. void onVideoPlayerPlayStatus(const int type, const int status);
  96. void onVideoPlayerFileNames(const int type, const QString& xml);
  97. void onVideoPlayerInformation(const int type, const int index, const QString &fileName, const int endTime);
  98. void onVideoPlayerElapsedInformation(const int elapsedTime, const int elapsedMillesimal);
  99. void onVideoPlayerVisible(const bool flag);
  100. void onSliderTouchEnable(const bool flag); //dll add 20190805
  101. void onMusicPlayerFileArtist(const int type, QStringList artistList);
  102. void onMusicPlayerExit();
  103. void onVideoPlayerExit();
  104. private slots:
  105. void onDeviceWatcherStatusHandler(const int type, const int status);
  106. void onMusicPlayerFileNamesHandler(const int type, const QString &xml);
  107. void onImagePlayerFileNamesHandler(const int type, const QString &xml);
  108. void onVideoPlayerFileNamesHandler(const int type, const QString& xml);
  109. void onMusicPlayerPlayStatusHandler(const int type, const int status);
  110. void onImagePlayerChangeHandler(const int type, const QString &filePath, const int index, const int percent, const int rotate);
  111. void onVideoPlayerPlayStatusHandler(const int type, const int status);
  112. void onHolderChange(const int oldHolder, const int newHolder);
  113. void onTimeout();
  114. private:
  115. explicit Multimedia(QObject* parent = NULL);
  116. ~Multimedia();
  117. void initializePrivate();
  118. friend class MultimediaPrivate;
  119. QScopedPointer<MultimediaPrivate> m_Private;
  120. };
  121. #endif // MULTIMEDIA_H