File indexing completed on 2024-05-05 04:44:40
0001 /* This file is part of the KDE project 0002 Copyright (C) 2005-2008 Matthias Kretz <kretz@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Lesser General Public 0006 License as published by the Free Software Foundation; either 0007 version 2.1 of the License, or (at your option) version 3, or any 0008 later version accepted by the membership of KDE e.V. (or its 0009 successor approved by the membership of KDE e.V.), Nokia Corporation 0010 (or its successors, if any) and the KDE Free Qt Foundation, which shall 0011 act as a proxy defined in Section 6 of version 3 of the license. 0012 0013 This library is distributed in the hope that it will be useful, 0014 but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 Lesser General Public License for more details. 0017 0018 You should have received a copy of the GNU Lesser General Public 0019 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0020 0021 */ 0022 0023 #ifndef PHONON_X_ABSTRACTVIDEODATAOUTPUT_H 0024 #define PHONON_X_ABSTRACTVIDEODATAOUTPUT_H 0025 0026 #include "export.h" 0027 #include "../abstractvideooutput.h" 0028 #include "../phonondefs.h" 0029 #include <QObject> 0030 #include "videoframe2.h" 0031 0032 #ifndef DOXYGEN_SHOULD_SKIP_THIS 0033 template<typename T> class QSet; 0034 #endif 0035 0036 namespace Phonon 0037 { 0038 namespace Experimental 0039 { 0040 0041 class AbstractVideoDataOutputPrivate; 0042 0043 /** 0044 * \short This class gives you the video data. 0045 * 0046 * This class implements a special AbstractVideoOutput that gives your 0047 * application the video data. 0048 * 0049 * You can also use the video data for further processing (e.g. encoding and 0050 * saving to a file). 0051 * 0052 * \author Matthias Kretz <kretz@kde.org> 0053 * 0054 * \see VideoDataOutput2 0055 */ 0056 class PHONONEXPERIMENTAL_EXPORT AbstractVideoDataOutput : public AbstractVideoOutput 0057 { 0058 P_DECLARE_PRIVATE(AbstractVideoDataOutput) 0059 0060 public: 0061 /** 0062 * Constructs an AbstractVideoDataOutput 0063 */ 0064 AbstractVideoDataOutput(); 0065 ~AbstractVideoDataOutput() override; 0066 0067 /** 0068 * Lists the formats this output is allowed to pass via frameReady. 0069 */ 0070 virtual QSet<VideoFrame2::Format> allowedFormats() const; 0071 0072 // TODO: consider to remove the following function and make the above pure virtual 0073 /** 0074 * Defaults to VideoFrame2::Format_RGB888. 0075 */ 0076 void setAllowedFormats(const QSet<VideoFrame2::Format> &); 0077 0078 bool isRunning() const; 0079 0080 /** 0081 * This function is called whenever a frame should be displayed. 0082 * 0083 * \warning frameReady can get called from any thread (other than the 0084 * main thread or the thread affinity of this QObject). A common error to create a deadlock 0085 * situation is to block the thread this function is called from, until the main thread 0086 * has found time to handle the frame. If it is blocking while the main thread decides to 0087 * stop/delete the MediaObject you might get a deadlock. 0088 */ 0089 virtual void frameReady(const VideoFrame2 &) = 0; 0090 0091 /** 0092 * This function is called after the last frameReady of a MediaObject was called. 0093 */ 0094 virtual void endOfMedia() = 0; 0095 0096 void setRunning(bool running); 0097 void start(); 0098 void stop(); 0099 0100 protected: 0101 AbstractVideoDataOutput(AbstractVideoDataOutputPrivate &dd); 0102 }; 0103 0104 } // namespace Experimental 0105 } //namespace Phonon 0106 0107 #endif // PHONON_X_ABSTRACTVIDEODATAOUTPUT_H