Phonon

experimental/mediasource.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
23#include "mediasource.h"
24#include "mediasource_p.h"
25
26#define S_D(Class) Class##Private *d = reinterpret_cast<Class##Private *>(Phonon::MediaSource::d.data())
27
28namespace Phonon
29{
30namespace Experimental
31{
32
33MediaSource::MediaSource(const MediaSource &rhs)
34 : Phonon::MediaSource(rhs)
35{
36}
37
38MediaSource::MediaSource(const QList<Phonon::MediaSource> &mediaList)
39 : Phonon::MediaSource(*new MediaSourcePrivate(Link))
40{
41 S_D(MediaSource);
42 d->linkedSources = mediaList;
43 foreach (const Phonon::MediaSource &ms, mediaList) {
44 Q_ASSERT(static_cast<MediaSource::Type>(ms.type()) != Link);
45 Q_UNUSED(ms);
46 }
47}
48
49#ifndef PHONON_NO_VIDEOCAPTURE
50MediaSource::MediaSource(const VideoCaptureDevice &videoDevice)
51 : Phonon::MediaSource(*new MediaSourcePrivate(VideoCaptureDeviceSource))
52{
53 Q_UNUSED(videoDevice);
54}
55#endif // PHONON_NO_VIDEOCAPTURE
56
57MediaSource &MediaSource::operator=(const MediaSource &rhs)
58{
59 d = rhs.d;
60 return *this;
61}
62
63bool MediaSource::operator==(const MediaSource &rhs) const
64{
65 return d == rhs.d;
66}
67
68#ifndef PHONON_NO_VIDEOCAPTURE
69VideoCaptureDevice MediaSource::videoCaptureDevice() const
70{
71 return phononVcdToExperimentalVcd(Phonon::MediaSource::videoCaptureDevice());
72}
73#endif // PHONON_NO_VIDEOCAPTURE
74
75QList<Phonon::MediaSource> MediaSource::substreams() const
76{
77 S_D(MediaSource);
78 return d->linkedSources;
79}
80
81} // namespace Experimental
82} // namespace Phonon
Note that all constructors of this class are implicit, so that you can simply write.
MediaSource()
Creates an empty MediaSource.
Type type() const
Returns the type of the MediaSource (depends on the constructor that was used).
VideoCaptureDevice videoCaptureDevice() const
Returns the video capture device for the media source if applicable.
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.