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; }
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::configure(const ImageInfo &aThumbnailInfo, const ImageInfo &aPreviewInfo) { DBGT_PROLOG(""); OMX_ERRORTYPE err = OMX_ErrorNone; /* check whether mArmIvProc and mSwJpegEnc are in executing state or not, * if not, send them to executing first. * This being the case when without doing setParameters(), startPreview() * is called. As thumbnailhandler is setup for disableDataFlow, when a * setParameters() is done with some valid thumbnail size, enableDataFlow's * sendComponentToExecuting() is not called leading to a deadlock. */ OMX_STATETYPE armIvProcState, swJpegEncState; OMX_GetState(mArmIvProc, &armIvProcState); OMX_GetState(mSwJpegEnc, &swJpegEncState); if(OMX_StateExecuting != armIvProcState || OMX_StateExecuting != swJpegEncState){ err = sendComponentToExecuting(); if(OMX_ErrorNone != err) { DBGT_CRITICAL("sendComponentToExecuting 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; } err = enablePorts(); if(OMX_ErrorNone != err) { DBGT_CRITICAL("enablePorts failed err = %d", err); DBGT_EPILOG(""); return err; } DBGT_EPILOG(""); return err; }
int mainStreaming(char* ip) { // Prepare the application context to get video stream AppOMXContext ctx = AppOMXContext_Construct(ip) ; initAppOMX(&ctx) ; configureCamera(&ctx) ; configureEncoder(&ctx) ; configureNullSink(&ctx) ; // Configure ports to capture and compress video stream tunneling(&ctx) ; enablePorts(&ctx) ; allocateBuffers(&ctx) ; portsReady(&ctx) ; // Capture and make video streaming over Wifi connection while (1) { ctx.capture(&ctx) ; } return 0 ; }