src/3rdparty/phonon/gstreamer/devicemanager.h
changeset 0 1918ee327afb
child 30 5dc02b23752f
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /*  This file is part of the KDE project.
       
     2 
       
     3     Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 
       
     5     This library is free software: you can redistribute it and/or modify
       
     6     it under the terms of the GNU Lesser General Public License as published by
       
     7     the Free Software Foundation, either version 2.1 or 3 of the License.
       
     8 
       
     9     This library is distributed in the hope that it will be useful,
       
    10     but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12     GNU Lesser General Public License for more details.
       
    13 
       
    14     You should have received a copy of the GNU Lesser General Public License
       
    15     along with this library.  If not, see <http://www.gnu.org/licenses/>.
       
    16 */
       
    17 
       
    18 #ifndef Phonon_GSTREAMER_DEVICEMANAGER_H
       
    19 #define Phonon_GSTREAMER_DEVICEMANAGER_H
       
    20 
       
    21 #include "common.h"
       
    22 
       
    23 #include <phonon/audiooutputinterface.h>
       
    24 
       
    25 #include <QtCore/QObject>
       
    26 #include <QtCore/QTimer>
       
    27 
       
    28 #include <gst/gst.h>
       
    29 
       
    30 QT_BEGIN_NAMESPACE
       
    31 
       
    32 namespace Phonon {
       
    33 namespace Gstreamer {
       
    34 class Backend;
       
    35 class DeviceManager;
       
    36 class AbstractRenderer;
       
    37 class VideoWidget;
       
    38 
       
    39 class AudioDevice {
       
    40 public :
       
    41     AudioDevice(DeviceManager *s, const QByteArray &deviceId);
       
    42     int id;
       
    43     QByteArray gstId;
       
    44     QByteArray description;
       
    45 };
       
    46 
       
    47 class DeviceManager : public QObject {
       
    48     Q_OBJECT
       
    49 public:
       
    50     DeviceManager(Backend *parent);
       
    51     virtual ~DeviceManager();
       
    52     const QList<AudioDevice> audioOutputDevices() const;
       
    53     GstPad *requestPad(int device) const;
       
    54     int deviceId(const QByteArray &gstId) const;
       
    55     QByteArray deviceDescription(int id) const;
       
    56     GstElement *createGNOMEAudioSink(Category category);
       
    57     GstElement *createAudioSink(Category category = NoCategory);
       
    58     AbstractRenderer *createVideoRenderer(VideoWidget *parent);
       
    59 
       
    60 signals:
       
    61     void deviceAdded(int);
       
    62     void deviceRemoved(int);
       
    63 
       
    64 public slots:
       
    65     void updateDeviceList();
       
    66 
       
    67 private:
       
    68     bool canOpenDevice(GstElement *element) const;
       
    69     Backend *m_backend;
       
    70     QList <AudioDevice> m_audioDeviceList;
       
    71     QTimer m_devicePollTimer;
       
    72     QByteArray m_audioSink;
       
    73     QByteArray m_videoSinkWidget;
       
    74 };
       
    75 }
       
    76 } // namespace Phonon::Gstreamer
       
    77 
       
    78 QT_END_NAMESPACE
       
    79 
       
    80 #endif // Phonon_GSTREAMER_DEVICEMANAGER_H