File indexing completed on 2024-05-05 04:44:40
0001 /* This file is part of the KDE project 0002 Copyright (C) 2005-2006, 2008 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 #ifndef PHONON_EXPERIMENTAL_AVCAPTURE_H 0023 #define PHONON_EXPERIMENTAL_AVCAPTURE_H 0024 0025 #if defined(PHONON_NO_VIDEOCAPTURE) || defined(PHONON_NO_AUDIOCAPTURE) 0026 #define NO_PHONON_AVCAPTURE 0027 #endif 0028 0029 #ifndef NO_PHONON_AVCAPTURE 0030 0031 #include "export.h" 0032 #include "../medianode.h" 0033 #include "../phonondefs.h" 0034 #include "objectdescription.h" 0035 #include <phonon/phononnamespace.h> 0036 0037 #include <QStringList> 0038 class QString; 0039 0040 namespace Phonon 0041 { 0042 namespace Experimental 0043 { 0044 0045 class AvCapturePrivate; 0046 0047 /** 0048 * @short Media data from a soundcard, soundserver, camera or any other 0049 * hardware device supported by the backend. 0050 * 0051 * This class gives you access to the capture capabilities of the backend. 0052 * There might be more than only one possible capture source, for audio, as 0053 * well as for video. A preferable device may easily be obtained by providing 0054 * a capture category. 0055 * 0056 * @ingroup Recording 0057 * @author Matthias Kretz <kretz@kde.org> 0058 * @see BackendCapabilities::availableAudioCaptureDevices 0059 * @see BackendCapabilities::availableVideoCaptureDevices 0060 */ 0061 class PHONONEXPERIMENTAL_EXPORT AvCapture : public QObject, public Phonon::MediaNode 0062 { 0063 Q_OBJECT 0064 P_DECLARE_PRIVATE(AvCapture) 0065 PHONON_OBJECT(AvCapture) 0066 Q_PROPERTY(Phonon::AudioCaptureDevice audioCaptureDevice READ audioCaptureDevice WRITE setAudioCaptureDevice) 0067 Q_PROPERTY(Phonon::VideoCaptureDevice videoCaptureDevice READ videoCaptureDevice WRITE setVideoCaptureDevice) 0068 public: 0069 /** 0070 * Constructs an AvCapture with the devices preferred for the specified 0071 * capture category. 0072 * 0073 * @param category Used to determine what devices are most suited for 0074 * the AvCapture. 0075 * 0076 * @see CaptureCategory 0077 */ 0078 AvCapture(Phonon::CaptureCategory category, QObject *parent = nullptr); 0079 0080 /** 0081 * Returns the current state of the capture. 0082 * 0083 * @li If only the audio capture device is valid, it returns the audio capture state. 0084 * @li If only the video capture device is valid, it returns the video capture state. 0085 * @li If both the audio and video capture devices are valid, it only returns the 0086 * video capture state. 0087 */ 0088 State state() const; 0089 0090 /** 0091 * Returns the currently used capture source for the audio signal. 0092 */ 0093 Phonon::AudioCaptureDevice audioCaptureDevice() const; 0094 0095 /** 0096 * Returns the currently used capture source for the video signal. 0097 */ 0098 Phonon::VideoCaptureDevice videoCaptureDevice() const; 0099 0100 /** 0101 * Sets both the video and audio devices to the ones most suited for the 0102 * specified category 0103 * 0104 * @param category Used to determine what devices are most suited for 0105 * the AvCapture. 0106 */ 0107 void setCaptureDevices(Phonon::CaptureCategory category); 0108 0109 /** 0110 * Sets the audio capture source to use. 0111 * 0112 * @param source An object of class AudioCaptureDevice. 0113 * 0114 */ 0115 void setAudioCaptureDevice(const Phonon::AudioCaptureDevice &source); 0116 0117 /** 0118 * Sets the audio capture device by using a capture category to get 0119 * the appropriate device. 0120 * 0121 * @param category Capture category to use for getting a device 0122 */ 0123 void setAudioCaptureDevice(Phonon::CaptureCategory category); 0124 0125 PHONON_DEPRECATED void setAudioCaptureDevice(Phonon::Category category); 0126 0127 /** 0128 * Sets the video capture source to use. 0129 * 0130 * @param source An object of class VideoCaptureDevice. 0131 * 0132 * @see videoCaptureDevice 0133 * @see setVideoCaptureDevice(int) 0134 */ 0135 void setVideoCaptureDevice(const Phonon::VideoCaptureDevice &source); 0136 0137 /** 0138 * Sets the audio capture device by using a capture category to get 0139 * the appropriate device. 0140 * 0141 * @param category Capture category to use for getting a device 0142 */ 0143 void setVideoCaptureDevice(Phonon::CaptureCategory category); 0144 0145 PHONON_DEPRECATED void setVideoCaptureDevice(Phonon::Category category); 0146 0147 /** 0148 * @deprecated since 4.4.3, use 0149 * setVideoCaptureDevice(const Phonon::VideoCaptureDevice &source) instead 0150 */ 0151 PHONON_DEPRECATED void setVideoCaptureDevice(const Phonon::Experimental::VideoCaptureDevice &source); 0152 0153 public Q_SLOTS: 0154 /** 0155 * Start capture. 0156 */ 0157 void start(); 0158 0159 /** 0160 * Pause capture. 0161 */ 0162 void pause(); 0163 0164 /** 0165 * Stop capture. 0166 */ 0167 void stop(); 0168 0169 Q_SIGNALS: 0170 /** 0171 * Emitted when the state of the video or audio capture device has been changed. 0172 * 0173 * \li If only the audio capture device is valid, it notifies about the audio capture state. 0174 * \li If only the video capture device is valid, it notifies about the video capture state. 0175 * \li If both the audio and video capture devices are valid, it only notifies about the 0176 * video capture state. 0177 */ 0178 void stateChanged(Phonon::State newstate, Phonon::State oldstate); 0179 }; 0180 0181 } // namespace Experimental 0182 } // namespace Phonon 0183 0184 #endif // NO_PHONON_AVCAPTURE 0185 0186 #endif // PHONON_EXPERIMENTAL_AVCAPTURE_H