Example #1
0
//-----------------------------------------------------------------
ofTexture& elementVideo::getRightTexture()
{
    
    // se sono in mono questo non dovrebbe esistere, ma lascio la preview se è caricato qualcosa:
    if (getElementInputType() == ELM_INPUT_MONO)
    {
        if (rightChannelPath!="") return (rightChannelPlayer.getTextureReference());	
        // sennò "svuoto" l'fbo relativo e lascio tutto nero
        else 
        {
            tempRight.begin();
            //            ofClear(0,0,0,0);
            ofPushStyle();
            ofSetColor(ofColor :: black);
            ofRect(0, 0, tempRight.getWidth(), tempRight.getHeight());
            ofPopStyle();
            tempRight.end();
            
            rT.clear();
            return (rT);
        }
    }
    // se sono con due canali separati, prendo semplicemente la texture dallo stream video:
    else if (getElementInputType() == ELM_INPUT_STEREO_TWO_CHANNEL)
    {
        return (rightChannelPlayer.getTextureReference());	
    }
    //invece se il video è in formato left/right estraggo la parte destra:
    else if (getElementInputType() == ELM_INPUT_STEREO_LEFTRIGHT)
    {
        tempRight.begin();
        ofClear(0,0,0,0);
        leftChannelPlayer.draw(-leftChannelPlayer.getWidth()*.5,0,leftChannelPlayer.getWidth(),leftChannelPlayer.getHeight());
        tempRight.end();
        
        rT.clear();
        rT=tempRight.getTextureReference();
        
        return (rT);
    }
    //infine, se il video è in formato top/bottom estraggo la parte inferiore:
    else if (getElementInputType() == ELM_INPUT_STEREO_TOPBOTTOM)
    {
        tempRight.begin();
        ofClear(0,0,0,0);
        leftChannelPlayer.draw(0, -leftChannelPlayer.getHeight(),leftChannelPlayer.getWidth(),leftChannelPlayer.getHeight());
        tempRight.end();
        
        rT.clear();
        rT=tempRight.getTextureReference();
        
        return (rT);
    }
}
Example #2
0
//-----------------------------------------------------------------
void elementVideo::setup(string _leftChannel, string _rightChannel, int _width, int _height, int inputType,int _xPos, int _yPos,string _name, bool _isWarpable)
{
    
	// UI params
	xPos = _xPos;
	yPos = _yPos;
    
    //file ref
    leftChannelPath=_leftChannel;
    rightChannelPath=_rightChannel;

    leftChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
    rightChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);


    leftChannelPlayer.loadMovie(leftChannelPath);
        
	this->init(1,int(_width),int(_height),leftChannelPlayer.getTextureReference().getTextureData().glTypeInternal,_name,inputType, _isWarpable);

    if(getElementInputType()==ELM_INPUT_STEREO_TWO_CHANNEL)
    {
        if (rightChannelPath!="") rightChannelPlayer.loadMovie(rightChannelPath);   
        else rightChannelPlayer.loadMovie(leftChannelPath);
    }
        leftChannelPlayer.loadMovie(leftChannelPath);
    
    if (getElementInputType() == ELM_INPUT_STEREO_LEFTRIGHT)
    {
        tempLeft.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight());
        lT.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight(), GL_RGBA);
        tempRight.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight());
        rT.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight(), GL_RGBA);
    }
    else if (getElementInputType() == ELM_INPUT_STEREO_TOPBOTTOM)
    {
        tempLeft.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5);
        lT.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5, GL_RGBA);
        tempRight.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5);
        rT.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5, GL_RGBA);
    }

    mute    =    false;
    volume  =    1;
    leftChannelPlayer.setVolume(volume);
        
}
Example #3
0
//-----------------------------------------------------------------
ofTexture& elementVideo::getLeftTexture()
{
    
    // se sono in mono o con due canali separati, prendo semplicemente la texture dallo stream video:
    if (getElementInputType() == ELM_INPUT_MONO || getElementInputType() == ELM_INPUT_STEREO_TWO_CHANNEL)
    {
        return (leftChannelPlayer.getTextureReference());	
    }
    //invece se il video è in formato left/right estraggo la parte sinistra:
    else if (getElementInputType() == ELM_INPUT_STEREO_LEFTRIGHT)
    {
        tempLeft.begin();
        ofClear(0,0,0,0);
        leftChannelPlayer.draw(0,0,leftChannelPlayer.getWidth(),leftChannelPlayer.getHeight());
        tempLeft.end();
        
        lT.clear();
        lT=tempLeft.getTextureReference();
        
        return (lT);
    }
    //infine, se il video è in formato top/bottom estraggo la parte superiore:
    else if (getElementInputType() == ELM_INPUT_STEREO_TOPBOTTOM)
    {
        tempLeft.begin();
        ofClear(0,0,0,0);
        leftChannelPlayer.draw(0,0,leftChannelPlayer.getWidth(),leftChannelPlayer.getHeight());
        tempLeft.end();
        
        lT.clear();
        lT=tempLeft.getTextureReference();
        
        return (lT);
    }
    
    
    
}
Example #4
0
//-----------------------------------------------------------------
void elementVideo::setElementInputType(int _inType)
{
    inputType=_inType;
    
    
    if (getElementInputType() == ELM_INPUT_MONO)
    {
        leftChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        rightChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        
        rightChannelPlayer.close();
        
    }
    else if (getElementInputType() == ELM_INPUT_STEREO_TWO_CHANNEL)
    {
        leftChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        rightChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        if (rightChannelPath!="") rightChannelPlayer.loadMovie(rightChannelPath);   
        else ofSystemAlertDialog("ERROR: this mode requires TWO separate videos!");        
        
        
    }
    if (getElementInputType() == ELM_INPUT_STEREO_LEFTRIGHT)
    {
        leftChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        rightChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        
        rightChannelPlayer.close();
        
        //prepare left:
        tempLeft.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight());
        lT.clear();
        lT.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight(), GL_RGBA);
        
        //prepare right:
        tempRight.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight());
        rT.clear();
        rT.allocate(leftChannelPlayer.getWidth()*.5, leftChannelPlayer.getHeight(), GL_RGBA);
        
    }
    else if (getElementInputType() == ELM_INPUT_STEREO_TOPBOTTOM)
    {
        leftChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        rightChannelPlayer.setPixelFormat(OF_PIXELS_RGBA);
        
        rightChannelPlayer.close();
        //prepare left:
        tempLeft.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5);
        lT.clear();
        lT.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5, GL_RGBA);
        
        //prepare right:
        tempRight.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5);
        rT.clear();
        rT.allocate(leftChannelPlayer.getWidth(), leftChannelPlayer.getHeight()*.5, GL_RGBA);        
    }
    
    //    cout << "width: " << parentElement->warper.width<< endl;
    //    cout << "text.getWidth: " << parentElement->warper.text.getWidth() << endl;
    
    //    parentElement->warper.createGrid(parentElement->warper.xRes, parentElement->warper.yRes);
    //    parentElement->warper.updateCoordinates();
    //    parentElement->warper.createGrid(parentElement->warper.xRes, parentElement->warper.yRes);
    
    
}