File indexing completed on 2024-04-21 04:43:17

0001 /*  This file is part of the KDE project
0002     Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or
0005     modify it under the terms of the GNU Lesser General Public
0006     License as published by the Free Software Foundation; either
0007     version 2.1 of the License, or (at your option) version 3, or any
0008     later version accepted by the membership of KDE e.V. (or its
0009     successor approved by the membership of KDE e.V.), Nokia Corporation
0010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
0011     act as a proxy defined in Section 6 of version 3 of the license.
0012 
0013     This library 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 GNU
0016     Lesser General Public License for more details.
0017 
0018     You should have received a copy of the GNU Lesser General Public
0019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0020 
0021 */
0022 
0023 #ifndef MEDIASOURCE_P_H
0024 #define MEDIASOURCE_P_H
0025 
0026 #include "mediasource.h"
0027 #include "abstractmediastream.h"
0028 #include "objectdescription.h"
0029 #include "mrl.h"
0030 
0031 #include <QUrl>
0032 #include <QString>
0033 #include <QSharedData>
0034 #include <QPointer>
0035 
0036 class QFile;
0037 
0038 namespace Phonon
0039 {
0040 
0041 class PHONON_EXPORT MediaSourcePrivate : public QSharedData
0042 {
0043     public:
0044         MediaSourcePrivate(MediaSource::Type t)
0045             : type(t), discType(NoDisc),
0046 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0047             stream(nullptr),
0048             ioDevice(nullptr),
0049 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
0050             autoDelete(false)
0051         {
0052         }
0053 
0054         virtual ~MediaSourcePrivate();
0055 
0056 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0057         void setStream(AbstractMediaStream *s);
0058 #endif
0059 
0060         MediaSource::Type type;
0061         Mrl url;
0062         Phonon::DiscType discType;
0063         QString deviceName;                         // Used for discs
0064         Phonon::DeviceAccessList audioDeviceAccessList;
0065         Phonon::DeviceAccessList videoDeviceAccessList;
0066 
0067 #ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
0068         // The AbstractMediaStream(2) may be deleted at any time by the application. If that happens
0069         // stream will be 0 automatically, but streamEventQueue will stay valid as we hold a
0070         // reference to it. This is necessary to avoid a races when setting the MediaSource while
0071         // another thread deletes the AbstractMediaStream2. StreamInterface(2) will then just get a
0072         // StreamEventQueue where nobody answers.
0073         QPointer<AbstractMediaStream> stream;
0074         QIODevice *ioDevice;
0075 #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
0076 
0077 #if !defined(PHONON_NO_VIDEOCAPTURE) && !defined(PHONON_NO_AUDIOCAPTURE)
0078         void setCaptureDevice(Capture::DeviceType deviceType, CaptureCategory category);
0079         void setCaptureDevices(CaptureCategory category);
0080         void setCaptureDevices(const AudioCaptureDevice &audioDevice, const VideoCaptureDevice &videoDevice);
0081 #endif // !PHONON_NO_VIDEOCAPTURE && !PHONON_NO_AUDIOCAPTURE
0082 
0083 #ifndef PHONON_NO_AUDIOCAPTURE
0084         AudioCaptureDevice audioCaptureDevice;
0085 #endif
0086 
0087 #ifndef PHONON_NO_VIDEOCAPTURE
0088         VideoCaptureDevice videoCaptureDevice;
0089 #endif
0090 
0091         //QList<MediaSource> linkedSources;
0092         bool autoDelete;
0093 };
0094 
0095 } // namespace Phonon
0096 
0097 #endif // MEDIASOURCE_P_H
0098 // vim: sw=4 sts=4 et tw=100
0099 
0100