// The real constructor of the proxy, to be able to have error management
OMX_ERRORTYPE H264Dec_Proxy::construct()
{
    OstTraceInt0(TRACE_API,"Enter H264Dec_Proxy::construct");
    // Note ostTrcFiltInst0 can not be used at that time: ENS has not alloc memory yet

    RETURN_OMX_ERROR_IF_ERROR(VFM_Component::construct(2));
    RETURN_OMX_ERROR_IF_ERROR(processingComponent.setPortCount(2));

    // Set the processing component. To be done after VFM_Component::construct
    // as ENS construct() reset it
    setProcessingComponent(&processingComponent);
	OstTraceInt0(TRACE_FLOW,"H264Dec_Proxy::construct():Create Input port");
    // 1 buffer... but this number is recomputed in the port depending the image size
    RETURN_OMX_ERROR_IF_ERROR(createPort(VPB+0, OMX_DirInput, OMX_BufferSupplyInput, 1, 0, OMX_PortDomainVideo));
	OstTraceInt0(TRACE_FLOW,"H264Dec_Proxy::construct():Create Output port");
    // 1 buffer... but this number is recomputed in the port depending the image size
    RETURN_OMX_ERROR_IF_ERROR(createPort(VPB+1, OMX_DirOutput, OMX_BufferSupplyOutput, 1, 0, OMX_PortDomainVideo));

    // set the default value of the ports
    ((H264Dec_Port *)getPort(VPB+0))->setDefault();
    ((H264Dec_Port *)getPort(VPB+1))->setDefault();

    // set the role of the component: video_decoder.avc
    h264dec_assert((1 == getRoleNB()), __LINE__, OMX_TRUE);
    ENS_String<20> role = "video_decoder.avc";
    role.put((OMX_STRING)mRoles[0]);
    setActiveRole(mRoles[0]);
    OstTraceInt0(TRACE_API,"Exit H264Dec_Proxy::construct");
    return OMX_ErrorNone;
}
Exemplo n.º 2
0
struct Terminal* createTerminal(char* name)
{
    struct Terminal* ret=malloc(sizeof(struct Terminal));
    ret->name=name;
    memset(ret->Buffer,0,12*21);
    ret->inputPort=createPort("Oame");
    //ret->inputPort->reg=0;
    ret->ColumnP=0;
    ret->LineP=11;
    printf("%s",ret->inputPort->name);
    return ret;
}
Exemplo n.º 3
0
bool AudioOutput::setOutputDevice(const AudioOutputDevice &newDevice)
{
    K_XT(AudioOutput);
    if (!xt->m_xine) {
        // remember the choice until we have a xine_t
        m_device = newDevice;
        return true;
    }

    xine_audio_port_t *port = createPort(newDevice);
    if (!port) {
        debug() << Q_FUNC_INFO << "new audio port is invalid";
        return false;
    }

    KeepReference<> *keep = new KeepReference<>;
    keep->addObject(xt);
    keep->ready();

    AudioOutputXT *newXt = new AudioOutputXT;
    newXt->m_audioPort = port;
    newXt->m_xine = xt->m_xine;
    m_threadSafeObject = newXt;

    m_device = newDevice;
    SourceNode *src = source();
    if (src) {
        QList<WireCall> wireCall;
        QList<WireCall> unwireCall;
        wireCall << WireCall(src, this);
        unwireCall << WireCall(src, QExplicitlySharedDataPointer<SinkNodeXT>(xt));
        QCoreApplication::postEvent(XineThread::instance(), new RewireEvent(wireCall, unwireCall));
        graphChanged();
    }

    AudioDataOutputXT *dataOutput = dynamic_cast<AudioDataOutputXT*>(m_source->threadSafeObject().data());
    if (dataOutput)
        dataOutput->intercept(xt->m_audioPort);

    return true;
}
Exemplo n.º 4
0
void AudioOutput::xineEngineChanged()
{
    K_XT(AudioOutput);
    if (xt->m_xine) {
        xine_audio_port_t *port = createPort(m_device);
        if (!port) {
            debug() << Q_FUNC_INFO << "stored audio port is invalid";
            QMetaObject::invokeMethod(this, "audioDeviceFailed", Qt::QueuedConnection);
            return;
        }

        // our XT object is in a wirecall, better not delete it

        Q_ASSERT(xt->m_audioPort == 0);
        xt->m_audioPort = port;


        AudioDataOutputXT *dataOutput = dynamic_cast<AudioDataOutputXT*>(m_source->threadSafeObject().data());
        if (dataOutput)
            dataOutput->intercept(xt->m_audioPort);
    }
}
Exemplo n.º 5
0
/****************************************************************************
**
** Copyright (C) 2014
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/

// Include
#include <QMessageBox>
#include "node_compound.h"
#include "node_editorwidget.h"
#include "node_port.h"

namespace Magus
{
    //****************************************************************************/
    QtCompoundNode::QtCompoundNode(QString title, QGraphicsItem* parent) : QtNode(title, parent)
    {
        setData(NODE_KEY_GRAPHIC_ITEM_SUBTYPE, QVariant(NODE_VALUE_SUBTYPE_COMPOUND));
        mAutoSize = false;
    }

    //****************************************************************************/
    QtCompoundNode::~QtCompoundNode(void)
    {
    }

    //****************************************************************************/
    void QtCompoundNode::_prepareDelete(void)
    {
        // First release the nodes
        QtCompoundNode* compound;
        foreach(QtNode* node, mNodeList)
            removeNode(node);

        mNodeList.clear();
    }

    //****************************************************************************/
    void QtCompoundNode::mouseLeftClickAction2ButtonHandler(QGraphicsSceneMouseEvent* mouseEvent, QGraphicsItem* item)
    {
        _prepareDelete();
        QtNode::mouseLeftClickAction2ButtonHandler(mouseEvent, item);
        mScene->update();
    }

    //****************************************************************************/
    void QtCompoundNode::addNode(QtNode* node)
    {
        if (!node)
            return;

        mNodeList.append(node);
        node->setParentItem(this);

        // Take over the ports of the included nodes
        QVector<QtPort*> ports = node->getPorts();
        node->setVisible(false);
        QtConnection* connection;
        QtPort* createdPort;
        bool isBasePort;
        foreach(QtPort* port, ports)
        {
            connection = port->getConnection();
            isBasePort = port->isBasePort();

            // Add a copy of the port to this compound
            createdPort = createPort(port->getPortId(),
                                        port->getPortName(),
                                        port->getPortType(),
                                        port->getPortColour(),
                                        port->getPortShape(),
                                        port->getAlignment(),
                                        port->getConnectionColour());
            createdPort->setCopyOfPort(port);

            // Rewire the connection
            if (connection)
            {
                createdPort->setConnection(connection, isBasePort);
                connection->setVisible(true);
            }
        }
/****************************************************************************
**
** Copyright (C) 2016 - 2017
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/

// Include
#include <float.h>
#include <QMessageBox>
#include <QSettings>
#include "constants.h"
#include "hlms_node_samplerblock.h"
#include "hlms_node_porttypes.h"

//****************************************************************************/
HlmsNodeSamplerblock::HlmsNodeSamplerblock(QString title, QGraphicsItem* parent) :
    Magus::QtNode(title, parent),
    mTextureType(0),
    mTextureIndex(0),
    mSamplerblockEnabled(true),
    mTextureAddressingModeU(0),
    mTextureAddressingModeV(0),
    mTextureAddressingModeW(0),
    mMipLodBias(0.0f),
    mMaxAnisotropy(1.0f),
    mCompareFunction(8),
    mMinLod(-FLT_MAX),
    mMaxLod(FLT_MAX),
    mBorderColourRed(255.0f),
    mBorderColourGreen(255.0f),
    mBorderColourBlue(255.0f),
    mUvSet(0),
    mBlendMode(0),
    mMapWeight(1.0f),
    mEmissiveColourRed(0.0f),
    mEmissiveColourGreen(0.0f),
    mEmissiveColourBlue(0.0f),
    mAnimationEnabled(false),
    mSequenceNumber(-1)
{
    mFileNameTexture = QString("");
    mBaseNameTexture = QString("");
    mPathTexture = QString("");
    mOffset = QVector2D(0.0f, 0.0f);
    mScale = QVector2D(1.0f, 1.0f);
    mAnimationScale = QVector2D(1.0f, 1.0f);
    mAnimationTranslate = QVector2D(0.0f, 0.0f);

    // Define the connection policy
    HlmsPbsDatablockSamplerblockPortType hlmsPbsDatablockSamplerblockPortType;
    HlmsSamplerblockDatablockPortType hlmsSamplerblockDatablockPortType;
    hlmsPbsDatablockSamplerblockPortType.addPortTypeToConnectionPolicy(hlmsSamplerblockDatablockPortType);

    // Apply values from settings.cfg
    QSettings settings(FILE_SETTINGS, QSettings::IniFormat);
    mTextureMinFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();
    mTextureMagFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();
    mTextureMipFilter = settings.value(SETTINGS_SAMPLERBLOCK_FILTER_INDEX).toInt();

    // Custome node settings
    setTitleColor(Qt::white);
    setHeaderTitleIcon(ICON_SAMPLERBLOCK);
    setAction1Icon(ICON_MINMAX);
    setAction2Icon(ICON_CLOSE);
    alignTitle(Magus::ALIGNED_LEFT);
    setHeaderColor(QColor("#874E96"));
    mPort = createPort(PORT_ID_SAMPLERBLOCK,
                       PORT_DATABLOCK,
                       hlmsPbsDatablockSamplerblockPortType,
                       QColor("#874E96"),
                       Magus::PORT_SHAPE_CIRCLE,
                       Magus::ALIGNED_LEFT,
                       QColor("#874E96"));

    setPortNameColor(Qt::white);
    setZoom(0.9);
}