Exemplo n.º 1
0
//--------------------------------------------------------------
void LayerSink::processOscCommand(const string& command, const ofxOscMessage& m) {

    if(isMatch(command, "sink")) {
        if(validateOscSignature("[s]", m)) {
            sinkAsset(getArgAsStringUnchecked(m,0));
        }
    } else if(isMatch(command,"unsink")) {
        unsinkAsset();
    } else if(isMatch(command,"clear")) {
        clear();
    } else if(isMatch(command,"stretchmode")) {
        if(validateOscSignature("[s]", m)) {
            string mode = getArgAsStringUnchecked(m,0);
            if(isMatch(mode,"center")) {
                setScaleMode(OF_SCALEMODE_CENTER);
//                setScaleMode(FIT);
            } else if(isMatch(mode,"fill")) {
                setScaleMode(OF_SCALEMODE_FILL);
//                setScaleMode(FILL);
            } else if(isMatch(mode,"fit")) {
                setScaleMode(OF_SCALEMODE_FIT);
//                setScaleMode(FIT);
            } else if(isMatch(mode,"stretch")) {
                setScaleMode(OF_SCALEMODE_STRETCH_TO_FILL);
//                setScaleMode(STRETCH);
            } else {
                ofLogWarning("LayerSink") << "Unknown scale mode " << mode << "." << endl;
            }
        }
    } else if(isMatch(command,"clipping")) {

    } else {
        ofLogWarning("LayerSink") << "Unknown osc command : " << command << ".";
    }
}
Exemplo n.º 2
0
bool ImageButton::init()
{
    if (!Button::initWithStates(Image::create()))
    {
        return false;
    }
    setScaleMode(true);
    return true;
}
Exemplo n.º 3
0
bool ImageButton::initWithSrc(const std::string& srcUp, const std::string& srcDown, const std::string& srcDisabled)
{
    m_srcUp = srcUp;
    m_srcDown = srcDown;
    m_srcDisabled = srcDisabled;
    auto _upState = Image::create(m_srcUp);
    {
        _upState->ignoreAnchorPointForPosition(true);
    }
    if (!Button::initWithStates(_upState))
    {
        return false;
    }
    setScaleMode(true);
    return true;
}
Exemplo n.º 4
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;
    }
}