File indexing completed on 2024-05-05 04:44:39
0001 /* This file is part of the KDE project 0002 Copyright (C) 2011 Casian Andrei <skeletk13@gmail.com> 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 CAPTURE_H 0023 #define CAPTURE_H 0024 0025 #include <QWidget> 0026 #include <phonon/Global> 0027 0028 class QPushButton; 0029 0030 namespace Phonon { 0031 class AudioOutput; 0032 class MediaObject; 0033 class VideoWidget; 0034 } 0035 0036 /** 0037 * @brief Simple audio-video capture widget 0038 * 0039 * Can capture video using a media object. 0040 * 0041 * Using just a single media object, you can't capture audio and video 0042 * at the same time, if the desired device knows only audio or only video. 0043 * 0044 * @note Phonon capture is still not stabilised, don't be surprised if audio 0045 * capture fails to work. The functionality also depends on the backend. 0046 * 0047 * @see Phonon::MediaObject 0048 * @see Phonon::MediaSource 0049 */ 0050 class CaptureWidget : public QWidget 0051 { 0052 Q_OBJECT 0053 0054 public: 0055 /** 0056 * @brief Capture widget constructor 0057 * 0058 * Sets up the GUI and Phonon objects. 0059 * Sets up the capture source and starts the capture. 0060 * 0061 * @see setupCaptureSource 0062 */ 0063 CaptureWidget(QWidget *parent = NULL, Qt::WindowFlags f = Qt::Widget); 0064 0065 private slots: 0066 /** 0067 * @brief Updates the GUI when the underlying MediaObject changes states 0068 * 0069 * Changes the caption of the play / pause button, depending on the state. 0070 * Enables or disables the stop button. 0071 */ 0072 void mediaStateChanged(Phonon::State newState); 0073 0074 /** 0075 * @brief Plays or pauses the media, depending on current state 0076 */ 0077 void playPause(); 0078 0079 private: 0080 Phonon::AudioOutput *m_audioOutput; 0081 Phonon::VideoWidget *m_videoWidget; 0082 Phonon::MediaObject *m_media; // Media object for capture 0083 QPushButton *m_playButton; 0084 QPushButton *m_stopButton; 0085 }; 0086 0087 #endif // CAPTURE_H