43 */ |
43 */ |
44 |
44 |
45 Backend::Backend(QObject *parent) |
45 Backend::Backend(QObject *parent) |
46 : QObject(parent) |
46 : QObject(parent) |
47 , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) |
47 , m_ancestorMoveMonitor(new AncestorMoveMonitor(this)) |
|
48 , m_effectFactory(new EffectFactory(this)) |
48 { |
49 { |
49 TRACE_CONTEXT(Backend::Backend, EBackend); |
50 TRACE_CONTEXT(Backend::Backend, EBackend); |
50 TRACE_ENTRY_0(); |
51 TRACE_ENTRY_0(); |
51 |
52 |
52 setProperty("identifier", QLatin1String("phonon_mmf")); |
53 setProperty("identifier", QLatin1String("phonon_mmf")); |
79 case VideoDataOutputClass: |
80 case VideoDataOutputClass: |
80 case EffectClass: |
81 case EffectClass: |
81 { |
82 { |
82 Q_ASSERT(args.count() == 1); |
83 Q_ASSERT(args.count() == 1); |
83 Q_ASSERT(args.first().type() == QVariant::Int); |
84 Q_ASSERT(args.first().type() == QVariant::Int); |
84 const AbstractAudioEffect::Type effect = AbstractAudioEffect::Type(args.first().toInt()); |
85 const EffectFactory::Type type = |
85 |
86 static_cast<EffectFactory::Type>(args.first().toInt()); |
86 return EffectFactory::createAudioEffect(effect, parent); |
87 return m_effectFactory->createAudioEffect(type, parent); |
87 } |
88 } |
88 case VideoWidgetClass: |
89 case VideoWidgetClass: |
89 result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast<QWidget *>(parent)); |
90 result = new VideoWidget(m_ancestorMoveMonitor.data(), qobject_cast<QWidget *>(parent)); |
90 break; |
91 break; |
91 |
92 |
124 { |
125 { |
125 TRACE_CONTEXT(Backend::connectNodes, EBackend); |
126 TRACE_CONTEXT(Backend::connectNodes, EBackend); |
126 |
127 |
127 switch (type) { |
128 switch (type) { |
128 case EffectType: |
129 case EffectType: |
129 return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); |
130 return m_effectFactory->audioEffectDescriptions(EffectFactory::Type(index)); |
130 case AudioOutputDeviceType: |
131 case AudioOutputDeviceType: |
131 return AudioOutput::audioOutputDescription(index); |
132 return AudioOutput::audioOutputDescription(index); |
132 default: |
133 default: |
133 return QHash<QByteArray, QVariant>(); |
134 return QHash<QByteArray, QVariant>(); |
134 } |
135 } |
137 bool Backend::startConnectionChange(QSet<QObject *>) |
138 bool Backend::startConnectionChange(QSet<QObject *>) |
138 { |
139 { |
139 return true; |
140 return true; |
140 } |
141 } |
141 |
142 |
142 bool Backend::connectNodes(QObject *source, QObject *target) |
143 bool Backend::connectNodes(QObject *sourceObject, QObject *targetObject) |
143 { |
144 { |
144 TRACE_CONTEXT(Backend::connectNodes, EBackend); |
145 TRACE_CONTEXT(Backend::connectNodes, EBackend); |
145 TRACE_ENTRY("source 0x%08x target 0x%08x", source, target); |
146 TRACE_ENTRY("source 0x%08x target 0x%08x", sourceObject, targetObject); |
146 Q_ASSERT(qobject_cast<MediaNode *>(source)); |
147 |
147 Q_ASSERT(qobject_cast<MediaNode *>(target)); |
148 MediaNode *const source = qobject_cast<MediaNode *>(sourceObject); |
148 |
149 MediaNode *const target = qobject_cast<MediaNode *>(targetObject); |
149 MediaNode *const mediaSource = static_cast<MediaNode *>(source); |
150 |
150 MediaNode *const mediaTarget = static_cast<MediaNode *>(target); |
151 Q_ASSERT_X(source, Q_FUNC_INFO, "source is not a MediaNode"); |
151 |
152 Q_ASSERT_X(target, Q_FUNC_INFO, "target is not a MediaNode"); |
152 return mediaSource->connectMediaNode(mediaTarget); |
153 |
153 } |
154 return source->connectOutput(target); |
154 |
155 } |
155 bool Backend::disconnectNodes(QObject *source, QObject *target) |
156 |
|
157 bool Backend::disconnectNodes(QObject *sourceObject, QObject *targetObject) |
156 { |
158 { |
157 TRACE_CONTEXT(Backend::disconnectNodes, EBackend); |
159 TRACE_CONTEXT(Backend::disconnectNodes, EBackend); |
158 TRACE_ENTRY("source 0x%08x target 0x%08x", source, target); |
160 TRACE_ENTRY("source 0x%08x target 0x%08x", sourceObject, targetObject); |
159 Q_ASSERT(qobject_cast<MediaNode *>(source)); |
161 |
160 Q_ASSERT(qobject_cast<MediaNode *>(target)); |
162 MediaNode *const source = qobject_cast<MediaNode *>(sourceObject); |
161 |
163 MediaNode *const target = qobject_cast<MediaNode *>(targetObject); |
162 const bool result = static_cast<MediaNode *>(source)->disconnectMediaNode(static_cast<MediaNode *>(target)); |
164 |
163 |
165 Q_ASSERT_X(source, Q_FUNC_INFO, "source is not a MediaNode"); |
164 TRACE_RETURN("%d", result); |
166 Q_ASSERT_X(target, Q_FUNC_INFO, "target is not a MediaNode"); |
|
167 |
|
168 return source->disconnectOutput(target); |
165 } |
169 } |
166 |
170 |
167 bool Backend::endConnectionChange(QSet<QObject *>) |
171 bool Backend::endConnectionChange(QSet<QObject *>) |
168 { |
172 { |
169 return true; |
173 return true; |