Phonon

abstractvideodataoutput.h
1/* This file is part of the KDE project
2 Copyright (C) 2005-2008 Matthias Kretz <kretz@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) version 3, or any
8 later version accepted by the membership of KDE e.V. (or its
9 successor approved by the membership of KDE e.V.), Nokia Corporation
10 (or its successors, if any) and the KDE Free Qt Foundation, which shall
11 act as a proxy defined in Section 6 of version 3 of the license.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library. If not, see <http://www.gnu.org/licenses/>.
20
21*/
22
23#ifndef PHONON_X_ABSTRACTVIDEODATAOUTPUT_H
24#define PHONON_X_ABSTRACTVIDEODATAOUTPUT_H
25
26#include "export.h"
27#include "../abstractvideooutput.h"
28#include "../phonondefs.h"
29#include <QObject>
30#include "videoframe2.h"
31
32#ifndef K_DOXYGEN
33template<typename T> class QSet;
34#endif
35
36namespace Phonon
37{
38namespace Experimental
39{
40
41class AbstractVideoDataOutputPrivate;
42
43/**
44 * \short This class gives you the video data.
45 *
46 * This class implements a special AbstractVideoOutput that gives your
47 * application the video data.
48 *
49 * You can also use the video data for further processing (e.g. encoding and
50 * saving to a file).
51 *
52 * \author Matthias Kretz <kretz@kde.org>
53 *
54 * \see VideoDataOutput2
55 */
56class PHONONEXPERIMENTAL_EXPORT AbstractVideoDataOutput : public AbstractVideoOutput
57{
58 P_DECLARE_PRIVATE(AbstractVideoDataOutput)
59
60 public:
61 /**
62 * Constructs an AbstractVideoDataOutput
63 */
65 ~AbstractVideoDataOutput() override;
66
67 /**
68 * Lists the formats this output is allowed to pass via frameReady.
69 */
70 virtual QSet<VideoFrame2::Format> allowedFormats() const;
71
72 // TODO: consider to remove the following function and make the above pure virtual
73 /**
74 * Defaults to VideoFrame2::Format_RGB888.
75 */
76 void setAllowedFormats(const QSet<VideoFrame2::Format> &);
77
78 bool isRunning() const;
79
80 /**
81 * This function is called whenever a frame should be displayed.
82 *
83 * \warning frameReady can get called from any thread (other than the
84 * main thread or the thread affinity of this QObject). A common error to create a deadlock
85 * situation is to block the thread this function is called from, until the main thread
86 * has found time to handle the frame. If it is blocking while the main thread decides to
87 * stop/delete the MediaObject you might get a deadlock.
88 */
89 virtual void frameReady(const VideoFrame2 &) = 0;
90
91 /**
92 * This function is called after the last frameReady of a MediaObject was called.
93 */
94 virtual void endOfMedia() = 0;
95
96 void setRunning(bool running);
97 void start();
98 void stop();
99
100 protected:
101 AbstractVideoDataOutput(AbstractVideoDataOutputPrivate &dd);
102};
103
104} // namespace Experimental
105} //namespace Phonon
106
107#endif // PHONON_X_ABSTRACTVIDEODATAOUTPUT_H
Common base class for all video outputs.
virtual void frameReady(const VideoFrame2 &)=0
This function is called whenever a frame should be displayed.
virtual void endOfMedia()=0
This function is called after the last frameReady of a MediaObject was called.
void stop(Ekos::AlignState mode)
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.