omx_maddec_component.c File Reference

#include <omxcore.h>
#include <omx_base_audio_port.h>
#include <omx_maddec_component.h>
#include <id3tag.h>

Go to the source code of this file.

Defines

#define MIN(X, Y)   ((X) < (Y) ? (X) : (Y))
#define MAX_COMPONENT_MADDEC   4
#define TEMP_BUF_COPY_SPACE   1024
#define TEMP_BUFFER_SIZE   DEFAULT_IN_BUFFER_SIZE * 2

Functions

OMX_ERRORTYPE omx_maddec_component_madLibInit (omx_maddec_component_PrivateType *omx_maddec_component_Private)
void omx_maddec_component_madLibDeInit (omx_maddec_component_PrivateType *omx_maddec_component_Private)
OMX_ERRORTYPE omx_maddec_component_Constructor (OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
void omx_maddec_component_SetInternalParameters (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_maddec_component_Destructor (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_maddec_component_Init (OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE omx_maddec_component_Deinit (OMX_COMPONENTTYPE *openmaxStandComp)
void omx_maddec_component_BufferMgmtCallback (OMX_COMPONENTTYPE *openmaxStandComp, OMX_BUFFERHEADERTYPE *inputbuffer, OMX_BUFFERHEADERTYPE *outputbuffer)
OMX_ERRORTYPE omx_maddec_component_SetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_IN OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_maddec_component_GetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_mad_decoder_MessageHandler (OMX_COMPONENTTYPE *openmaxStandComp, internalRequestMessageType *message)


Detailed Description

This component implements an MP3 decoder based on mad software library.

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_maddec_component.c.


Define Documentation

#define MAX_COMPONENT_MADDEC   4

Maximum Number of Audio Mad Decoder Component Instance

Definition at line 39 of file omx_maddec_component.c.

Referenced by omx_maddec_component_Constructor().

#define MIN ( X,
 )     ((X) < (Y) ? (X) : (Y))

Definition at line 36 of file omx_maddec_component.c.

#define TEMP_BUF_COPY_SPACE   1024

This is used when the temporary buffer takes data of this length specified from input buffer before its processing

Definition at line 47 of file omx_maddec_component.c.

#define TEMP_BUFFER_SIZE   DEFAULT_IN_BUFFER_SIZE * 2

This is the temporary buffer size used for last portion of input buffer storage

Definition at line 50 of file omx_maddec_component.c.


Function Documentation

OMX_ERRORTYPE omx_mad_decoder_MessageHandler ( OMX_COMPONENTTYPE openmaxStandComp,
internalRequestMessageType message 
)

void omx_maddec_component_BufferMgmtCallback ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_BUFFERHEADERTYPE inputbuffer,
OMX_BUFFERHEADERTYPE outputbuffer 
)

This function is the buffer management callback function for MP3 decoding is used to process the input buffer and provide one output buffer

Parameters:
inputbuffer is the input buffer containing the input MP3 content
outputbuffer is the output buffer on which the output pcm content will be written

first copy TEMP_BUF_COPY_SPACE bytes of new input buffer to add with temporary buffer content

this flag setting disables the CRC check

if consumed is already set, it's from the resync higher up, so we need to use that value instead. Otherwise, recalculate from mad's consumption

if consumed is already set, it's from the resync higher up, so we need to use that value instead. Otherwise, recalculate from mad's consumption

if consumed is already set, it's from the resync higher up, so we need to use that value instead. Otherwise, recalculate from mad's consumption

Definition at line 360 of file omx_maddec_component.c.

References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_SIMPLE_SEQ, DEBUG, MIN, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BUFFERHEADERTYPE::nOffset, OMX_AUDIO_CodingMP3, OMX_EventPortSettingsChanged, OMX_BUFFERHEADERTYPE::pBuffer, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_maddec_component_Constructor().

OMX_ERRORTYPE omx_maddec_component_Constructor ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_STRING  cComponentName 
)

The Constructor

Parameters:
cComponentName name of the component to be constructed

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 parameters related to input port which does not depend upon input audio format

Allocate Ports and call port constructor.

parameters related to input port

parameters related to output port

settings of output port audio format - pcm

now it's time to know the audio coding type of the component

initialise the semaphore to be used for mad decoder access synchronization

general configuration irrespective of any audio formats setting values of other fields of omx_maddec_component_Private structure

initialising mad structures

Definition at line 75 of file omx_maddec_component.c.

References OMX_PARAM_PORTDEFINITIONTYPE::audio, AUDIO_DEC_BASE_NAME, AUDIO_DEC_MP3_NAME, base_audio_port_Constructor(), OMX_AUDIO_PORTDEFINITIONTYPE::cMIMEType, DEB_LEV_FUNCTION_NAME, DEB_LEV_SIMPLE_SEQ, 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_MADDEC, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_AUDIO_ChannelLF, OMX_AUDIO_ChannelModeStereo, OMX_AUDIO_ChannelRF, OMX_AUDIO_CodingMP3, OMX_AUDIO_CodingPCM, OMX_AUDIO_CodingUnused, OMX_AUDIO_MP3StreamFormatMP1Layer3, 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_mad_decoder_MessageHandler(), omx_maddec_component_BufferMgmtCallback(), omx_maddec_component_Destructor(), omx_maddec_component_GetParameter(), omx_maddec_component_SetParameter(), OMX_NumericalDataSigned, OMX_TRUE, 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_maddec_component_Deinit ( OMX_COMPONENTTYPE openmaxStandComp  ) 

OMX_ERRORTYPE omx_maddec_component_Destructor ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The destructor

freeing mad decoder structures

Definition at line 235 of file omx_maddec_component.c.

References DEB_LEV_FUNCTION_NAME, DEBUG, omx_base_filter_Destructor(), OMX_ErrorNone, OMX_COMPONENTTYPE::pComponentPrivate, and tsem_deinit().

Referenced by omx_maddec_component_Constructor().

OMX_ERRORTYPE omx_maddec_component_GetParameter ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nParamIndex,
OMX_INOUT OMX_PTR  ComponentParameterStructure 
)

OMX_ERRORTYPE omx_maddec_component_Init ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The Initialization function

initializing omx_maddec_component_Private->temporary_buffer with 2k memory space

Definition at line 281 of file omx_maddec_component.c.

References DEFAULT_IN_BUFFER_SIZE, err, OMX_ErrorNone, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_mad_decoder_MessageHandler().

void omx_maddec_component_madLibDeInit ( omx_maddec_component_PrivateType *  omx_maddec_component_Private  ) 

this function Deinitializates the mad framework, and close the mad decoder

Definition at line 64 of file omx_maddec_component.c.

Referenced by omx_mad_decoder_MessageHandler(), and omx_maddec_component_Deinit().

OMX_ERRORTYPE omx_maddec_component_madLibInit ( omx_maddec_component_PrivateType *  omx_maddec_component_Private  ) 

this function initializates the mad framework, and opens an mad decoder of type specified by IL client

Definition at line 53 of file omx_maddec_component.c.

References OMX_ErrorNone, and tsem_up().

Referenced by omx_mad_decoder_MessageHandler().

void omx_maddec_component_SetInternalParameters ( OMX_COMPONENTTYPE openmaxStandComp  ) 

OMX_ERRORTYPE omx_maddec_component_SetParameter ( OMX_IN OMX_HANDLETYPE  hComponent,
OMX_IN OMX_INDEXTYPE  nParamIndex,
OMX_IN OMX_PTR  ComponentParameterStructure 
)


Generated for OpenMAX Bellagio rel. 0.3.5-svn by  doxygen 1.5.1
SourceForge.net Logo