void LaunchStub() { SHELLEXECUTEINFO info; ZeroMemory(&info, sizeof(SHELLEXECUTEINFO)); info.cbSize = sizeof(SHELLEXECUTEINFO); info.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS; info.lpVerb = _T("runas"); info.lpFile = STUB_NAME; info.lpParameters = gIpcPipeName; info.nShow = SW_HIDE; if (!ShellExecuteEx(&info)) SYS_ERROR(); gStubProcess = info.hProcess; }
DvevmStRetCode dvtb_audDec1AllocPlayThreadBuffs(AudioBufDesc *audioDesc, int size, int numBuff) { int i = 0; DvevmStRetCode retval = DVEVM_ST_SUCCESS; for (i = 0; i < numBuff; i++) { if (DVEVM_ST_FAIL == dvtb_allocSingleBufCmem(&audioDesc[i].aud_outBuffer, size)) { SYS_ERROR("Unable to allocate memory for Out Buffer %d\n", i); retval = DVEVM_ST_FAIL; break; } } return retval; }
DvevmStRetCode dvtb_DVREncDecMpeg4spDec2WriteOutputData(IVIDEO1_BufDesc *displayBuf, FILE *fOutFile) { int i=0; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; for(i=0; i<displayBuf->numBufs; i++) { if(DVEVM_ST_FAIL == dvtb_fileWrite(fOutFile, (char *)displayBuf->bufDesc[i].buf, displayBuf->bufDesc[i].bufSize)) { SYS_ERROR("Error in writing to file.\n"); retCode = DVEVM_ST_FAIL; break; } } return retCode; }
DvevmStRetCode dvtb_DVREncDecMpeg4spDec2InitFirstOutBuffer(DvevmStMPEG4SPDecInfo *vd) { int i=0; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; vd->outBufArray[0].buffer.numBufs = vd->mpeg4sp_vdecStatus.viddecStatus.bufInfo.minNumOutBufs; for(i=0; i<vd->mpeg4sp_vdecStatus.viddecStatus.bufInfo.minNumOutBufs; i++) vd->outBufArray[0].buffer.bufSizes[i] = vd->mpeg4sp_vdecStatus.viddecStatus.bufInfo.minOutBufSize[i]; if(DVEVM_ST_FAIL == dvtb_allocCmem(&vd->outBufArray[0].buffer)) { SYS_ERROR("Unable to allocate memory for 1st outBuf in the outBuf pool\n"); retCode = DVEVM_ST_FAIL; } return retCode; }
void dvtb_mpeg4spDec2HanClose(DvevmStMPEG4SPDecInfo *vd, char *engName) { //Free the allocated Input Buffer if(0 < vd->inBuf.numBufs ) dvtb_freeCmem(&vd->inBuf); //Free all the allocated output buffers dvtb_mpeg4spDec2DeInitOutBuffers(vd); dvtb_mpeg4spDec2Close(vd); SYS_OUT("Video Decoder <%s> closed.\n", vd->vdec2Name); if (DVEVM_ST_FAIL == dvtb_ceDeInit(&vd->ceHdl)) SYS_ERROR("Unable to close Engine <%s>.\n", engName); else SYS_OUT("Engine <%s> closed.\n", engName); }
DvevmStRetCode dvtb_ceMem(DvevmStEngineInfo *ce) { DVTBASSERT(ce != NULL); DVTBASSERT(ce->hdl != NULL); ce->mem = Engine_getUsedMem(ce->hdl); if (0 == ce->mem) { ce->err = Engine_getLastError(ce->hdl); SYS_ERROR("Unable (%d) to get used memory for Engine <%s>\n", ce->err, ce->name); return DVEVM_ST_FAIL; } else { SYS_OUT("Engine <%s> => Used Memory : %d MAUs\n", ce->name, ce->mem); return DVEVM_ST_SUCCESS; } }
DvevmStRetCode dvtb_deInterControl(DvevmStDeInterInfo *deinter) { int status = -1; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; ASSERT(deinter != NULL); ASSERT(deinter->ceHdl != NULL); deinter->deinterStatus.size = sizeof(UNIVERSAL_Status); deinter->deinterStatus.data.numBufs = 0; status = UNIVERSAL_control(deinter->deinterHdl, deinter->deinterCmd,&deinter->deinterDynParams,&deinter->deinterStatus); if (UNIVERSAL_EOK != status) { SYS_ERROR("Error (%d), Codec Error (%d) in Video Encoder Control\n", status, (int) deinter->deinterStatus.extendedError); retCode = DVEVM_ST_FAIL; } return retCode; }
void dvtb_mpeg2Dec2HanClose(DvevmStMPEG2Dec2Info *vd, char *engName) { //Free the allocated Input Buffer if (0 < vd->inBuf.numBufs) dvtb_freeCmemSingleChunk(&vd->inBuf); //Free all the allocated output buffers dvtb_vidDec2DeInitOutBuffers_dm365(&vd->outBufArray, vd->totBuf); dvtb_mpeg2Dec2Close(vd); SYS_OUT("Video Decoder <%s> closed\n", vd->mpeg2dec2Name); if (DVEVM_ST_FAIL == dvtb_ceDeInit(&vd->ceHdl)) SYS_ERROR("Unable to close Engine <%s>\n", engName); else SYS_OUT("Engine <%s> closed\n", engName); }
DvevmStRetCode dvtb_h264Enc1OutBuffAlloc(DvevmStXdmBuffer *outBuf, XDM_BufDesc *outBufDesc) { DvevmStRetCode retCode = DVEVM_ST_SUCCESS; if (DVEVM_ST_FAIL == dvtb_allocCmem(outBuf)) { SYS_ERROR("Unable to allocate memory for output buffer\n"); retCode = DVEVM_ST_FAIL; } else { outBufDesc->numBufs = outBuf->numBufs; outBufDesc->bufSizes = (XDAS_Int32 *) outBuf->bufSizes; outBufDesc->bufs = (XDAS_Int8 **) outBuf->bufs; } return retCode; }
void dvtb_audPlay(DvevmStThreadInfo *T) { int aud_outBuffer_index = 0; int status = DVEVM_ST_SUCCESS; int nBytes; while (1) { SemThread_pend(sem_in, SemThread_FOREVER); if ((tskPlayState == EXITING) && (0 == availableInBuff)) break; SemThread_pend(sem_block, SemThread_FOREVER); availableInBuff -= 1; SemThread_post(sem_block); if (T->useAlgorithm) nBytes = audioDesc[aud_outBuffer_index].aud_bufSize; else nBytes = AUD_FRAME_BUFF_SIZE; #ifdef TEST_SEM status = dvtb_fileWrite(T->targetFp, audioDesc[aud_outBuffer_index].aud_outBuffer, nBytes); #else // status = dvtb_audioOut(&T->g.aud, audioDesc[aud_outBuffer_index].aud_outBuffer, nBytes); #endif if (DVEVM_ST_FAIL == status) { SYS_ERROR("Audio play-back failed\n"); } aud_outBuffer_index++; if (AUD_OUTBUF_COUNT <= aud_outBuffer_index) aud_outBuffer_index = 0; SemThread_post(sem_out); } tskPlayState = DELETED; dvtb_waitThread(); }
DvevmStRetCode dvtb_sphDec1Control(DvevmStSphDec1Info *sd) { int status = -1; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; ASSERT(sd != NULL); ASSERT(sd->ceHdl != NULL); ASSERT(sd->sdecHdl != NULL); status = SPHDEC1_control(sd->sdecHdl, 2, &sd->sdecDynParams, &sd->sdecStatus); if (SPHDEC1_EOK != status) { SYS_ERROR("Speech Decoder Control Reset failed (%d)\n", status); retCode = DVEVM_ST_FAIL; } return retCode; }
int ExecuteProgram() { PROCESS_INFORMATION pi; STARTUPINFO si; DWORD result; ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); ZeroMemory(&si, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); if (!CreateProcess(NULL, gCmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) SYS_ERROR(); WaitForSingleObject(pi.hProcess, INFINITE); GetExitCodeProcess(pi.hProcess, &result); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); return result; }
DvevmStRetCode dvtb_ceCpu(DvevmStEngineInfo *ce) { DVTBASSERT(ce != NULL); DVTBASSERT(ce->hdl != NULL); ce->cpu = Engine_getCpuLoad(ce->hdl); if (ce->cpu < 0) { ce->err = Engine_getLastError(ce->hdl); SYS_ERROR("Unable (%d) to get CPU load for Engine <%s>\n", ce->err, ce->name); return DVEVM_ST_FAIL; } else { SYS_OUT("Engine <%s> => CPU Load : %d MAUs\n", ce->name, ce->cpu); return DVEVM_ST_SUCCESS; } }
succeed_type flash_unix(FLASH_PRIVATE_HANDLE *phandle) { unsigned char remotename[128]; UNIX_CMD_STRUCT unix_rcv_cmd; memset(remotename, 0x00, 128); memset(&unix_rcv_cmd, 0x00, sizeof(UNIX_CMD_STRUCT)); //1. recv the unix event if ( UNIX_RECV( phandle->unix_fd, remotename, &unix_rcv_cmd) == succeed_type_failed ) { SYS_ERROR("UNIX RECV failed.\r\n"); return succeed_type_failed; } SYS_INFO("Rcv Event from %s in flash.\r\n", remotename); //2. deal the receiving event. flash_unix_deal(phandle, &unix_rcv_cmd); return succeed_type_succeed; }
uint32 enableVpinHandlers (uint32 first, uint32 last, dpinHandlerFuncPtr handler) { uint32 nPins = last - first + 1; uint32 array_size = sizeof(void*) * nPins; _vpinHandlers = safeMalloc (array_size); if (_vpinHandlers == NULL) { SYS_ERROR (ERR_MALLOC_FAILED); return ERROR; } for (int i = 0; i < nPins; i++, _nVpins++) { *(_vpinHandlers + _nVpins) = handler; // _nVpinHandlers++; } _vpinHandlers = NULL; return NOERROR; }
static succeed_type signal_init(SIGNAL_STRUCT_T *signal, int signal_num) { int iLoop = 0; struct sigaction sa; sa.sa_flags = 0; if(NULL == signal || SIGNAL_NUM < signal_num) { SYS_ERROR("signal_init parameters error!!signal = 0x%x, signal_num = %d\r\n",\ signal, signal_num); return succeed_type_failed; } sigemptyset(&sa.sa_mask); for(iLoop = 0; iLoop < signal_num; iLoop++) { sigaddset(&sa.sa_mask, signal->signo[iLoop]); sa.sa_handler = signal->sig_phandle[iLoop]; sigaction(signal->signo[iLoop], &sa, NULL); } return succeed_type_succeed; }
DvevmStRetCode dvtb_sphDec1Decode(DvevmStSphDec1Info *sd, int *decDuration) { XDAS_Int32 status = -1; XDM1_SingleBufDesc inBufDesc, outBufDesc; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; ASSERT(sd != NULL); ASSERT(sd->ceHdl != NULL); ASSERT(sd->sdecHdl != NULL); ASSERT(sd->inBuf.start != NULL); ASSERT(sd->outBuf.start != NULL); inBufDesc.bufSize = sd->inBuf.size; outBufDesc.bufSize = sd->outBuf.size; inBufDesc.buf = (XDAS_Int8 *) sd->inBuf.start; outBufDesc.buf = (XDAS_Int8 *) sd->outBuf.start; memset(&sd->sdecInArgs, 0, sizeof(sd->sdecInArgs)); memset(&sd->sdecOutArgs, 0, sizeof(sd->sdecOutArgs)); sd->sdecInArgs.size = sizeof(SPHDEC1_InArgs); sd->sdecOutArgs.size = sizeof(SPHDEC1_OutArgs); sd->sdecInArgs.frameType = 0; //ISPHDEC1_FTYPE_SPEECHGOOD; dvtb_timeReset(sd->hTime); status = SPHDEC1_process(sd->sdecHdl, &inBufDesc, &outBufDesc, &sd->sdecInArgs, &sd->sdecOutArgs); dvtb_timeDelta(sd->hTime, decDuration); if (status != SPHDEC1_EOK) { SYS_ERROR("Error (%d) in Speech Decoder Process\n", (int) status); retCode = DVEVM_ST_FAIL; } return retCode; }
DvevmStRetCode dvtb_sphEncEncode(DvevmStSphEncInfo *se, int *encDuration) { XDAS_Int32 status = -1; XDM_BufDesc inBufDesc, outBufDesc; DvevmStTime timeStmpBfrEnc, timeStmpAftrEnc; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; XDAS_Int8 *src = NULL, *dst = NULL; ASSERT(se != NULL); ASSERT(se->ceHdl != NULL); ASSERT(se->sencHdl != NULL); ASSERT(se->inBuf.start != NULL); ASSERT(se->outBuf.start != NULL); src = (XDAS_Int8 *) se->inBuf.start; dst = (XDAS_Int8 *) se->outBuf.start; inBufDesc.numBufs = outBufDesc.numBufs = 1; inBufDesc.bufSizes = (XDAS_Int32 *) &se->inBuf.size; outBufDesc.bufSizes = (XDAS_Int32 *) &se->inBuf.size; inBufDesc.bufs = &src; outBufDesc.bufs = &dst; timeStmpBfrEnc = dvtb_getTime( ); status = SPHENC_process(se->sencHdl, &inBufDesc, &outBufDesc, &se->sencInArgs, &se->sencOutArgs); timeStmpAftrEnc = dvtb_getTime( ); *encDuration = ((timeStmpAftrEnc.tv_sec * NUM_MICROSECS_IN_SEC) + timeStmpAftrEnc.tv_usec) - ((timeStmpBfrEnc.tv_sec * NUM_MICROSECS_IN_SEC) + timeStmpBfrEnc.tv_usec); if (status != SPHENC_EOK) { SYS_ERROR("Error (%d) in Speech Encoder Process\n", (int) status); retCode = DVEVM_ST_FAIL; } return retCode; }
DvevmStRetCode dvtb_h264Enc1InBuffAlloc(DvevmStXdmBuffer *inBuf, IVIDEO1_BufDescIn *inBufDesc, DvevmStBool fileBased) { int i = 0; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; do //Dummy loop for easy clean up { if(DVEVM_ST_TRUE == fileBased) { //Allocate the contig memory for inBuf if (DVEVM_ST_FAIL == dvtb_allocCmem(inBuf)) { SYS_ERROR("Unable to allocate memory for input buffer\n"); retCode = DVEVM_ST_FAIL; break; } for (i = 0; i < inBuf->numBufs; i++) memset(inBuf->bufs[i], 0, inBuf->bufSizes[i]); } else { for(i = 0; i < inBuf->numBufs; i++) inBuf->bufs[i] = NULL; } //Assign the buffer pointers accordingly. inBufDesc->numBufs = inBuf->numBufs; for (i = 0; i < inBufDesc->numBufs; i++) { inBufDesc->bufDesc[i].bufSize = inBuf->bufSizes[i]; inBufDesc->bufDesc[i].buf = (XDAS_Int8 *) inBuf->bufs[i]; } }while(DVEVM_ST_FALSE); // Dummy Loop return retCode; }
// Notes: In the case of a ERR_STRING_ARRAY_TOO_LONG error the // copy will be truncated. // uint32 stringLoadFromArray(string * s, char * c) { VERIFY_OBJECT(s, OBJID_STRING) uint8 * to = s->str; uint8 * from = (uint8 *)c; uint32 len = s->max_len; while (len && *from) { *to++ = *from++; len--; s->cur_len++; } *to = NULLCHAR; if (len == 0 && (*from != 0)) { SYS_ERROR (ERR_STRING_ARRAY_TOO_LONG); return ERROR; } return NOERROR; }
///////////////////////////////////////////////////////////////////// // // Function name: pinConfig // // Description: Set the mode of a pin, the "mode" determine features such // as pullup resistors, polarity, open drain etc. // // Parameters: uint32 pin: The logical pin number, valid values are 0-38/54 // uint32 mode: A bit pattern appropriate for setting the // bits in the IOCONFIG register, NOT including the FUNC // field. // // Returned value: ERROR if an error was encountered, NOERROR if not. // // Errors raised: ERR_INV_PIN if the pin number was invalid. // // Notes: The bit pattern is constructed from the defined values in // pins.h. These values are OR'd together to make a single // value that is placed in the upper 29 bits of the pin's // IOCONFIG register // // The three Arduino pinMode constants are trapped and converted // to appropriate formats. // // Example: pinConfig (1, PIN_OD_ENABLED | PIN_INV_YES); // Set pin to be open drain and inverted. // uint32 pinConfig(uint32 pin, uint32 mode) { if (pin >= NATIVE_PINS) { SYS_ERROR (ERR_INV_PIN | pin); return ERROR; } //////////////////////////////////////////////////////////// // // Handle the three standard Arduino arguments for pinMode // // Note that the calls to pinSetAsDigitalInput/Output cause // a recursive call to this function. // switch (mode) { case INPUT: pinSetAsDigitalInput(pin); return NOERROR; case OUTPUT: pinSetAsDigitalOutput(pin); return NOERROR; case INPUT_PULLUP: pinSetAsDigitalInput(pin); mode = PIN_MODE_PULLUP | PIN_ADMODE_DISABLED; break; } //////////////////////////////////////////////////////////// // // Set appropriate bits in the pin's IOCON register // *pin_regs[pin] &= 3; // clear all but the FUNC field *pin_regs[pin] |= mode; // write the mode bits return NOERROR; }
DvevmStRetCode dvtb_audDecControl(DvevmStAudDecInfo *ad) { int status = -1; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; ASSERT(ad != NULL); ASSERT(ad->adecHdl != NULL); status = AUDDEC_control(ad->adecHdl, ad->adecCmd, &ad->adecDynParams, &ad->adecStatus); if (AUDDEC_EOK != status) { SYS_ERROR("Audio Decode Control failed (%d)\n", status); retCode = DVEVM_ST_FAIL; } else { SYS_DEBUG("Audio Decode Control => Command : %d\n", ad->adecCmd); dvtb_audDecControlDebug(&ad->adecStatus); } return retCode; }
DvevmStRetCode dvtb_jpegDec1Control(DvevmStJpegDec1Info *jpeg1) { int status = -1, i = 0; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; ASSERT(jpeg1 != NULL); ASSERT(jpeg1->idec1Hdl != NULL); status = IMGDEC1_control(jpeg1->idec1Hdl, jpeg1->idec1Cmd, (IIMGDEC1_DynamicParams *) &jpeg1->idec1DynParams, (IIMGDEC1_Status *) &jpeg1->idec1Status); if (IMGDEC1_EOK != status) { SYS_ERROR("JPEG Decode Control failed (%d)\n", status); retCode = DVEVM_ST_FAIL; } else { SYS_DEBUG("JPEG Decode Control => Command : %d\n", jpeg1->idec1Cmd); dvtb_jpegDec1ControlDebug(&jpeg1->idec1Status); if (XDM_GETBUFINFO == jpeg1->idec1Cmd) { jpeg1->inBuf.numBufs = jpeg1->idec1Status.imgdecStatus.bufInfo.minNumInBufs; jpeg1->outBuf.numBufs = jpeg1->idec1Status.imgdecStatus.bufInfo.minNumOutBufs; for (i = 0; i < jpeg1->inBuf.numBufs; i++) { jpeg1->inBuf.bufSizes[i] = jpeg1->idec1Status.imgdecStatus.bufInfo.minInBufSize[i]; } for (i = 0; i < jpeg1->outBuf.numBufs; i++) { jpeg1->outBuf.bufSizes[i] = jpeg1->idec1Status.imgdecStatus.bufInfo.minOutBufSize[i]; } } } return retCode; }
void SetUp() { TCHAR* cmdLine; DWORD len; // Get the relevant part of the command line and copy it to // writable memory as required by CreateProcess cmdLine = SkipFirstCmdLineArg(GetCommandLine(), TRUE); if ((gCmdLine = StringAllocAndCopy(cmdLine)) == NULL) SYS_ERROR(); gExiting = FALSE; len = GetCurrentDirectory(0, NULL); gCurrentDirectory = StringAlloc(len); GetCurrentDirectory(len + 1, gCurrentDirectory); gIpcPipe = INVALID_HANDLE_VALUE; gStdInPipe = INVALID_HANDLE_VALUE; gStdOutPipe = INVALID_HANDLE_VALUE; gStdErrPipe = INVALID_HANDLE_VALUE; }
DvevmStRetCode dvtb_ceInit(char *engineName, Engine_Handle *hdl) { Engine_Error err; DVTBASSERT(engineName != NULL); DVTBASSERT(hdl != NULL); *hdl = Engine_open(engineName, NULL, &err); myHdl = *hdl; if (NULL == *hdl) { SYS_ERROR("Engine <%s> open failed. Status => %d\n", engineName, err); return DVEVM_ST_FAIL; } else { SYS_OUT("Engine <%s> opened.\n", engineName); SYS_DEBUG("Engine Handle %x\n", (unsigned int) *hdl); return DVEVM_ST_SUCCESS; } }
unsigned char* GetPEcontext(CLIENT_PC_PRIVATE_HANDLE *phandle,int PE_TYPE) { //PEheader type and length ushort uflag = 0 ; ushort uPEnum = 0; uint32 uitotalength = 0; int iflag = 0; int ioffset = 0; ushort uspetype = 0; uint32 uipelength = 0; memcpy(&uflag,phandle->socketbuf+6,2); memcpy(&uPEnum,phandle->socketbuf+8,2); memcpy(&uitotalength,phandle->socketbuf+12,4); uflag=ntohs(uflag); uPEnum=ntohs(uPEnum); uitotalength=ntohl(uitotalength); if((phandle->lenr)!=uitotalength+68) { SYS_ERROR("Recv lost data.\r\n"); } memset(phandle->pebuf,0,sizeof(phandle->pebuf)); for(iflag;iflag<uPEnum&&ioffset<=uitotalength;iflag++,ioffset+=(uipelength+6)) { memcpy(&uspetype,phandle->socketbuf+68+ioffset,2); memcpy(&uipelength,phandle->socketbuf+70+ioffset,4); uspetype=ntohs(uspetype); uipelength=ntohl(uipelength); if(uspetype==PE_TYPE) { memcpy(phandle->pebuf,phandle->socketbuf+68+6+ioffset,uipelength); break; } } return phandle->pebuf; }
DvevmStRetCode dvtb_vidDecControl(DvevmStVidDecInfo *vd) { int status, i; ASSERT(vd != NULL); ASSERT(vd->vdecHdl != NULL); status = VIDDEC_control(vd->vdecHdl, vd->vdecCmd, &vd->vdecDynParams, &vd->vdecStatus); if (VIDDEC_EOK != status) { SYS_ERROR("Video Decode Control failed (%d)\n", status); return DVEVM_ST_FAIL; } else { SYS_DEBUG("Video Decode Control => Command : %d\n", vd->vdecCmd); dvtb_vidDecControlDebug(&vd->vdecStatus); if (XDM_GETBUFINFO == vd->vdecCmd) { vd->inBuf.numBufs = vd->vdecStatus.bufInfo.minNumInBufs; vd->outBuf.numBufs = vd->vdecStatus.bufInfo.minNumOutBufs; for (i=0; i<vd->inBuf.numBufs; i++) { vd->inBuf.bufSizes[i] = vd->vdecStatus.bufInfo.minInBufSize[i]; } for (i=0; i<vd->outBuf.numBufs; i++) { vd->outBuf.bufSizes[i] = vd->vdecStatus.bufInfo.minOutBufSize[i]; } } return DVEVM_ST_SUCCESS; } }
DvevmStRetCode dvtb_audDec1ReadInput(char *inBuffer, int *totalBytesConsumed, int *bytesRemaining, int buffsize, FILE *fp, int *nBytes) { DvevmStRetCode retval = DVEVM_ST_SUCCESS; if(*bytesRemaining) memcpy(&inBuffer[0], &inBuffer[*totalBytesConsumed], *bytesRemaining); if (DVEVM_ST_FAIL == dvtb_fileRead(fp, &inBuffer[*bytesRemaining], buffsize - *bytesRemaining, nBytes)) { SYS_ERROR("Error in file read \n"); retval = DVEVM_ST_FAIL; } else { *nBytes += *bytesRemaining; *bytesRemaining = *nBytes; *totalBytesConsumed = 0; } return retval; }
DvevmStRetCode dvtb_aacheEnc1numChannels(int channelMode, int *numChannels) { DvevmStRetCode retCode = DVEVM_ST_SUCCESS; switch(channelMode) { case IAUDIO_1_0: *numChannels = 1; break; case IAUDIO_2_0: *numChannels = 2; break; case IAUDIO_11_0: *numChannels = 2; break; default: SYS_ERROR("channel mode %d is not supported \n ",channelMode); *numChannels = 2; retCode = DVEVM_ST_FAIL; } return retCode; }
DvevmStRetCode dvtb_vidEnc1ReadInput(FILE *fp, IVIDEO1_BufDescIn *inBufDesc, DvevmStBool fileBased) { int i = 0, nBytes = 0; DvevmStRetCode retCode = DVEVM_ST_SUCCESS; if (DVEVM_ST_FALSE == fileBased) { } else { for(i = 0; i < inBufDesc->numBufs; i++) { if(DVEVM_ST_FAIL == dvtb_fileRead(fp, (char *)inBufDesc->bufDesc[i].buf, inBufDesc->bufDesc[i].bufSize, &nBytes)) { SYS_ERROR("Error in file read \n"); retCode = DVEVM_ST_FAIL; } } } return retCode; }