28 #include <bellagio/extension_struct.h>
54 printf(
"Usage: omxvolcontroltest [-o outfile] [-g gain] filename\n");
56 printf(
" -o outfile: If this option is specified, the output stream is written to outfile\n");
57 printf(
" otherwise redirected to std output\n");
58 printf(
" -g: Gain of PCM data [0...100]\n");
59 printf(
" -h: Displays this help\n");
72 int main(
int argc,
char** argv) {
89 flagIsOutputExpected = 0;
90 flagOutputReceived = 0;
91 flagInputReceived = 0;
95 while (argn_dec<argc) {
96 if (*(argv[argn_dec]) ==
'-') {
97 if (flagIsOutputExpected) {
100 switch (*(argv[argn_dec]+1)) {
105 flagIsOutputExpected = 1;
115 gain = (int)atoi(argv[argn_dec]);
121 }
else if (flagIsOutputExpected) {
122 output_file = malloc(strlen(argv[argn_dec]) + 1);
123 strcpy(output_file,argv[argn_dec]);
124 flagIsOutputExpected = 0;
125 flagOutputReceived = 1;
127 input_file = malloc(strlen(argv[argn_dec]) + 1);
128 strcpy(input_file,argv[argn_dec]);
129 flagInputReceived = 1;
134 if (!flagInputReceived) {
139 if (flagOutputReceived) {
145 fd = open(input_file, O_RDONLY);
147 perror(
"Error opening input file\n");
151 if (flagOutputReceived) {
152 outfile = fopen(output_file,
"wb");
153 if(outfile == NULL) {
162 pthread_cond_init(&appPriv->
condition, NULL);
163 pthread_mutex_init(&appPriv->
mutex, NULL);
198 if((gain >= 0) && (gain <100)) {
242 inBuffer1 = inBuffer2 = outBuffer1 = outBuffer2 = NULL;
323 if (flagOutputReceived) {
324 if(fclose(outfile) != 0) {
350 switch ((
int)Data2) {
394 static int iBufferDropped=0;
401 if (data_read <= 0) {
404 if(iBufferDropped>=2) {
436 if(pBuffer != NULL) {
438 DEBUG(
DEB_LEV_ERR,
"Ouch! In %s: no data in the output buffer!\n", __func__);
441 if (flagOutputReceived) {
447 putchar(*(
char*)(pBuffer->
pBuffer + i));
452 DEBUG(
DEB_LEV_ERR,
"Ouch! In %s: had NULL buffer to output...\n", __func__);
465 static int getFileSize(
int fd) {
467 struct stat input_file_stat;
471 err = fstat(fd, &input_file_stat);
476 return input_file_stat.st_size;
#define OMX_EmptyThisBuffer(hComponent,pBuffer)
#define OMX_GetConfig(hComponent,nConfigIndex,pComponentConfigStructure)
#define DEB_LEV_SIMPLE_SEQ
OMX_ERRORTYPE volcEmptyBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void)
The OMX_Init standard function.
#define DEBUG(n, fmt, args...)
struct OMX_VERSIONTYPE::@1 s
void tsem_up(tsem_t *tsem)
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
void tsem_down(tsem_t *tsem)
#define OMX_GetParameter(hComponent,nParamIndex,pComponentParameterStructure)
OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle(OMX_OUT OMX_HANDLETYPE *pHandle, OMX_IN OMX_STRING cComponentName, OMX_IN OMX_PTR pAppData, OMX_IN OMX_CALLBACKTYPE *pCallBacks)
OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_FreeHandle(OMX_IN OMX_HANDLETYPE hComponent)
#define OMX_BUFFERFLAG_EOS
#define OMX_SetParameter(hComponent,nParamIndex,pComponentParameterStructure)
#define OMX_SendCommand(hComponent,Cmd,nParam,pCmdData)
#define OMX_AllocateBuffer(hComponent,ppBuffer,nPortIndex,pAppPrivate,nSizeBytes)
#define OMX_FreeBuffer(hComponent,nPortIndex,pBuffer)
#define OMX_GetExtensionIndex(hComponent,cParameterName,pIndexType)
long int nThreadBufferMngtID
OMX_ERRORTYPE volcFillBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_U32 nBufferCountActual
int tsem_init(tsem_t *tsem, unsigned int val)
#define OMX_SetConfig(hComponent,nConfigIndex,pComponentConfigStructure)
int main(int argc, char *argv[])
execution of registration function
OMX_ERRORTYPE volcEventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent, OMX_U32 Data1, OMX_U32 Data2, OMX_PTR pEventData)
#define OMX_FillThisBuffer(hComponent,pBuffer)
OMX_CALLBACKTYPE callbacks
OMX_ERRORTYPE(* EventHandler)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_PTR pAppData, OMX_IN OMX_EVENTTYPE eEvent, OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2, OMX_IN OMX_PTR pEventData)
long int nThreadMessageID