Ejemplo n.º 1
0
MediaContentServer::MediaContentServer
(
 QMediaServerSession* session,
 QMediaHandle const& handle
):
    QMediaAbstractControlServer(handle, "Session"),
    d(new MediaContentServerPrivate)
{
    d->session = session;

    setValue("controls", d->session->interfaces() << "Session");

    connect(d->session, SIGNAL(interfaceAvailable(QString)),
            this, SLOT(interfaceAvailable(QString)));

    connect(d->session, SIGNAL(interfaceUnavailable(QString)),
            this, SLOT(interfaceUnavailable(QString)));

    proxyAll();
}
Ejemplo n.º 2
0
void NetworkRegistrationWatcher::getPropertiesAsync()
{
    if (!interfaceAvailable())
        return;

    QDBusInterface dbusInterface(OfonoConstants::OFONO_SERVICE, objectPath(), interface(),
                                 QDBusConnection::systemBus());
    if (!dbusInterface.isValid()) {
        log_error("Dbus interface %s of path %s is invalid.",
                  interface().toStdString().c_str(),
                  objectPath().toStdString().c_str());
        return;
    }

    QDBusPendingCall async = dbusInterface.asyncCall("GetProperties");
    QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this);
    QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
                     this, SLOT(getPropertiesAsyncCallback(QDBusPendingCallWatcher*)));
}
Ejemplo n.º 3
0
void NetworkRegistrationWatcher::getProperties()
{
    if (!interfaceAvailable())
        return;

    QDBusMessage request = QDBusMessage::createMethodCall(OfonoConstants::OFONO_SERVICE,
                                                          objectPath(), interface(),
                                                          "GetProperties");
    QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(request);
    if (reply.error().isValid()) {
        log_error("DBus call to interface %s function GetProperties of path %s failed: %s",
                  interface().toStdString().c_str(),
                  objectPath().toStdString().c_str(),
                  reply.error().message().toStdString().c_str());
        return;
    }

    QVariantMap map = reply.value();
    foreach (const QString &key, map.keys())
        emit propertyChanged(objectPath(), key, map.value(key));
}
Ejemplo n.º 4
0
void PlaybinSession::getStreamsInfo()
{
    // Get Length if have not before.
    if (qint32(d->length) == -1)
    {
        GstFormat   format = GST_FORMAT_TIME;
        gint64      duration = 0;

        if (gst_element_query_duration(d->playbin, &format, &duration) == TRUE)
        {
            d->length = duration / 1000000;
            emit lengthChanged(d->length);
        }
    }

    // Audio/Video
    if (!d->haveStreamInfo)
    {
        enum {
            GST_STREAM_TYPE_UNKNOWN,
            GST_STREAM_TYPE_AUDIO,
            GST_STREAM_TYPE_VIDEO,
            GST_STREAM_TYPE_TEXT,
            GST_STREAM_TYPE_SUBPICTURE,
            GST_STREAM_TYPE_ELEMENT
        };

        GList*      streamInfo;

        g_object_get(G_OBJECT(d->playbin), "stream-info", &streamInfo, NULL);

        for (; streamInfo != 0; streamInfo = g_list_next(streamInfo))
        {
            gint        type;
            GObject*    obj = G_OBJECT(streamInfo->data);

            g_object_get(obj, "type", &type, NULL);

            switch (type)
            {
            case GST_STREAM_TYPE_AUDIO:
                break;

            case GST_STREAM_TYPE_VIDEO:
                d->videoControlServer = new QMediaVideoControlServer(d->id);
                d->videoControlServer->setRenderTarget(d->sinkWidget->winId());
                d->interfaces << "Video";
                emit interfaceAvailable("Video");
                break;

            case GST_STREAM_TYPE_UNKNOWN:
                break;

            case GST_STREAM_TYPE_TEXT:
                break;

            case GST_STREAM_TYPE_SUBPICTURE:
                break;

            case GST_STREAM_TYPE_ELEMENT:
                break;
            }
        }

        d->haveStreamInfo = true;
    }
}
Ejemplo n.º 5
0
void PlaybinSession::getStreamsInfo()
{
    // Get Length if have not before.
    if (d->length == quint32(-1))
    {
        GstFormat   format = GST_FORMAT_TIME;
        gint64      duration = 0;

        if (gst_element_query_duration(d->playbin, &format, &duration) == TRUE)
        {
            d->length = duration / 1000000;
            emit lengthChanged(d->length);
        }
    }

    // Audio/Video
    if (!d->haveStreamInfo)
    {
        enum {
            GST_STREAM_TYPE_UNKNOWN,
            GST_STREAM_TYPE_AUDIO,
            GST_STREAM_TYPE_VIDEO,
            GST_STREAM_TYPE_TEXT,
            GST_STREAM_TYPE_SUBPICTURE,
            GST_STREAM_TYPE_ELEMENT
        };

        GList*      streamInfo;

        g_object_get(G_OBJECT(d->playbin), "stream-info", &streamInfo, NULL);

        for (; streamInfo != 0; streamInfo = g_list_next(streamInfo))
        {
            gint        type;
            GObject*    obj = G_OBJECT(streamInfo->data);

            g_object_get(obj, "type", &type, NULL);

            switch (type)
            {
            case GST_STREAM_TYPE_AUDIO:
                break;

            case GST_STREAM_TYPE_VIDEO:
                {
                    d->videoControlServer = new QMediaVideoControlServer( d->id,
                                                                          0, //target
                                                                          this );

                    d->videoControlServer->setRenderTarget(d->sinkWidget->windowId());
                    d->interfaces << "Video";

                    QVideoSurface *surface = d->sinkWidget->videoSurface();
                    surface->setRotation(d->videoControlServer->videoRotation());
                    surface->setScaleMode(d->videoControlServer->videoScaleMode());
                    connect( d->videoControlServer, SIGNAL(rotationChanged(QtopiaVideo::VideoRotation)),
                             surface, SLOT(setRotation(QtopiaVideo::VideoRotation)) );
                    connect( d->videoControlServer, SIGNAL(scaleModeChanged(QtopiaVideo::VideoScaleMode)),
                             surface, SLOT(setScaleMode(QtopiaVideo::VideoScaleMode)) );

                    emit interfaceAvailable("Video");
                }
                break;

            case GST_STREAM_TYPE_UNKNOWN:
                break;

            case GST_STREAM_TYPE_TEXT:
                break;

            case GST_STREAM_TYPE_SUBPICTURE:
                break;

            case GST_STREAM_TYPE_ELEMENT:
                break;
            }
        }

        d->haveStreamInfo = true;
    }
}