Ejemplo n.º 1
0
void
fmDisablePorts (void) {
  if (!--portsEnabledCount) {
    disablePorts(ALP_REGISTER, 1);
    disablePorts(ALP_DATA, 1);
  }
}
Ejemplo n.º 2
0
int
fmEnablePorts (int errorLevel) {
  if (portsEnabledCount) return 1;

  if (enablePorts(errorLevel, ALP_REGISTER, 1)) {
    if (enablePorts(errorLevel, ALP_DATA, 1)) {
      portsEnabledCount++;
      return 1;
    }

    disablePorts(ALP_REGISTER, 1);
  }

  return 0;
}
OMX_ERRORTYPE EnableDataFlow::release()
{
    DBGT_PROLOG("");

    OMX_ERRORTYPE err = OMX_ErrorNone;

    err = disablePorts();
    if(OMX_ErrorNone != err) {
        DBGT_CRITICAL("disablePorts() failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    DBGT_EPILOG("");
    return err;
}
Ejemplo n.º 4
0
static int vbinit() {
  if (enablePorts(LOG_ERR, LPTPORT, 3)) {
    if (enablePorts(LOG_ERR, 0X80, 1)) {
      makeOutputTable(dotsTable_ISO11548_1);

      {
        unsigned char alldots[40];
        memset(alldots, 0XFF, 40);
        vbdisplay(alldots);
      }

      return 0;
    }
    disablePorts(LPTPORT, 3);
  }

  logMessage(LOG_ERR, "Error: must be superuser");
  return -1;
}
OMX_ERRORTYPE EnableDataFlow::init(const ImageInfo &aThumbnailInfo,
                                   const ImageInfo &aPreviewInfo)
{
    DBGT_PROLOG("");

    OMX_ERRORTYPE err = OMX_ErrorNone;

     //Initialize Port definitions structures
    OmxUtils::initialize(mParamArmIvInput, OMX_PortDomainVideo, 0);
    OmxUtils::initialize(mParamArmIvOutput, OMX_PortDomainVideo, 1);
    OmxUtils::initialize(mParamSwJpegInput, OMX_PortDomainImage, 0);
    OmxUtils::initialize(mParamSwJpegOutput, OMX_PortDomainImage, 1);
    OmxUtils::initialize(mParamExifInput, OMX_PortDomainImage, 0);

    //Initialize Semaphores
    status_t err1 = mStateArmIvSem.init(1);
    if(-1 == err1) {
        DBGT_CRITICAL("mStateArmIvSem init failed - OMX_ErrorInsufficientResources");
        DBGT_EPILOG("");
        return OMX_ErrorInsufficientResources;
    }

    err1 = mStateSWJpegSem.init(1);
    if(-1 == err1) {
        DBGT_CRITICAL("mStateSWJpegSem init failed - OMX_ErrorInsufficientResources");
        DBGT_EPILOG("");
        return OMX_ErrorInsufficientResources;
    }

    err1 = mArmIvEosSem.init(1);
    if(-1 == err1) {
        DBGT_CRITICAL("mArmIvEosSem init failed - OMX_ErrorInsufficientResources");
        DBGT_EPILOG("");
        return OMX_ErrorInsufficientResources;
    }

    err1 = mSwJpegEosSem.init(1);
    if(-1 == err1) {
        DBGT_CRITICAL("mSwJpegEosSem init failed - OMX_ErrorInsufficientResources");
        DBGT_EPILOG("");
        return OMX_ErrorInsufficientResources;
    }

    //Initialize ArmIv & SwJpeg Enc Callbacks & Get Handle
    armivcallback.EmptyBufferDone = ArmIVEmptyBufferDone;
    armivcallback.FillBufferDone = 0;
    armivcallback.EventHandler = ArmIvEventHandler;

    err = (mOmxUtils.interface()->GetpOMX_GetHandle())(&mArmIvProc, componentNameArmIv, this, &armivcallback);
    if(OMX_ErrorNone != err ||  NULL == mArmIvProc) {
        DBGT_CRITICAL("ivproc GetHandle failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    swjpegcallback.EmptyBufferDone = 0;
    swjpegcallback.FillBufferDone = 0;
    swjpegcallback.EventHandler = SWJpegEventHandler;

    err = (mOmxUtils.interface()->GetpOMX_GetHandle())(&mSwJpegEnc, componentNameSwJpegEnc, this, &swjpegcallback);
    if(OMX_ErrorNone != err ||  NULL == mSwJpegEnc) {
        DBGT_CRITICAL("swjpegenc GetHandle failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    err = configPorts(aThumbnailInfo, aPreviewInfo);
    if(OMX_ErrorNone != err) {
        DBGT_CRITICAL("configPorts() failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    //Setup Tunneling between armiv-swjpeg-exifmixer
    err = setupTunneling();
    if(OMX_ErrorNone != err) {
        DBGT_CRITICAL("configPorts() failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    err = disablePorts();
    if(OMX_ErrorNone != err) {
        DBGT_CRITICAL("configPorts() failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    //Send armiv & swjpeg enc to executing state with all the ports disabled
    err = sendComponentToExecuting();
    if(OMX_ErrorNone != err) {
        DBGT_CRITICAL("sendComponentToExecuting failed err = %d", err);
        DBGT_EPILOG("");
        return err;
    }

    DBGT_EPILOG("");
    return err;
}