VideoPlayer.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef VIDEOPLAYER_H
  2. #define VIDEOPLAYER_H
  3. #include "DeviceWatcher/DeviceWatcher.h"
  4. #include <QObject>
  5. #include <QProcess>
  6. #include <QScopedPointer>
  7. class VideoPlayerPrivate;
  8. class VideoPlayer : public QObject
  9. {
  10. Q_OBJECT
  11. Q_DISABLE_COPY(VideoPlayer)
  12. #ifdef g_VideoPlayer
  13. #undef g_VideoPlayer
  14. #endif
  15. #define g_VideoPlayer (VideoPlayer::instance())
  16. public:
  17. inline static VideoPlayer* instance() {
  18. static VideoPlayer* videoPlayer(new VideoPlayer(qApp));
  19. return videoPlayer;
  20. }
  21. void videoPlayerRequestFileNames(const int type);
  22. void videoPlayerSetPlayModeToggle();
  23. void videoPlayerSetPlayMode(const int mode);
  24. void videoPlayerSetPlayStatusToggle();
  25. void videoPlayerSetPlayStatus(const int status);
  26. void videoPlayerPlayListViewIndex(const int type, const int index, const int x, const int y, const int width, const int height, const int millesimal);
  27. void videoPlayerPlayPreviousListViewIndex();
  28. void videoPlayerPlayNextListViewIndex();
  29. void videoPlayerSeekToMillesimal(const int millesimal);
  30. void videoPlayerExit();
  31. void videoPlayerVisible(const bool flag);
  32. signals:
  33. void onVideoPlayerPlayMode(const int mode);
  34. void onVideoPlayerShowStatus(const int status);
  35. void onVideoPlayerPlayStatus(const int type, const int status);
  36. void onVideoPlayerFileNames(const int type, const QString &xml);
  37. // void onVideoPlayerFilePath(const int type, const QString& path);
  38. void onVideoPlayerInformation(const int type, const int index, const QString &fileName, const int endTime);
  39. void onVideoPlayerElapsedInformation(const int elapsedTime, const int elapsedMillesimal);
  40. void onVideoPlayerVisible(const bool flag);
  41. void onSliderTouchEnable(const bool flag); //dll add 20190805
  42. protected slots:
  43. void onDeviceWatcherStatus(const int type, const int status);
  44. void onVideoFilePath(const QString &path, const int type);
  45. private slots:
  46. void onTimeout();
  47. void onReadyReadStandardOutput();
  48. void onReadyReadStandardError();
  49. void onStarted();
  50. void onFinished(int exitCode, QProcess::ExitStatus exitStatus);
  51. void onError(QProcess::ProcessError error);
  52. void onStateChanged(QProcess::ProcessState state);
  53. private:
  54. explicit VideoPlayer(QObject* parent = NULL);
  55. ~VideoPlayer();
  56. void quitHanlder(const QString& output);
  57. friend class VideoPlayerPrivate;
  58. QScopedPointer<VideoPlayerPrivate> m_Private;
  59. };
  60. #endif // VIDEOPLAYER_H