|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the documentation of the Qt Toolkit. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 //! [snippet] |
|
43 QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args) |
|
44 { |
|
45 switch (c) { |
|
46 case MediaObjectClass: |
|
47 return new MediaObject(parent); |
|
48 case VolumeFaderEffectClass: |
|
49 return new VolumeFaderEffect(parent); |
|
50 case AudioOutputClass: |
|
51 return new AudioOutput(parent); |
|
52 case AudioDataOutputClass: |
|
53 return new AudioDataOutput(parent); |
|
54 case VisualizationClass: |
|
55 return new Visualization(parent); |
|
56 case VideoDataOutputClass: |
|
57 return new VideoDataOutput(parent); |
|
58 case EffectClass: |
|
59 return new Effect(args[0].toInt(), parent); |
|
60 case VideoWidgetClass: |
|
61 return new VideoWidget(qobject_cast<QWidget *>(parent)); |
|
62 } |
|
63 return 0; |
|
64 } |
|
65 |
|
66 QSet<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const |
|
67 { |
|
68 QSet<int> set; |
|
69 switch(type) |
|
70 { |
|
71 case Phonon::AudioOutputDeviceType: |
|
72 // use AudioDeviceEnumerator to list ALSA and OSS devices |
|
73 set << 10000 << 10001; |
|
74 break; |
|
75 case Phonon::AudioCaptureDeviceType: |
|
76 set << 20000 << 20001; |
|
77 break; |
|
78 case Phonon::VideoOutputDeviceType: |
|
79 break; |
|
80 case Phonon::VideoCaptureDeviceType: |
|
81 set << 30000 << 30001; |
|
82 break; |
|
83 case Phonon::VisualizationType: |
|
84 case Phonon::AudioCodecType: |
|
85 case Phonon::VideoCodecType: |
|
86 case Phonon::ContainerFormatType: |
|
87 break; |
|
88 case Phonon::EffectType: |
|
89 set << 0x7F000001; |
|
90 break; |
|
91 } |
|
92 return set; |
|
93 } |
|
94 |
|
95 QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescriptionType type, int index) const |
|
96 { |
|
97 QHash<QByteArray, QVariant> ret; |
|
98 switch (type) { |
|
99 case Phonon::AudioOutputDeviceType: |
|
100 switch (index) { |
|
101 case 10000: |
|
102 ret.insert("name", QLatin1String("internal Soundcard")); |
|
103 break; |
|
104 case 10001: |
|
105 ret.insert("name", QLatin1String("USB Headset")); |
|
106 ret.insert("icon", KIcon("usb-headset")); |
|
107 ret.insert("available", false); |
|
108 break; |
|
109 } |
|
110 break; |
|
111 case Phonon::AudioCaptureDeviceType: |
|
112 switch (index) { |
|
113 case 20000: |
|
114 ret.insert("name", QLatin1String("Soundcard")); |
|
115 ret.insert("description", QLatin1String("first description")); |
|
116 break; |
|
117 case 20001: |
|
118 ret.insert("name", QLatin1String("DV")); |
|
119 ret.insert("description", QLatin1String("second description")); |
|
120 break; |
|
121 } |
|
122 break; |
|
123 case Phonon::VideoOutputDeviceType: |
|
124 break; |
|
125 case Phonon::VideoCaptureDeviceType: |
|
126 switch (index) { |
|
127 case 30000: |
|
128 ret.insert("name", QLatin1String("USB Webcam")); |
|
129 ret.insert("description", QLatin1String("first description")); |
|
130 break; |
|
131 case 30001: |
|
132 ret.insert("name", QLatin1String("DV")); |
|
133 ret.insert("description", QLatin1String("second description")); |
|
134 break; |
|
135 } |
|
136 break; |
|
137 case Phonon::VisualizationType: |
|
138 break; |
|
139 case Phonon::AudioCodecType: |
|
140 break; |
|
141 case Phonon::VideoCodecType: |
|
142 break; |
|
143 case Phonon::ContainerFormatType: |
|
144 break; |
|
145 case Phonon::EffectType: |
|
146 switch (index) { |
|
147 case 0x7F000001: |
|
148 ret.insert("name", QLatin1String("Delay")); |
|
149 ret.insert("description", QLatin1String("Simple delay effect with time, feedback and level controls.")); |
|
150 break; |
|
151 } |
|
152 break; |
|
153 } |
|
154 return ret; |
|
155 } |
|
156 //! [snippet] |