1 | //! [snippet]
|
---|
2 | QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args)
|
---|
3 | {
|
---|
4 | switch (c) {
|
---|
5 | case MediaObjectClass:
|
---|
6 | return new MediaObject(parent);
|
---|
7 | case VolumeFaderEffectClass:
|
---|
8 | return new VolumeFaderEffect(parent);
|
---|
9 | case AudioOutputClass:
|
---|
10 | return new AudioOutput(parent);
|
---|
11 | case AudioDataOutputClass:
|
---|
12 | return new AudioDataOutput(parent);
|
---|
13 | case VisualizationClass:
|
---|
14 | return new Visualization(parent);
|
---|
15 | case VideoDataOutputClass:
|
---|
16 | return new VideoDataOutput(parent);
|
---|
17 | case EffectClass:
|
---|
18 | return new Effect(args[0].toInt(), parent);
|
---|
19 | case VideoWidgetClass:
|
---|
20 | return new VideoWidget(qobject_cast<QWidget *>(parent));
|
---|
21 | }
|
---|
22 | return 0;
|
---|
23 | }
|
---|
24 |
|
---|
25 | QSet<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const
|
---|
26 | {
|
---|
27 | QSet<int> set;
|
---|
28 | switch(type)
|
---|
29 | {
|
---|
30 | case Phonon::AudioOutputDeviceType:
|
---|
31 | // use AudioDeviceEnumerator to list ALSA and OSS devices
|
---|
32 | set << 10000 << 10001;
|
---|
33 | break;
|
---|
34 | case Phonon::AudioCaptureDeviceType:
|
---|
35 | set << 20000 << 20001;
|
---|
36 | break;
|
---|
37 | case Phonon::VideoOutputDeviceType:
|
---|
38 | break;
|
---|
39 | case Phonon::VideoCaptureDeviceType:
|
---|
40 | set << 30000 << 30001;
|
---|
41 | break;
|
---|
42 | case Phonon::VisualizationType:
|
---|
43 | case Phonon::AudioCodecType:
|
---|
44 | case Phonon::VideoCodecType:
|
---|
45 | case Phonon::ContainerFormatType:
|
---|
46 | break;
|
---|
47 | case Phonon::EffectType:
|
---|
48 | set << 0x7F000001;
|
---|
49 | break;
|
---|
50 | }
|
---|
51 | return set;
|
---|
52 | }
|
---|
53 |
|
---|
54 | QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescriptionType type, int index) const
|
---|
55 | {
|
---|
56 | QHash<QByteArray, QVariant> ret;
|
---|
57 | switch (type) {
|
---|
58 | case Phonon::AudioOutputDeviceType:
|
---|
59 | switch (index) {
|
---|
60 | case 10000:
|
---|
61 | ret.insert("name", QLatin1String("internal Soundcard"));
|
---|
62 | break;
|
---|
63 | case 10001:
|
---|
64 | ret.insert("name", QLatin1String("USB Headset"));
|
---|
65 | ret.insert("icon", KIcon("usb-headset"));
|
---|
66 | ret.insert("available", false);
|
---|
67 | break;
|
---|
68 | }
|
---|
69 | break;
|
---|
70 | case Phonon::AudioCaptureDeviceType:
|
---|
71 | switch (index) {
|
---|
72 | case 20000:
|
---|
73 | ret.insert("name", QLatin1String("Soundcard"));
|
---|
74 | ret.insert("description", QLatin1String("first description"));
|
---|
75 | break;
|
---|
76 | case 20001:
|
---|
77 | ret.insert("name", QLatin1String("DV"));
|
---|
78 | ret.insert("description", QLatin1String("second description"));
|
---|
79 | break;
|
---|
80 | }
|
---|
81 | break;
|
---|
82 | case Phonon::VideoOutputDeviceType:
|
---|
83 | break;
|
---|
84 | case Phonon::VideoCaptureDeviceType:
|
---|
85 | switch (index) {
|
---|
86 | case 30000:
|
---|
87 | ret.insert("name", QLatin1String("USB Webcam"));
|
---|
88 | ret.insert("description", QLatin1String("first description"));
|
---|
89 | break;
|
---|
90 | case 30001:
|
---|
91 | ret.insert("name", QLatin1String("DV"));
|
---|
92 | ret.insert("description", QLatin1String("second description"));
|
---|
93 | break;
|
---|
94 | }
|
---|
95 | break;
|
---|
96 | case Phonon::VisualizationType:
|
---|
97 | break;
|
---|
98 | case Phonon::AudioCodecType:
|
---|
99 | break;
|
---|
100 | case Phonon::VideoCodecType:
|
---|
101 | break;
|
---|
102 | case Phonon::ContainerFormatType:
|
---|
103 | break;
|
---|
104 | case Phonon::EffectType:
|
---|
105 | switch (index) {
|
---|
106 | case 0x7F000001:
|
---|
107 | ret.insert("name", QLatin1String("Delay"));
|
---|
108 | ret.insert("description", QLatin1String("Simple delay effect with time, feedback and level controls."));
|
---|
109 | break;
|
---|
110 | }
|
---|
111 | break;
|
---|
112 | }
|
---|
113 | return ret;
|
---|
114 | }
|
---|
115 | //! [snippet]
|
---|