File indexing completed on 2024-05-05 04:44:41

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
0003 
0004     This program is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU General Public License as
0006     published by the Free Software Foundation; either version 2 of
0007     the License or (at your option) version 3 or any later version
0008     accepted by the membership of KDE e.V. (or its successor approved
0009     by the membership of KDE e.V.), Nokia Corporation (or its successors, 
0010     if any) and the KDE Free Qt Foundation, which shall act as a proxy 
0011     defined in Section 14 of version 3 of the license.
0012 
0013     This program 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
0016     GNU General Public License for more details.
0017 
0018     You should have received a copy of the GNU General Public License
0019     along with this program.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 */
0022 
0023 #include "mediasource.h"
0024 #include "mediasource_p.h"
0025 
0026 #define S_D(Class) Class##Private *d = reinterpret_cast<Class##Private *>(Phonon::MediaSource::d.data())
0027 
0028 namespace Phonon
0029 {
0030 namespace Experimental
0031 {
0032 
0033 MediaSource::MediaSource(const MediaSource &rhs)
0034     : Phonon::MediaSource(rhs)
0035 {
0036 }
0037 
0038 MediaSource::MediaSource(const QList<Phonon::MediaSource> &mediaList)
0039     : Phonon::MediaSource(*new MediaSourcePrivate(Link))
0040 {
0041     S_D(MediaSource);
0042     d->linkedSources = mediaList;
0043     foreach (const Phonon::MediaSource &ms, mediaList) {
0044         Q_ASSERT(static_cast<MediaSource::Type>(ms.type()) != Link);
0045         Q_UNUSED(ms);
0046     }
0047 }
0048 
0049 #ifndef PHONON_NO_VIDEOCAPTURE
0050 MediaSource::MediaSource(const VideoCaptureDevice &videoDevice)
0051     : Phonon::MediaSource(*new MediaSourcePrivate(VideoCaptureDeviceSource))
0052 {
0053     Q_UNUSED(videoDevice);
0054 }
0055 #endif // PHONON_NO_VIDEOCAPTURE
0056 
0057 MediaSource &MediaSource::operator=(const MediaSource &rhs)
0058 {
0059     d = rhs.d;
0060     return *this;
0061 }
0062 
0063 bool MediaSource::operator==(const MediaSource &rhs) const
0064 {
0065     return d == rhs.d;
0066 }
0067 
0068 #ifndef PHONON_NO_VIDEOCAPTURE
0069 VideoCaptureDevice MediaSource::videoCaptureDevice() const
0070 {
0071     return phononVcdToExperimentalVcd(Phonon::MediaSource::videoCaptureDevice());
0072 }
0073 #endif // PHONON_NO_VIDEOCAPTURE
0074 
0075 QList<Phonon::MediaSource> MediaSource::substreams() const
0076 {
0077     S_D(MediaSource);
0078     return d->linkedSources;
0079 }
0080 
0081 } // namespace Experimental
0082 } // namespace Phonon