33 #define GAIN_VALUE 100.0f
37 omx_volume_component_PrivateType* omx_volume_component_Private;
44 openmaxStandComp->
pComponentPrivate = calloc(1,
sizeof(omx_volume_component_PrivateType));
56 omx_volume_component_Private->ports = NULL;
69 if (omx_volume_component_Private->sPortTypesParam[
OMX_PortDomainAudio].nPorts && !omx_volume_component_Private->ports) {
71 if (!omx_volume_component_Private->ports) {
74 for (i=0; i < omx_volume_component_Private->sPortTypesParam[
OMX_PortDomainAudio].nPorts; i++) {
76 if (!omx_volume_component_Private->ports[i]) {
95 omx_volume_component_Private->gain =
GAIN_VALUE;
105 omx_volume_component_Private->currentQualityLevel = 1;
109 omx_volume_component_Private->multiResourceLevel[i]->CPUResourceRequested = volumeQualityLevels[i * 2];
110 omx_volume_component_Private->multiResourceLevel[i]->MemoryResourceRequested = volumeQualityLevels[i * 2 + 1];
122 omx_volume_component_PrivateType* omx_volume_component_Private = openmaxStandComp->
pComponentPrivate;
127 if (omx_volume_component_Private->ports) {
128 for (i=0; i < omx_volume_component_Private->sPortTypesParam[
OMX_PortDomainAudio].nPorts; i++) {
129 if(omx_volume_component_Private->ports[i]) {
130 omx_volume_component_Private->ports[i]->PortDestructor(omx_volume_component_Private->ports[i]);
133 free(omx_volume_component_Private->ports);
134 omx_volume_component_Private->ports=NULL;
147 int sampleCount = pInputBuffer->
nFilledLen / 2;
148 omx_volume_component_PrivateType* omx_volume_component_Private = openmaxStandComp->
pComponentPrivate;
150 if(omx_volume_component_Private->gain !=
GAIN_VALUE) {
151 for (i = 0; i < sampleCount; i++) {
153 (((
OMX_S16*) pInputBuffer->
pBuffer)[i] * (omx_volume_component_Private->gain / 100.0f));
166 OMX_PTR pComponentConfigStructure) {
170 omx_volume_component_PrivateType* omx_volume_component_Private = openmaxStandComp->
pComponentPrivate;
180 omx_volume_component_Private->gain = pVolume->
sVolume.
nValue;
193 OMX_PTR pComponentConfigStructure) {
196 omx_volume_component_PrivateType* omx_volume_component_Private = openmaxStandComp->
pComponentPrivate;
203 pVolume->
sVolume.
nValue = omx_volume_component_Private->gain;
218 OMX_PTR ComponentParameterStructure) {
228 omx_volume_component_PrivateType* omx_volume_component_Private = openmaxStandComp->
pComponentPrivate;
229 if (ComponentParameterStructure == NULL) {
234 switch(nParamIndex) {
243 if (portIndex <= 1) {
254 DEBUG(
DEB_LEV_ERR,
"In %s Incorrect State=%x lineno=%d\n",__func__,omx_volume_component_Private->state,__LINE__);
275 OMX_PTR ComponentParameterStructure) {
283 omx_volume_component_PrivateType* omx_volume_component_Private = openmaxStandComp->
pComponentPrivate;
284 if (ComponentParameterStructure == NULL) {
289 switch(nParamIndex) {
@ OMX_ErrorInsufficientResources
@ OMX_ErrorIncorrectStateOperation
@ OMX_IndexParamAudioPortFormat
@ OMX_IndexParamAudioInit
@ OMX_IndexParamStandardComponentRole
@ OMX_IndexConfigAudioVolume
@ OMX_NumericalDataSigned
@ OMX_AUDIO_PCMModeLinear
@ OMX_StateWaitForResources
OMX_ERRORTYPE base_audio_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput)
The base constructor for the generic OpenMAX ST Audio port.
OMX_ERRORTYPE omx_base_component_SetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
OMX_ERRORTYPE omx_base_component_ParameterSanityCheck(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_PTR pStructure, size_t size)
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
OMX_ERRORTYPE omx_base_component_GetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
OMX_ERRORTYPE omx_base_component_SetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
base SetConfig function
OMX_ERRORTYPE omx_base_component_GetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
base GetConfig function
OMX_ERRORTYPE checkHeader(OMX_PTR header, OMX_U32 size)
Checks the header of a structure for consistency with size and spec version.
#define DEFAULT_OUT_BUFFER_SIZE
OMX_ERRORTYPE omx_base_filter_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
The base filter contructor for the OpenMAX ST components.
OMX_ERRORTYPE omx_base_filter_Destructor(OMX_COMPONENTTYPE *openmaxStandComp)
the base filter destructor for ST OpenMAX components
#define OMX_BASE_FILTER_INPUTPORT_INDEX
#define OMX_BASE_FILTER_OUTPUTPORT_INDEX
#define DEB_LEV_FUNCTION_NAME
#define DEB_LEV_SIMPLE_SEQ
#define DEBUG(n, fmt, args...)
OMX_ERRORTYPE RM_RegisterComponent(char *name, int max_components)
OMX_ERRORTYPE omx_volume_component_SetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE omx_volume_component_GetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_volume_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_volume_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
OMX_ERRORTYPE omx_volume_component_GetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
void omx_volume_component_BufferMgmtCallback(OMX_COMPONENTTYPE *openmaxStandComp, OMX_BUFFERHEADERTYPE *pInputBuffer, OMX_BUFFERHEADERTYPE *pOutputBuffer)
OMX_ERRORTYPE omx_volume_component_SetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
#define VOLUME_QUALITY_LEVELS
#define MAX_VOLUME_COMPONENTS
OMX_AUDIO_PCMMODETYPE ePCMMode
OMX_NUMERICALDATATYPE eNumData
OMX_ERRORTYPE(* GetConfig)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_INOUT OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE(* SetConfig)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE(* SetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentParameterStructure)
OMX_ERRORTYPE(* GetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR pComponentParameterStructure)
OMX_PTR pComponentPrivate
OMX_AUDIO_PARAM_PORTFORMATTYPE sAudioParam