/* This file is part of the KDE project.
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2.1 or 3 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library. If not, see .
*/
#include "backend.h"
#include "audiooutput.h"
#include "mediaobject.h"
#include
#include
#include
#include
#include
QT_BEGIN_NAMESPACE
// export as Qt/KDE factory as required
Q_EXPORT_PLUGIN2(phonon_waveout, Phonon::WaveOut::Backend);
namespace Phonon
{
namespace WaveOut
{
Backend::Backend(QObject *parent, const QVariantList &)
: QObject(parent)
{
}
Backend::~Backend()
{
}
QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList &args)
{
Q_UNUSED(args);
switch (c)
{
case MediaObjectClass:
return new MediaObject(parent);
case AudioOutputClass:
return new AudioOutput(this, parent);
default:
return 0;
}
}
bool Backend::supportsVideo() const
{
return false;
}
QStringList Backend::availableMimeTypes() const
{
QStringList ret;
return ret;
}
QList Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const
{
QList r;
if (type == Phonon::AudioOutputDeviceType)
r.append(0);
return r;
}
QHash Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const
{
Q_UNUSED(index);
QHash r;
if (type == Phonon::AudioOutputDeviceType)
r["name"] = QLatin1String("default audio device");
return r;
}
bool Backend::connectNodes(QObject *node1, QObject *node2)
{
MediaObject *mediaObject = qobject_cast (node1);
AudioOutput *audioOutput = qobject_cast (node2);
if (mediaObject && audioOutput)
mediaObject->setAudioOutput(audioOutput);
return true;
}
bool Backend::disconnectNodes(QObject *node1, QObject *node2)
{
Q_UNUSED(node1);
Q_UNUSED(node2);
return true;
}
//transaction management
bool Backend::startConnectionChange(QSet)
{
return true;
}
bool Backend::endConnectionChange(QSet)
{
return true;
}
}
}
QT_END_NAMESPACE
#include "moc_backend.cpp"