Warning, file /system/mycroft-gui/import/mediaproviders/videoproviderservice.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright 2023 by Aditya Mehra <aix.m@outlook.com> 0003 * 0004 * Licensed under the Apache License, Version 2.0 (the "License"); 0005 * you may not use this file except in compliance with the License. 0006 * You may obtain a copy of the License at 0007 * 0008 * http://www.apache.org/licenses/LICENSE-2.0 0009 * 0010 * Unless required by applicable law or agreed to in writing, software 0011 * distributed under the License is distributed on an "AS IS" BASIS, 0012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0013 * See the License for the specific language governing permissions and 0014 * limitations under the License. 0015 * 0016 */ 0017 0018 #ifndef VIDEOPROVIDERSERVICE_H 0019 #define VIDEOPROVIDERSERVICE_H 0020 0021 #include <QObject> 0022 #include <QUrl> 0023 #include <QMediaPlayer> 0024 #include <QMediaDevices> 0025 #include <QAudioOutput> 0026 #include <QAudioDevice> 0027 #include <QVideoSink> 0028 #include <QAudioFormat> 0029 0030 0031 class VideoProviderService : public QObject 0032 { 0033 Q_OBJECT 0034 0035 public: 0036 enum PlaybackState { 0037 PlayingState = 1, 0038 PausedState = 2, 0039 StoppedState = 0 0040 }; 0041 0042 enum MediaState { 0043 NoMedia = 0, 0044 LoadingMedia = 1, 0045 LoadedMedia = 2, 0046 StalledMedia = 3, 0047 BufferingMedia = 4, 0048 BufferedMedia = 5, 0049 EndOfMedia = 6, 0050 InvalidMedia = 7 0051 }; 0052 0053 explicit VideoProviderService(QObject *parent = nullptr); 0054 ~VideoProviderService(); 0055 void syncStates(); 0056 void mediaPlay(const QUrl &url); 0057 void mediaStop(); 0058 void mediaPause(); 0059 void mediaContinue(); 0060 void mediaRestart(); 0061 void mediaSeek(qint64 seekValue); 0062 QVideoSink *videoSink() const; 0063 QObject *videoOutput() const; 0064 void setVideoSink(QVideoSink *videoSink); 0065 void setVideoOutput(QObject *videoOutput); 0066 0067 0068 public Q_SLOTS: 0069 void updatePlaybackState(QMediaPlayer::PlaybackState state); 0070 void updateMediaState(QMediaPlayer::MediaStatus status); 0071 void durationUpdated(qint64 duration); 0072 void positionUpdated(qint64 position); 0073 void errorOccurred(QMediaPlayer::Error error); 0074 0075 signals: 0076 void signalVideoSinkChanged(); 0077 void signalVideoOutputChanged(); 0078 0079 Q_SIGNALS: 0080 void playBackStateChanged(VideoProviderService::PlaybackState playbackState); 0081 void mediaStateChanged(VideoProviderService::MediaState mediaState); 0082 void positionChanged(qint64 position); 0083 void durationChanged(qint64 duration); 0084 void destroyedService(); 0085 0086 private: 0087 VideoProviderService::PlaybackState m_currentPlaybackState; 0088 VideoProviderService::MediaState m_currentMediaState; 0089 QVideoSink *m_videoSink; 0090 QObject *m_videoOutput; 0091 QMediaPlayer *m_mediaPlayer; 0092 QAudioOutput *m_audioOutput; 0093 QUrl m_currentMediaUrl; 0094 QAudioFormat m_format; 0095 }; 0096 0097 #endif //AUDIOPROVIDERSERVICE_H