diff options
| -rw-r--r-- | Makefile.am | 6 | ||||
| -rw-r--r-- | pica-client/audiodevice.cpp | 16 | ||||
| -rw-r--r-- | pica-client/audiodevice.h | 14 | ||||
| -rw-r--r-- | pica-client/mediadevice.cpp | 12 | ||||
| -rw-r--r-- | pica-client/mediadevice.h | 22 | ||||
| -rw-r--r-- | pica-client/pica-client.pro | 10 | ||||
| -rw-r--r-- | pica-client/videodevice.cpp | 40 | ||||
| -rw-r--r-- | pica-client/videodevice.h | 14 |
8 files changed, 132 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am index 6edec67..c07f396 100644 --- a/Makefile.am +++ b/Makefile.am @@ -93,6 +93,12 @@ pica-client/sound.cpp \ pica-client/sound.h \ pica-client/settings.cpp \ pica-client/settings.h \ +pica-client/mediadevice.cpp \ +pica-client/mediadevice.h \ +pica-client/audiodevice.cpp \ +pica-client/audiodevice.h \ +pica-client/videodevice.cpp \ +pica-client/videodevice.h \ \ pica-client/dialogs/addaccountdialog.cpp \ pica-client/dialogs/addaccountdialog.h \ diff --git a/pica-client/audiodevice.cpp b/pica-client/audiodevice.cpp new file mode 100644 index 0000000..16bf0b1 --- /dev/null +++ b/pica-client/audiodevice.cpp @@ -0,0 +1,16 @@ +#include "audiodevice.h" + +AudioDevice::AudioDevice() +{ + +} + +AudioDevice::~AudioDevice() +{ + +} + +QList<MediaDeviceInfo> AudioDevice::Enumerate() +{ + +} diff --git a/pica-client/audiodevice.h b/pica-client/audiodevice.h new file mode 100644 index 0000000..9c8cec5 --- /dev/null +++ b/pica-client/audiodevice.h @@ -0,0 +1,14 @@ +#ifndef AUDIODEVICE_H +#define AUDIODEVICE_H + +#include "mediadevice.h" + +class AudioDevice : public MediaDevice +{ +public: + AudioDevice(); + ~AudioDevice(); + virtual QList<MediaDeviceInfo> Enumerate(); +}; + +#endif // AUDIODEVICE_H diff --git a/pica-client/mediadevice.cpp b/pica-client/mediadevice.cpp new file mode 100644 index 0000000..42a661b --- /dev/null +++ b/pica-client/mediadevice.cpp @@ -0,0 +1,12 @@ +#include "mediadevice.h" + +MediaDevice::MediaDevice() +{ + +} + +MediaDevice::~MediaDevice() +{ + +} + diff --git a/pica-client/mediadevice.h b/pica-client/mediadevice.h new file mode 100644 index 0000000..d8660f6 --- /dev/null +++ b/pica-client/mediadevice.h @@ -0,0 +1,22 @@ +#ifndef MEDIADEVICE_H +#define MEDIADEVICE_H + +#include <QString> +#include <QList> + +struct MediaDeviceInfo +{ + QString device; + QString humanReadable; + int index; +}; + +class MediaDevice +{ +public: + MediaDevice(); + virtual ~MediaDevice(); + virtual QList<MediaDeviceInfo> Enumerate() = 0; +}; + +#endif // MEDIADEVICE_H diff --git a/pica-client/pica-client.pro b/pica-client/pica-client.pro index 61662fc..a701d12 100644 --- a/pica-client/pica-client.pro +++ b/pica-client/pica-client.pro @@ -11,12 +11,14 @@ TEMPLATE = app SOURCES += main.cpp\ + audiodevice.cpp \ mainwindow.cpp \ chatwindow.cpp \ contacts.cpp \ ../PICA_client.c \ ../PICA_msgproc.c \ contactlistwidget.cpp \ + mediadevice.cpp \ skynet.cpp \ nodes.cpp \ accountswindow.cpp \ @@ -41,15 +43,18 @@ SOURCES += main.cpp\ settings.cpp \ ../PICA_netconf.c \ ../PICA_signverify.c \ - dialogs/nodesdialog.cpp + dialogs/nodesdialog.cpp \ + videodevice.cpp HEADERS += mainwindow.h \ + audiodevice.h \ chatwindow.h \ contacts.h \ globals.h \ ../PICA_client.h \ ../PICA_msgproc.h \ contactlistwidget.h \ + mediadevice.h \ skynet.h \ nodes.h \ accountswindow.h \ @@ -77,7 +82,8 @@ HEADERS += mainwindow.h \ ../PICA_netconf.h \ ../PICA_security.h \ ../PICA_signverify.h \ - dialogs/nodesdialog.h + dialogs/nodesdialog.h \ + videodevice.h DEFINES = PICA_MULTITHREADED diff --git a/pica-client/videodevice.cpp b/pica-client/videodevice.cpp new file mode 100644 index 0000000..75b516b --- /dev/null +++ b/pica-client/videodevice.cpp @@ -0,0 +1,40 @@ +#include "videodevice.h" +#include <QFile> + +VideoDevice::VideoDevice() +{ + +} + +VideoDevice::~VideoDevice() +{ + +} + +QList<MediaDeviceInfo> VideoDevice::Enumerate() +{ + QList<MediaDeviceInfo> result; + int index = 0; +#ifdef Q_OS_LINUX + for (int i = 0; i < 64; i++) + { + QString device = QString(QLatin1String("/dev/video%1")).arg(i); + if (QFile::exists(device)) + { + MediaDeviceInfo d; + d.device = device; + + QFile v4l2_name(QString(QLatin1String("/sys/class/video4linux/video%1/name")).arg(i)); + if (v4l2_name.open((QIODevice::ReadOnly | QIODevice::Text))) + { + d.humanReadable = QString(v4l2_name.readLine()).trimmed(); + v4l2_name.close(); + } + d.index = index++; + + result << d; + } + } +#endif + return result; +} diff --git a/pica-client/videodevice.h b/pica-client/videodevice.h new file mode 100644 index 0000000..0b714c7 --- /dev/null +++ b/pica-client/videodevice.h @@ -0,0 +1,14 @@ +#ifndef VIDEODEVICE_H +#define VIDEODEVICE_H + +#include "mediadevice.h" + +class VideoDevice : public MediaDevice +{ +public: + VideoDevice(); + ~VideoDevice(); + virtual QList<MediaDeviceInfo> Enumerate(); +}; + +#endif // VIDEODEVICE_H |
