Phonon

abstractvideodataoutput.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License or (at your option) version 3 or any later version
8 accepted by the membership of KDE e.V. (or its successor approved
9 by the membership of KDE e.V.), Nokia Corporation (or its successors,
10 if any) and the KDE Free Qt Foundation, which shall act as a proxy
11 defined in Section 14 of version 3 of the license.
12
13 This program 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
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21*/
22#include "abstractvideodataoutput.h"
23#include "abstractvideodataoutput_p.h"
24#include "videodataoutputinterface.h"
25#include "factory_p.h"
26
27namespace Phonon
28{
29namespace Experimental
30{
31
33 : AbstractVideoOutput(*new AbstractVideoDataOutputPrivate)
34{
36 d->isRunning = false;
37 d->allowedFormats << VideoFrame2::Format_RGB888;
38}
39
40AbstractVideoDataOutput::AbstractVideoDataOutput(AbstractVideoDataOutputPrivate &dd)
42{
43}
44
45AbstractVideoDataOutput::~AbstractVideoDataOutput()
46{
47 setRunning(false);
48}
49
51{
52 P_D(const AbstractVideoDataOutput);
53 return d->allowedFormats;
54}
55
57{
59 d->allowedFormats = allowedFormats;
60}
61
62bool AbstractVideoDataOutput::isRunning() const
63{
64 P_D(const AbstractVideoDataOutput);
65 return d->isRunning;
66}
67
68void AbstractVideoDataOutput::setRunning(bool running)
69{
71 d->isRunning = running;
72 Iface<VideoDataOutputInterface> iface(d);
73 if (iface) {
74 if (running) {
75 iface->setFrontendObject(this);
76 } else {
77 iface->setFrontendObject(nullptr);
78 }
79 }
80}
81
82void AbstractVideoDataOutput::start()
83{
84 setRunning(true);
85}
86
87void AbstractVideoDataOutput::stop()
88{
89 setRunning(false);
90}
91
92bool AbstractVideoDataOutputPrivate::aboutToDeleteBackendObject()
93{
94 return AbstractVideoOutputPrivate::aboutToDeleteBackendObject();
95}
96
97void AbstractVideoDataOutputPrivate::setupBackendObject()
98{
99 P_Q(AbstractVideoDataOutput);
100 Q_ASSERT(m_backendObject);
101 //AbstractVideoOutputPrivate::setupBackendObject();
102 if (isRunning) {
103 Iface<VideoDataOutputInterface> iface(this);
104 if (iface) {
105 iface->setFrontendObject(q);
106 }
107 }
108}
109
110void AbstractVideoDataOutputPrivate::createBackendObject()
111{
112 if (m_backendObject)
113 return;
114 //P_Q(AbstractVideoDataOutput);
115 m_backendObject = Factory::createVideoDataOutput(nullptr);
116 if (m_backendObject) {
117 setupBackendObject();
118 }
119}
120
121} // namespace Experimental
122} // namespace Phonon
Common base class for all video outputs.
virtual QSet< VideoFrame2::Format > allowedFormats() const
Lists the formats this output is allowed to pass via frameReady.
void setAllowedFormats(const QSet< VideoFrame2::Format > &)
Defaults to VideoFrame2::Format_RGB888.
AbstractVideoDataOutput()
Constructs an AbstractVideoDataOutput.
@ Format_RGB888
The frame is stored in data0 using a 24-bit RGB format (8-8-8).
Definition videoframe2.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:53:28 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.