|
1 /* This file is part of the KDE project. |
|
2 |
|
3 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
|
5 This library is free software: you can redistribute it and/or modify |
|
6 it under the terms of the GNU Lesser General Public License as published by |
|
7 the Free Software Foundation, either version 2.1 or 3 of the License. |
|
8 |
|
9 This library 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 Lesser General Public License for more details. |
|
13 |
|
14 You should have received a copy of the GNU Lesser General Public License |
|
15 along with this library. If not, see <http://www.gnu.org/licenses/>. |
|
16 */ |
|
17 |
|
18 #include "backend.h" |
|
19 |
|
20 |
|
21 #include "audiooutput.h" |
|
22 #include "mediaobject.h" |
|
23 |
|
24 |
|
25 |
|
26 #include <QtCore/QSettings> |
|
27 #include <QtCore/QSet> |
|
28 #include <QtCore/QVariant> |
|
29 #include <QtCore/QStringList> |
|
30 |
|
31 #include <QtCore/QtPlugin> |
|
32 |
|
33 |
|
34 QT_BEGIN_NAMESPACE |
|
35 |
|
36 // export as Qt/KDE factory as required |
|
37 |
|
38 Q_EXPORT_PLUGIN2(phonon_waveout, Phonon::WaveOut::Backend); |
|
39 |
|
40 namespace Phonon |
|
41 { |
|
42 namespace WaveOut |
|
43 { |
|
44 |
|
45 Backend::Backend(QObject *parent, const QVariantList &) |
|
46 : QObject(parent) |
|
47 { |
|
48 } |
|
49 |
|
50 Backend::~Backend() |
|
51 { |
|
52 } |
|
53 |
|
54 QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args) |
|
55 { |
|
56 Q_UNUSED(args); |
|
57 switch (c) |
|
58 { |
|
59 case MediaObjectClass: |
|
60 return new MediaObject(parent); |
|
61 case AudioOutputClass: |
|
62 return new AudioOutput(this, parent); |
|
63 default: |
|
64 return 0; |
|
65 } |
|
66 } |
|
67 |
|
68 bool Backend::supportsVideo() const |
|
69 { |
|
70 return false; |
|
71 } |
|
72 |
|
73 QStringList Backend::availableMimeTypes() const |
|
74 { |
|
75 QStringList ret; |
|
76 return ret; |
|
77 } |
|
78 |
|
79 |
|
80 QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const |
|
81 { |
|
82 QList<int> r; |
|
83 if (type == Phonon::AudioOutputDeviceType) |
|
84 r.append(0); |
|
85 return r; |
|
86 } |
|
87 |
|
88 QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const |
|
89 { |
|
90 Q_UNUSED(index); |
|
91 QHash<QByteArray, QVariant> r; |
|
92 if (type == Phonon::AudioOutputDeviceType) |
|
93 r["name"] = QLatin1String("default audio device"); |
|
94 return r; |
|
95 } |
|
96 |
|
97 |
|
98 bool Backend::connectNodes(QObject *node1, QObject *node2) |
|
99 { |
|
100 MediaObject *mediaObject = qobject_cast<MediaObject*> (node1); |
|
101 AudioOutput *audioOutput = qobject_cast<AudioOutput*> (node2); |
|
102 |
|
103 if (mediaObject && audioOutput) |
|
104 mediaObject->setAudioOutput(audioOutput); |
|
105 return true; |
|
106 } |
|
107 |
|
108 bool Backend::disconnectNodes(QObject *node1, QObject *node2) |
|
109 { |
|
110 Q_UNUSED(node1); |
|
111 Q_UNUSED(node2); |
|
112 return true; |
|
113 } |
|
114 |
|
115 //transaction management |
|
116 bool Backend::startConnectionChange(QSet<QObject *>) |
|
117 { |
|
118 return true; |
|
119 } |
|
120 |
|
121 bool Backend::endConnectionChange(QSet<QObject *>) |
|
122 { |
|
123 return true; |
|
124 } |
|
125 |
|
126 } |
|
127 } |
|
128 |
|
129 QT_END_NAMESPACE |
|
130 |
|
131 #include "moc_backend.cpp" |