summaryrefslogtreecommitdiff
path: root/libresourceqt/src/resource-engine.cpp
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-18 12:52:29 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-18 12:52:29 +0200
commita36aef2b7c5128785a60213a6607191a8bfb1ecf (patch)
treeadd37ed9e8b7172dd5df4fab24a4333a0dd7116c /libresourceqt/src/resource-engine.cpp
parentfdb67c341fcb9ea0ae29a7889227ded6ac66a362 (diff)
downloadlibresourceqt-a36aef2b7c5128785a60213a6607191a8bfb1ecf.tar.gz
astyled the code
Diffstat (limited to 'libresourceqt/src/resource-engine.cpp')
-rw-r--r--libresourceqt/src/resource-engine.cpp55
1 files changed, 38 insertions, 17 deletions
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index 5c02b44..f788439 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -388,20 +388,42 @@ bool ResourceEngine::updateResources()
return true;
}
-bool ResourceEngine::registerAudioPid(quint32)
+bool ResourceEngine::registerAudioPid(quint32 pid)
{
- return false;
+ 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 &)
+bool ResourceEngine::registerAudioStreamTag(const QString &name, const QString &value)
{
- return false;
+ if(name.isEmpty() || name.isNull() || value.isEmpty() || value.isNull())
+ return false;
+
+ resmsg_t message;
+ memset(&message, 0, sizeof(resmsg_t));
+
+ 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 == "") || (audioGroup == QString()))
- return false;
+ if(audioGroup.isEmpty() || audioGroup.isNull())
+ return false;
resmsg_t message;
memset(&message, 0, sizeof(resmsg_t));
@@ -409,28 +431,27 @@ bool ResourceEngine::registerAudioGroup(const QString &audioGroup)
QByteArray ba = audioGroup.toLatin1();
message.audio.group = ba.data();
- message.audio.type = RESMSG_AUDIO;
- message.audio.id = resourceSet->id();
- message.audio.reqno = ++requestId;
+ qDebug() << "audio group " << audioGroup;
+ return sendAudioMessage(&message);
+}
- message.audio.type = RESMSG_AUDIO;
+bool ResourceEngine::sendAudioMessage(resmsg_t *message)
+{
+ message->audio.type = RESMSG_AUDIO;
+ message->audio.id = resourceSet->id();
+ message->audio.reqno = ++requestId;
-// msg.audio.pid = pid;
-//stream tag is a name:value pair
-// msg.audio.property.name = name;
-// msg.audio.property.match.method = resmsg_method_equals;
-// msg.audio.property.match.pattern = value;
+ 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;
else
return true;
-
}
static void connectionIsUp(resconn_t *connection)