30#define BUFFER_COUNT_ACTUAL 2
31#define FRAME_SIZE 1152*2*2
50 printf(
"Usage: omxaudiomixertest [-o outfile] [-gi gain] -t -r 44100 -n 2 filename0 [filename1 filename2 filename3]\n");
52 printf(
" -o outfile: If this option is specified, the output stream is written to outfile\n");
53 printf(
" otherwise redirected to std output\n");
54 printf(
" -gi : Gain of stream i[0..3] data [0...100]\n");
55 printf(
" -r 44100 : Sample Rate [Default 44100]\n");
56 printf(
" -n 2 : Number of channel [Default 2]\n\n");
57 printf(
" -h : Displays this help\n");
78static int iBufferDropped[4];
80int main(
int argc,
char** argv) {
90 int index_files = 0, index_gain = 0;
95 gain[0]=gain[1]=gain[2]=gain[3]=100;
113 while (argn_dec<argc) {
114 if (*(argv[argn_dec]) ==
'-') {
118 switch (*(argv[argn_dec]+1)) {
126 index_gain = atoi(argv[argn_dec]+2);
144 gain[index_gain] = (int)atoi(argv[argn_dec]);
147 if(gain[index_gain] > 100) {
149 gain[index_gain] = 100;
153 output_file = malloc(strlen(argv[argn_dec]) *
sizeof(
char) + 1);
158 srate = (int)atoi(argv[argn_dec]);
161 nchannel = (int)atoi(argv[argn_dec]);
167 input_file[index_files] = malloc(strlen(argv[argn_dec]) *
sizeof(
char) + 1);
168 strcpy(
input_file[index_files],argv[argn_dec]);
193 for (i = 0; i<index_files; i++) {
210 for (i = 0; i<index_files; i++) {
222 iBufferDropped[0] = 0;
223 iBufferDropped[1] = 0;
224 iBufferDropped[2] = 0;
225 iBufferDropped[3] = 0;
242 if((gain[j] >= 0) && (gain[j] <100)) {
267 for (j = index_files; j<4; j++) {
273 for (j = 0; j < index_files; j++) {
288 for (j=0; j<8; j++) {
294 for(j=0; j<index_files; j++) {
325 for (i = 0; i<index_files; i++) {
335 for (i = 0; i<index_files; i++) {
348 DEBUG(
DEFAULT_MESSAGES,
"\nIf you want to disabled port enter port number[0..3]: else Enter 'q' \n\n");
350 DEBUG(
DEFAULT_MESSAGES,
"Port status 0=%i, 1=%i, 2=%i, 3=%i\n",isPortDisabled[0], isPortDisabled[1], isPortDisabled[2], isPortDisabled[3]);
356 }
else if(c ==
'q') {
363 if (isPortDisabled[i] ==
OMX_TRUE) {
379 while(iBufferDropped[i]!=2) {
386 iBufferDropped[i] = 0;
418 for(j=0; j<index_files; j++) {
444 for (i = 0; i<index_files; i++) {
465 switch ((
int)Data2) {
521 if (data_read <= 0) {
564 if(pBuffer != NULL) {
566 DEBUG(
DEB_LEV_ERR,
"Ouch! In %s: no data in the output buffer!\n", __func__);
575 putchar(*(
char*)(pBuffer->
pBuffer + i));
586 DEBUG(
DEB_LEV_ERR,
"Ouch! In %s: had NULL buffer to output...\n", __func__);
595static int getFileSize(
int fd) {
597 struct stat input_file_stat;
601 err = fstat(
fd, &input_file_stat);
606 return input_file_stat.st_size;
@ OMX_IndexParamAudioInit
@ OMX_IndexParamPortDefinition
@ OMX_IndexConfigAudioVolume
#define OMX_BUFFERFLAG_EOS
#define OMX_FillThisBuffer( hComponent, pBuffer)
#define OMX_FreeBuffer( hComponent, nPortIndex, pBuffer)
#define OMX_AllocateBuffer( hComponent, ppBuffer, nPortIndex, pAppPrivate, nSizeBytes)
#define OMX_EmptyThisBuffer( hComponent, pBuffer)
#define OMX_SetConfig( hComponent, nConfigIndex, pComponentConfigStructure)
#define OMX_GetConfig( hComponent, nConfigIndex, pComponentConfigStructure)
#define OMX_GetParameter( hComponent, nParamIndex, pComponentParameterStructure)
#define OMX_SendCommand( hComponent, Cmd, nParam, pCmdData)
#define OMX_SetParameter( hComponent, nParamIndex, pComponentParameterStructure)
@ OMX_StateWaitForResources
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)
OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void)
The OMX_Init standard function.
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
#define DEB_LEV_SIMPLE_SEQ
#define DEBUG(n, fmt, args...)
OMX_BUFFERHEADERTYPE * inBufferSink[2]
OMX_CALLBACKTYPE callbacks
int main(int argc, char **argv)
OMX_BUFFERHEADERTYPE * outBuffer[2]
OMX_ERRORTYPE audiomixerEmptyBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_BUFFERHEADERTYPE * inBuffer[8]
OMX_ERRORTYPE audiomixerFillBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
#define BUFFER_COUNT_ACTUAL
OMX_ERRORTYPE audiomixerEventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_EVENTTYPE eEvent, OMX_U32 Data1, OMX_U32 Data2, OMX_PTR pEventData)
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)
OMX_U32 nBufferCountActual
void tsem_up(tsem_t *tsem)
int tsem_init(tsem_t *tsem, unsigned int val)
void tsem_down(tsem_t *tsem)
struct OMX_VERSIONTYPE::@1 s