// Copyright: 2021, Laseranimation Sollinger, Berlin, all rights reserved #pragma once #include #include #include #include #include #include class VideoServerWindow; /** * This class encapsulates the QMediaPlayer * plus all the assorted infrastructure like * window, widgets and the like. * * This object MUST live in the main thread and * be instantiated ASAP, especially before the * code in QtMediaInterfaceImpl attempts to access * the static instance. */ class QMediaPlayerController : public QObject { Q_OBJECT public: QMediaPlayerController(); QMediaPlayer* player(); public Q_SLOTS: /** * Before the VideoPlayer can be used in a meaningful * way, it *must* have an QVideoWidget instance that * is active. This seems to be a limitation of Qt. * Because we de-activate the widget in between to * show the Audio-Only-Message, this call restores * the necessary pre-condition. */ void prepareVideoPlayer(); private: QMediaPlayer mMediaPlayer; QAudioOutput mAudioOutput; VideoServerWindow* mVideoWindow; QVideoWidget* mVideoWidget; QLabel* mAudioOnlyWidget; bool mNeedsNewVideoWidget; };