| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2016 Ricardo Villalba <rvm@users.sourceforge.net>
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program 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 General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 | #ifndef DEVICEINFO_H
|
|---|
| 20 | #define DEVICEINFO_H
|
|---|
| 21 |
|
|---|
| 22 | #include <QString>
|
|---|
| 23 | #include <QVariant>
|
|---|
| 24 | #include <QList>
|
|---|
| 25 |
|
|---|
| 26 | #ifndef Q_OS_WIN
|
|---|
| 27 | #define CACHE_DEVICE_INFO
|
|---|
| 28 | #endif
|
|---|
| 29 |
|
|---|
| 30 | class QSettings;
|
|---|
| 31 |
|
|---|
| 32 | class DeviceData {
|
|---|
| 33 |
|
|---|
| 34 | public:
|
|---|
| 35 | DeviceData() {};
|
|---|
| 36 | DeviceData(QVariant ID, QString desc) { _id = ID; _desc = desc; };
|
|---|
| 37 | ~DeviceData() {};
|
|---|
| 38 |
|
|---|
| 39 | void setID(QVariant ID) { _id = ID; };
|
|---|
| 40 | void setDesc(QString desc) { _desc = desc; };
|
|---|
| 41 |
|
|---|
| 42 | QVariant ID() const { return _id; };
|
|---|
| 43 | QString desc() const { return _desc; };
|
|---|
| 44 |
|
|---|
| 45 | private:
|
|---|
| 46 | QVariant _id;
|
|---|
| 47 | QString _desc;
|
|---|
| 48 | };
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 | typedef QList<DeviceData> DeviceList;
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 | class DeviceInfo {
|
|---|
| 55 |
|
|---|
| 56 | public:
|
|---|
| 57 | #ifdef Q_OS_WIN
|
|---|
| 58 | static DeviceList dsoundDevices();
|
|---|
| 59 | static DeviceList displayDevices();
|
|---|
| 60 | #else
|
|---|
| 61 | static DeviceList alsaDevices();
|
|---|
| 62 | static DeviceList xvAdaptors();
|
|---|
| 63 | #endif
|
|---|
| 64 |
|
|---|
| 65 | protected:
|
|---|
| 66 | #ifdef CACHE_DEVICE_INFO
|
|---|
| 67 | static void saveList(QSettings * set, const QString & section_name, const DeviceList & list);
|
|---|
| 68 | static DeviceList loadList(QSettings * set, const QString & section_name);
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
| 71 | #ifdef Q_OS_WIN
|
|---|
| 72 | enum DeviceType { Sound = 0, Display = 1 };
|
|---|
| 73 |
|
|---|
| 74 | static DeviceList retrieveDevices(DeviceType type);
|
|---|
| 75 | #endif
|
|---|
| 76 | };
|
|---|
| 77 |
|
|---|
| 78 | #endif
|
|---|
| 79 |
|
|---|