uvcvideodevicecontrol.h 957 Bytes
Newer Older
Thiago Santini's avatar
Thiago Santini committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#ifndef UVCVIDEODEVICECONTROL_H
#define UVCVIDEODEVICECONTROL_H

#include <QVideoDeviceSelectorControl>
#include <QStringList>
#include <QElapsedTimer>
#include <QDebug>

#include "uvccamerasession.h"

#include "libuvc/libuvc.h"

QT_BEGIN_NAMESPACE

typedef QPair<QByteArray, QString> UVCVideoDeviceInfo;

class UVCVideoDeviceControl : public QVideoDeviceSelectorControl
{
    Q_OBJECT
public:
    UVCVideoDeviceControl(QObject *parent = 0);
    ~UVCVideoDeviceControl();

    int deviceCount() const;
    QString deviceName(int index) const;
    QString deviceDescription(int index) const;
    int defaultDevice() const;
    int selectedDevice() const;

    static const QList<UVCVideoDeviceInfo> &availableDevices();

public Q_SLOTS:
    void setSelectedDevice(int index);

private:
    static void updateDevices();

    UVCCameraSession* m_session;
    int selected;
    static uvc_context_t* ctx;
};

QT_END_NAMESPACE

#endif // UVCVIDEODEVICECONTROL_H