ffmpegurisessionbuilder.cpp Example File
ffmpeg/ffmpegurisessionbuilder.cpp
#include <QUrl>
#include <QSettings>
#include <QMediaSessionRequest>
#include <QDebug>
#include "ffmpegengine.h"
#include "ffmpegplaybinsession.h"
#include "ffmpegurisessionbuilder.h"
namespace ffmpeg
{
class UriSessionBuilderPrivate
{
public:
Engine* engine;
QMediaSessionBuilder::Attributes attributes;
QMediaDevice* outputDevice;
};
UriSessionBuilder::UriSessionBuilder(Engine* engine):
d(new UriSessionBuilderPrivate)
{
d->engine = engine;
QSettings settings("Trolltech", "ffmpeg");
settings.beginGroup("Simple");
d->attributes.insert("uriSchemes", settings.value("UriSchemes").toStringList());
d->attributes.insert("mimeTypes", settings.value("MimeTypes").toStringList());
d->outputDevice = 0;
}
UriSessionBuilder::~UriSessionBuilder()
{
delete d;
}
QString UriSessionBuilder::type() const
{
return "com.trolltech.qtopia.uri";
}
QMediaSessionBuilder::Attributes const& UriSessionBuilder::attributes() const
{
qWarning()<<d->attributes;
return d->attributes;
}
QMediaServerSession* UriSessionBuilder::createSession(QMediaSessionRequest sessionRequest)
{
QUrl url;
PlaybinSession* mediaSession = 0;
sessionRequest >> url;
if (url.isValid())
{
mediaSession = new PlaybinSession(d->engine,
sessionRequest.id(),
url,d->outputDevice);
if (!mediaSession->isValid())
{
delete mediaSession;
mediaSession = 0;
} else {
QMediaServerSession* session;
session = static_cast<QMediaServerSession*>(mediaSession);
d->engine->registerSession(session);
}
}
return mediaSession;
}
void UriSessionBuilder::destroySession(QMediaServerSession* mediaSession)
{
delete mediaSession;
}
}
Copyright © 2009 Nokia |
Trademarks |
Qt Extended 4.4.3 |