#include <OMX_Types.h>
#include <OMX_Component.h>
#include <OMX_Core.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <omx_base_filter.h>
#include <vorbis/codec.h>
#include <math.h>
Go to the source code of this file.
Copyright (C) 2007 STMicroelectronics Copyright (C) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
$Date$ Revision $Rev$ Author $Author$
Definition in file omx_vorbisdec_component.h.
#define AUDIO_DEC_BASE_NAME "OMX.st.audio_decoder" |
Definition at line 46 of file omx_vorbisdec_component.h.
#define AUDIO_DEC_VORBIS_NAME "OMX.st.audio_decoder.ogg.single" |
Definition at line 47 of file omx_vorbisdec_component.h.
#define AUDIO_DEC_VORBIS_ROLE "audio_decoder.ogg" |
Definition at line 48 of file omx_vorbisdec_component.h.
#define omx_vorbisdec_component_PrivateType_FIELDS |
Vorbisdec component private structure.
Definition at line 53 of file omx_vorbisdec_component.h.
OMX_ERRORTYPE omx_vorbis_decoder_MessageHandler | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
internalRequestMessageType * | message | |||
) |
handles the message generated by the IL client
message | is the message type |
Definition at line 692 of file omx_vorbisdec_component.c.
References DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, err, internalRequestMessageType::messageParam, internalRequestMessageType::messageType, omx_base_component_MessageHandler(), OMX_CommandStateSet, OMX_ErrorNone, OMX_StateIdle, OMX_StateLoaded, omx_vorbisdec_component_Deinit(), omx_vorbisdec_component_Init(), and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_vorbisdec_component_Constructor().
void omx_vorbisdec_component_BufferMgmtCallbackVorbis | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
OMX_BUFFERHEADERTYPE * | inputbuffer, | |||
OMX_BUFFERHEADERTYPE * | outputbuffer | |||
) |
central buffer management function
inputbuffer | contains the input ogg file content | |
outputbuffer | is returned along with its output pcm file content that is produced as a result of this function execution |
Fill up the current input buffer when a new buffer has arrived
for each new input buffer --- copy buffer content into into ogg sync state structure data
pcm is a multichannel float vector. In stereo, for example, pcm[0] is left, and pcm[1] is right. samples is the size of each channel. Convert the float values (-1.<=range<=1.) to whatever PCM format and write it out
Definition at line 277 of file omx_vorbisdec_component.c.
References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_BUFFERHEADERTYPE::nAllocLen, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BUFFERHEADERTYPE::nOffset, OMX_EventPortSettingsChanged, OMX_BUFFERHEADERTYPE::pBuffer, and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_vorbisdec_component_Constructor().
OMX_ERRORTYPE omx_vorbisdec_component_Constructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp, | |
OMX_STRING | cComponentName | |||
) |
The Constructor
cComponentName | is the name of the component to be initialized |
we could create our own port structures here fixme maybe the base class could use a "port factory" function pointer?
Domain specific section for the ports.
first we set the parameter common to both formats common parameters related to input port
Allocate Ports and call port constructor.
common parameters related to output port
settings of output port output is pcm audo format - so set the pcm mode settings
some more component private structure initialization
increase the counter of initialized components and check against the maximum limit
now it's time to know the audio coding type of the component if audio coding type is set other than vorbis then error returned
IL client specified an invalid component name
Definition at line 45 of file omx_vorbisdec_component.c.
References OMX_PARAM_PORTDEFINITIONTYPE::audio, AUDIO_DEC_BASE_NAME, AUDIO_DEC_VORBIS_NAME, base_audio_port_Constructor(), OMX_AUDIO_PORTDEFINITIONTYPE::cMIMEType, DEB_LEV_FUNCTION_NAME, DEBUG, DEFAULT_IN_BUFFER_SIZE, DEFAULT_OUT_BUFFER_SIZE, OMX_AUDIO_PARAM_PORTFORMATTYPE::eEncoding, OMX_AUDIO_PORTDEFINITIONTYPE::eEncoding, err, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_COMPONENTTYPE::GetParameter, MAX_COMPONENT_VORBISDEC, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_AUDIO_ChannelLF, OMX_AUDIO_ChannelRF, OMX_AUDIO_CodingPCM, OMX_AUDIO_CodingUnused, OMX_AUDIO_CodingVORBIS, OMX_AUDIO_PCMModeLinear, omx_base_filter_Constructor(), OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_BASE_FILTER_OUTPUTPORT_INDEX, OMX_EndianLittle, OMX_ErrorInsufficientResources, OMX_ErrorInvalidComponentName, OMX_ErrorNone, OMX_FALSE, OMX_NumericalDataSigned, OMX_TRUE, omx_vorbis_decoder_MessageHandler(), omx_vorbisdec_component_BufferMgmtCallbackVorbis(), omx_vorbisdec_component_Destructor(), omx_vorbisdec_component_GetParameter(), omx_vorbisdec_component_SetParameter(), OMX_COMPONENTTYPE::pComponentPrivate, omx_base_audio_PortType::sAudioParam, setHeader(), OMX_COMPONENTTYPE::SetParameter, omx_base_audio_PortType::sPortParam, and tsem_init().
Referenced by omx_component_library_Setup().
OMX_ERRORTYPE omx_vorbisdec_component_Deinit | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Deinitialization function
reset the vorbis decoder related parameters
Definition at line 254 of file omx_vorbisdec_component.c.
References err, OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_vorbis_decoder_MessageHandler().
OMX_ERRORTYPE omx_vorbisdec_component_Destructor | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The destructor
Definition at line 171 of file omx_vorbisdec_component.c.
References DEB_LEV_FUNCTION_NAME, DEBUG, omx_base_filter_Destructor(), OMX_ErrorNone, OMX_COMPONENTTYPE::pComponentPrivate, and tsem_deinit().
Referenced by omx_vorbisdec_component_Constructor().
OMX_ERRORTYPE omx_vorbisdec_component_GetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_INOUT OMX_PTR | ComponentParameterStructure | |||
) |
getting parameter values
hComponent | is handle of component | |
nParamIndex | is the indextype of the parameter | |
ComponentParameterStructure | is the structure to contain obtained parameter setings |
Definition at line 609 of file omx_vorbisdec_component.c.
References AUDIO_DEC_VORBIS_ROLE, checkHeader(), OMX_PARAM_COMPONENTROLETYPE::cRole, DEB_LEV_SIMPLE_SEQ, DEBUG, err, OMX_AUDIO_PARAM_VORBISTYPE::nPortIndex, OMX_AUDIO_PARAM_PCMMODETYPE::nPortIndex, OMX_AUDIO_PARAM_PORTFORMATTYPE::nPortIndex, OMX_AUDIO_CodingVORBIS, omx_base_component_GetParameter(), OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamAudioInit, OMX_IndexParamAudioPcm, OMX_IndexParamAudioPortFormat, OMX_IndexParamAudioVorbis, OMX_IndexParamStandardComponentRole, OMX_COMPONENTTYPE::pComponentPrivate, and omx_base_audio_PortType::sAudioParam.
Referenced by omx_vorbisdec_component_Constructor().
OMX_ERRORTYPE omx_vorbisdec_component_Init | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
The Initialization function
Temporary First Output buffer size
initializing vorbis decoder parameters
Definition at line 230 of file omx_vorbisdec_component.c.
References err, OMX_BASE_FILTER_OUTPUTPORT_INDEX, OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.
Referenced by omx_vorbis_decoder_MessageHandler().
void omx_vorbisdec_component_SetInternalParameters | ( | OMX_COMPONENTTYPE * | openmaxStandComp | ) |
sets some parameters of the private structure for decoding
Definition at line 202 of file omx_vorbisdec_component.c.
References OMX_AUDIO_PARAM_PORTFORMATTYPE::eEncoding, OMX_AUDIO_PARAM_PORTFORMATTYPE::nIndex, OMX_AUDIO_PARAM_PORTFORMATTYPE::nPortIndex, OMX_AUDIO_CodingVORBIS, OMX_BASE_FILTER_INPUTPORT_INDEX, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_audio_PortType::sAudioParam, and setHeader().
Referenced by omx_vorbisdec_component_SetParameter().
OMX_ERRORTYPE omx_vorbisdec_component_SetParameter | ( | OMX_IN OMX_HANDLETYPE | hComponent, | |
OMX_IN OMX_INDEXTYPE | nParamIndex, | |||
OMX_IN OMX_PTR | ComponentParameterStructure | |||
) |
setting parameter values
hComponent | is handle of component | |
nParamIndex | is the indextype of the parameter | |
ComponentParameterStructure | is the input structure containing parameter setings |
Check which structure we are being fed and make control its header
Check Structure Header and verify component state
Definition at line 522 of file omx_vorbisdec_component.c.
References AUDIO_DEC_VORBIS_ROLE, OMX_PARAM_COMPONENTROLETYPE::cRole, DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, err, OMX_AUDIO_PARAM_VORBISTYPE::nPortIndex, OMX_AUDIO_PARAM_PCMMODETYPE::nPortIndex, OMX_AUDIO_PARAM_PORTFORMATTYPE::nPortIndex, OMX_AUDIO_CodingVORBIS, omx_base_component_ParameterSanityCheck(), omx_base_component_SetParameter(), OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamAudioPcm, OMX_IndexParamAudioPortFormat, OMX_IndexParamAudioVorbis, OMX_IndexParamStandardComponentRole, omx_vorbisdec_component_SetInternalParameters(), OMX_COMPONENTTYPE::pComponentPrivate, and omx_base_audio_PortType::sAudioParam.
Referenced by omx_vorbisdec_component_Constructor().