| 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 | class QSettings;
|
|---|
| 27 |
|
|---|
| 28 | class DeviceData {
|
|---|
| 29 |
|
|---|
| 30 | public:
|
|---|
| 31 | DeviceData() {};
|
|---|
| 32 | DeviceData(QVariant ID, QString desc) { _id = ID; _desc = desc; };
|
|---|
| 33 | ~DeviceData() {};
|
|---|
| 34 |
|
|---|
| 35 | void setID(QVariant ID) { _id = ID; };
|
|---|
| 36 | void setDesc(QString desc) { _desc = desc; };
|
|---|
| 37 |
|
|---|
| 38 | QVariant ID() const { return _id; };
|
|---|
| 39 | QString desc() const { return _desc; };
|
|---|
| 40 |
|
|---|
| 41 | private:
|
|---|
| 42 | QVariant _id;
|
|---|
| 43 | QString _desc;
|
|---|
| 44 | };
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | typedef QList<DeviceData> DeviceList;
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | class DeviceInfo {
|
|---|
| 51 |
|
|---|
| 52 | public:
|
|---|
| 53 | #ifdef Q_OS_WIN
|
|---|
| 54 | static DeviceList dsoundDevices();
|
|---|
| 55 | static DeviceList displayDevices();
|
|---|
| 56 | #else
|
|---|
| 57 | static DeviceList alsaDevices();
|
|---|
| 58 | static DeviceList xvAdaptors();
|
|---|
| 59 | #endif
|
|---|
| 60 |
|
|---|
| 61 | protected:
|
|---|
| 62 | static void saveList(QSettings * set, const QString & section_name, const DeviceList & list);
|
|---|
| 63 | static DeviceList loadList(QSettings * set, const QString & section_name);
|
|---|
| 64 |
|
|---|
| 65 | #ifdef Q_OS_WIN
|
|---|
| 66 | enum DeviceType { Sound = 0, Display = 1 };
|
|---|
| 67 |
|
|---|
| 68 | static DeviceList retrieveDevices(DeviceType type);
|
|---|
| 69 | #endif
|
|---|
| 70 | };
|
|---|
| 71 |
|
|---|
| 72 | #endif
|
|---|
| 73 |
|
|---|