/*=============================================================================
FUNCTION:           updateSubFrame2VideoSurface

DESCRIPTION:        This function updata a subframe to video surface.
==============================================================================*/
VSFlowReturn
updateSubFrame2VideoSurface (void *vshandle, SubFrame * subframe, int idx)
{
  VideoSurface *vsurface;

  if (vshandle == NULL)
    return VS_FLOW_PARAMETER_ERROR;

  vsurface = (VideoSurface *) vshandle;
  VS_LOCK (gVSlock);

  if (subframe) {
    vsurface->subframes[idx].width = subframe->width;
    vsurface->subframes[idx].height = subframe->height;
    vsurface->subframes[idx].posx = subframe->posx;
    vsurface->subframes[idx].posy = subframe->posy;
    vsurface->subframes[idx].image = subframe->image;
    vsurface->subframes[idx].fmt = SUBFRAME_DEFAULT_FMT;
    vsurface->itask.mode = 1;


    if (vsurface->mainframeupdate) {
      _reconfigSubFrameBuffer (vsurface);
      vsurface->mainframeupdate = 0;
    }
    _updateSubFrame (vsurface);


  } else {
    vsurface->itask.mode = 0;
  }

  VS_UNLOCK (gVSlock);
  return VS_FLOW_OK;
}
Ejemplo n.º 2
0
VSFlowReturn 
_configMasterVideoSurface(void * vshandle, void  * config)
{
    VS_FLOW("Fun %s in\n", __FUNCTION__);
    DestinationFmt * des = (DestinationFmt *)config;

    VideoSurface * vs;
    SourceFmt src;
    vs = (VideoSurface *)vshandle;

    VS_MESSAGE("reconfig win from "WIN_FMT" to "WIN_FMT"\n", WIN_ARGS(&vs->desfmt.rect), WIN_ARGS(&des->rect));

    VideoDevice * vd=SURFACE2DEVICE(vs);

      
    VS_LOCK(gVSlock);
    vs->desfmt = *des;
    vs->outside = _adjustDestRect(&des->rect, vd);
    vs->adjustdesrect = des->rect;

    if (NEXTSURFACE(vs)){
        _removeVideoSurfaceFromDevice(vd,vs);
        _addVideoSurface2Device(vd,vs);
    }

    _clearVideoSurfaceBackground(vd, vs);
    
    if (_checkOnDevice(vd)){
        _reconfigAllVideoSurfaces(vd);
        _setDeviceConfig(vd);
    }else{
        _initVSIPUTask(vs);
    }
    if (vd->setalpha)
        _setAlpha(vd);

    vs->mainframeupdate = 1;

    if (vs->itask.mode){
        _reconfigSubFrameBuffer(vs);
        vs->mainframeupdate = 0;
        _updateSubFrame(vs);
    }

    
    _refreshOnDevice(vd);

    VS_UNLOCK(gVSlock);
    VS_FLOW("Fun %s out\n", __FUNCTION__);

    return VS_FLOW_OK;

}