summaryrefslogtreecommitdiff
path: root/libresourceqt/src/resource-engine.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-19 10:38:19 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-19 10:38:19 +0200
commitda47faf6b036220e32e7ce90210530ba5ef9dc2b (patch)
tree07f2911f41f1ca504f42419e75d332d1994727ae /libresourceqt/src/resource-engine.cpp
parenta36aef2b7c5128785a60213a6607191a8bfb1ecf (diff)
downloadlibresourceqt-da47faf6b036220e32e7ce90210530ba5ef9dc2b.tar.gz
implemented the 'audio' features
Diffstat (limited to 'libresourceqt/src/resource-engine.cpp')
-rw-r--r--libresourceqt/src/resource-engine.cpp76
1 files changed, 27 insertions, 49 deletions
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index f788439..014d2cc 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -388,65 +388,43 @@ bool ResourceEngine::updateResources()
return true;
}
-bool ResourceEngine::registerAudioPid(quint32 pid)
+bool ResourceEngine::registerAudioProperties(const QString &audioGroup, quint32 pid,
+ const QString &name, const QString &value)
{
- if(pid == 0)
- return false;
-
- resmsg_t message;
- memset(&message, 0, sizeof(resmsg_t));
-
- message.audio.pid = pid;
-
- qDebug("audio pid %u", pid);
- return sendAudioMessage(&message);
-}
-
-bool ResourceEngine::registerAudioStreamTag(const QString &name, const QString &value)
-{
- if(name.isEmpty() || name.isNull() || value.isEmpty() || value.isNull())
- return false;
-
resmsg_t message;
memset(&message, 0, sizeof(resmsg_t));
+ QByteArray groupBa, nameBa, valueBa;
- QByteArray nameBa = name.toLatin1();
- QByteArray valueBa = value.toLatin1();
- message.audio.property.name = nameBa.data();
- message.audio.property.match.method = resmsg_method_equals;
- message.audio.property.match.pattern = valueBa.data();
-
- qDebug() << "audio stream tag " << name << ":" << value;
- return sendAudioMessage(&message);
-}
-
-bool ResourceEngine::registerAudioGroup(const QString &audioGroup)
-{
- if(audioGroup.isEmpty() || audioGroup.isNull())
- return false;
-
- resmsg_t message;
- memset(&message, 0, sizeof(resmsg_t));
-
- QByteArray ba = audioGroup.toLatin1();
- message.audio.group = ba.data();
-
- qDebug() << "audio group " << audioGroup;
- return sendAudioMessage(&message);
-}
+ if (pid != 0) {
+ message.audio.pid = pid;
+ qDebug("audio pid %u", pid);
+ }
+ if (!audioGroup.isEmpty() && !audioGroup.isNull()) {
+ resmsg_audio_t *audio;
+ groupBa = audioGroup.toLatin1();
+ message.audio.group = groupBa.data();
+ qDebug("audio group: %s", message.audio.group);
+ audio = &message.audio;
+ }
+ if (!name.isEmpty() && !name.isNull() && !value.isEmpty() && !value.isNull()) {
+ nameBa = name.toLatin1();
+ valueBa = value.toLatin1();
+ message.audio.property.name = nameBa.data();
+ message.audio.property.match.method = resmsg_method_equals;
+ message.audio.property.match.pattern = valueBa.data();
+ qDebug("audio stream tag is %s:%s", message.audio.property.name, message.audio.property.match.pattern);
+ }
-bool ResourceEngine::sendAudioMessage(resmsg_t *message)
-{
- message->audio.type = RESMSG_AUDIO;
- message->audio.id = resourceSet->id();
- message->audio.reqno = ++requestId;
+ message.audio.type = RESMSG_AUDIO;
+ message.audio.id = resourceSet->id();
+ message.audio.reqno = ++requestId;
- message->audio.type = RESMSG_AUDIO;
+ message.audio.type = RESMSG_AUDIO;
messageMap.insert(requestId, RESMSG_AUDIO);
qDebug("audio %u:%u", resourceSet->id(), requestId);
- int success = resproto_send_message(libresourceSet, message, statusCallbackHandler);
+ int success = resproto_send_message(libresourceSet, &message, statusCallbackHandler);
if(!success)
return false;