| 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 | |
| 28 | namespace Phonon |
| 29 | { |
| 30 | namespace Experimental |
| 31 | { |
| 32 | |
| 33 | MediaSource::MediaSource(const MediaSource &rhs) |
| 34 | : Phonon::MediaSource(rhs) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | MediaSource::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 |
| 50 | MediaSource::MediaSource(const VideoCaptureDevice &videoDevice) |
| 51 | : Phonon::MediaSource(*new MediaSourcePrivate(VideoCaptureDeviceSource)) |
| 52 | { |
| 53 | Q_UNUSED(videoDevice); |
| 54 | } |
| 55 | #endif // PHONON_NO_VIDEOCAPTURE |
| 56 | |
| 57 | MediaSource &MediaSource::operator=(const MediaSource &rhs) |
| 58 | { |
| 59 | d = rhs.d; |
| 60 | return *this; |
| 61 | } |
| 62 | |
| 63 | bool MediaSource::operator==(const MediaSource &rhs) const |
| 64 | { |
| 65 | return d == rhs.d; |
| 66 | } |
| 67 | |
| 68 | #ifndef PHONON_NO_VIDEOCAPTURE |
| 69 | VideoCaptureDevice MediaSource::videoCaptureDevice() const |
| 70 | { |
| 71 | return phononVcdToExperimentalVcd(vcd: Phonon::MediaSource::videoCaptureDevice()); |
| 72 | } |
| 73 | #endif // PHONON_NO_VIDEOCAPTURE |
| 74 | |
| 75 | QList<Phonon::MediaSource> MediaSource::substreams() const |
| 76 | { |
| 77 | S_D(MediaSource); |
| 78 | return d->linkedSources; |
| 79 | } |
| 80 | |
| 81 | } // namespace Experimental |
| 82 | } // namespace Phonon |
| 83 |
