Phonon

abstractaudiodataoutput.cpp
1/* This file is part of the KDE project
2 Copyright (C) 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#include "abstractaudiodataoutput.h"
24#include "abstractaudiodataoutput_p.h"
25#include "audiodataoutputinterface.h"
26#include "factory_p.h"
27#include "../phonondefs_p.h"
28
29namespace Phonon
30{
31namespace Experimental
32{
33
35 : MediaNode(*new AbstractAudioDataOutputPrivate)
36{
38 d->isRunning = false;
39 d->allowedFormats << AudioFormat();
40}
41
42AbstractAudioDataOutput::~AbstractAudioDataOutput()
43{
44 setRunning(false);
45}
46
48{
49 P_D(const AbstractAudioDataOutput);
50 return d->allowedFormats;
51}
52
54{
56 d->allowedFormats = allowedFormats;
57}
58
59bool AbstractAudioDataOutput::isRunning() const
60{
61 P_D(const AbstractAudioDataOutput);
62 return d->isRunning;
63}
64
65void AbstractAudioDataOutput::setRunning(bool running)
66{
68 Iface<AudioDataOutputInterface> iface(d);
69 if (iface) {
70 if (running) {
71 iface->setFrontendObject(this);
72 } else {
73 iface->setFrontendObject(nullptr);
74 }
75 }
76}
77
78void AbstractAudioDataOutput::start()
79{
80 setRunning(true);
81}
82
83void AbstractAudioDataOutput::stop()
84{
85 setRunning(false);
86}
87
88void AbstractAudioDataOutputPrivate::setupBackendObject()
89{
90 P_Q(AbstractAudioDataOutput);
91 Q_ASSERT(m_backendObject);
92 //AbstractAudioOutputPrivate::setupBackendObject();
93 if (isRunning) {
94 Iface<AudioDataOutputInterface> iface(this);
95 if (iface) {
96 iface->setFrontendObject(q);
97 }
98 }
99}
100
101void AbstractAudioDataOutputPrivate::createBackendObject()
102{
103 if (m_backendObject)
104 return;
105 //P_Q(AbstractAudioDataOutput);
106 m_backendObject = Factory::createAudioDataOutput(nullptr);
107 if (m_backendObject) {
108 setupBackendObject();
109 }
110}
111
112} // namespace Experimental
113} // namespace Phonon
void setAllowedFormats(const QSet< AudioFormat > &)
Defaults to AudioFormat().
AbstractAudioDataOutput()
Constructs an AbstractAudioDataOutput.
virtual QSet< AudioFormat > allowedFormats() const
Lists the formats this output is allowed to pass via frameReady.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.