omx_alsasink_component.h File Reference

#include <OMX_Types.h>
#include <OMX_Component.h>
#include <OMX_Core.h>
#include <OMX_Audio.h>
#include <pthread.h>
#include <omx_base_sink.h>
#include <alsa/asoundlib.h>

Go to the source code of this file.

Defines

#define omx_alsasink_component_PrivateType_FIELDS

Functions

OMX_ERRORTYPE omx_alsasink_component_Constructor (OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
OMX_ERRORTYPE omx_alsasink_component_Destructor (OMX_COMPONENTTYPE *openmaxStandComp)
void omx_alsasink_component_BufferMgmtCallback (OMX_COMPONENTTYPE *openmaxStandComp, OMX_BUFFERHEADERTYPE *inputbuffer)
OMX_ERRORTYPE omx_alsasink_component_port_SendBufferFunction (omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
 the entry point for sending buffers to the alsa sink port
OMX_BOOL omx_alsasink_component_ClockPortHandleFunction (omx_alsasink_component_PrivateType *omx_alsasink_component_Private, OMX_BUFFERHEADERTYPE *inputbuffer)
OMX_ERRORTYPE omx_alsasink_component_GetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR ComponentParameterStructure)
OMX_ERRORTYPE omx_alsasink_component_SetParameter (OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_IN OMX_PTR ComponentParameterStructure)


Detailed Description

OpenMAX ALSA sink component. This component is an audio sink that uses ALSA library.

Copyright (C) 2007-2008 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
2008-06-27 12:00:23 +0200 (Fri, 27 Jun 2008)
Revision
Rev
554
Author
Author
pankaj_sen

Definition in file omx_alsasink_component.h.


Define Documentation

#define omx_alsasink_component_PrivateType_FIELDS

Value:

omx_base_sink_PrivateType_FIELDS \
  OMX_AUDIO_PARAM_PCMMODETYPE  sPCMModeParam; \
  char                         AudioPCMConfigured;  \
  snd_pcm_t*                   playback_handle;  \
  OMX_S32                      xScale; \
  OMX_TIME_CLOCKSTATE          eState; \
  snd_pcm_hw_params_t*         hw_params;
Alsasinkport component private structure. see the define above
Parameters:
sPCMModeParam Audio PCM specific OpenMAX parameter
AudioPCMConfigured boolean flag to check if the audio has been configured
playback_handle ALSA specif handle for audio player
xScale the scale of the media clock
eState the state of the media clock
hw_params ALSA specif hardware parameters

Definition at line 51 of file omx_alsasink_component.h.


Function Documentation

void omx_alsasink_component_BufferMgmtCallback ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_BUFFERHEADERTYPE inputbuffer 
)

This function plays the input buffer. When fully consumed it returns.

Definition at line 389 of file omx_alsasink_component.c.

References DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEBUG, dequeue(), err, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BUFFERHEADERTYPE::nFlags, OMX_BUFFERHEADERTYPE::nInputPortIndex, OMX_BUFFERHEADERTYPE::nTimeStamp, OMX_BASE_SINK_CLOCKPORT_INDEX, OMX_BASE_SINK_INPUTPORT_INDEX, OMX_BUFFERFLAG_STARTTIME, OMX_ErrorNone, OMX_FALSE, OMX_IndexConfigTimeClientStartTime, OMX_SetConfig, OMX_TIME_ClockStateRunning, OMX_TRUE, OMX_BUFFERHEADERTYPE::pBuffer, OMX_COMPONENTTYPE::pComponentPrivate, PORT_IS_BEING_FLUSHED, PORT_IS_TUNNELED, setHeader(), and tsem_down().

Referenced by omx_alsasink_component_Constructor().

OMX_BOOL omx_alsasink_component_ClockPortHandleFunction ( omx_alsasink_component_PrivateType *  omx_alsasink_component_Private,
OMX_BUFFERHEADERTYPE inputbuffer 
)

Definition at line 310 of file omx_alsasink_component.c.

References DEB_LEV_ERR, DEBUG, dequeue(), err, OMX_TIME_MEDIATIMETYPE::eUpdateType, fd, omx_base_clock_PortType::hTunneledComponent, OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE::nMediaTimestamp, OMX_TIME_MEDIATIMETYPE::nOffset, OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE::nOffset, OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE::nPortIndex, OMX_TIME_CONFIG_TIMESTAMPTYPE::nPortIndex, OMX_BUFFERHEADERTYPE::nTimeStamp, OMX_TIME_CONFIG_TIMESTAMPTYPE::nTimestamp, omx_base_clock_PortType::nTunneledPort, OMX_TIME_MEDIATIMETYPE::nWallTimeAtMediaTime, OMX_BASE_SINK_CLOCKPORT_INDEX, OMX_ErrorNone, OMX_FALSE, OMX_IndexConfigTimeCurrentAudioReference, OMX_IndexConfigTimeMediaTimeRequest, OMX_SetConfig, OMX_TIME_UpdateRequestFulfillment, OMX_TIME_UpdateScaleChanged, OMX_TRUE, OMX_BUFFERHEADERTYPE::pBuffer, omx_base_clock_PortType::pBufferQueue, omx_base_clock_PortType::pBufferSem, OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE::pClientPrivate, PORT_IS_BEING_FLUSHED, omx_base_clock_PortType::ReturnBufferFunction, tsem_t::semval, setHeader(), omx_base_clock_PortType::sMediaTimeRequest, tsem_down(), and OMX_TIME_MEDIATIMETYPE::xScale.

Referenced by omx_alsasink_component_port_SendBufferFunction().

OMX_ERRORTYPE omx_alsasink_component_Constructor ( OMX_COMPONENTTYPE openmaxStandComp,
OMX_STRING  cComponentName 
)

The Constructor

Allocate Ports and call port constructor.

Domain specific section for the ports.

Definition at line 48 of file omx_alsasink_component.c.

References OMX_PARAM_PORTDEFINITIONTYPE::audio, base_audio_port_Constructor(), base_clock_port_Constructor(), DEB_LEV_ERR, DEB_LEV_SIMPLE_SEQ, DEBUG, DEFAULT_OUT_BUFFER_SIZE, OMX_AUDIO_PARAM_PORTFORMATTYPE::eEncoding, OMX_AUDIO_PORTDEFINITIONTYPE::eEncoding, err, fd, OMX_PARAM_PORTDEFINITIONTYPE::format, OMX_COMPONENTTYPE::GetParameter, MAX_COMPONENT_ALSASINK, OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize, OMX_AUDIO_PARAM_PORTFORMATTYPE::nIndex, OMX_AUDIO_PARAM_PORTFORMATTYPE::nPortIndex, omx_alsasink_component_BufferMgmtCallback(), omx_alsasink_component_Destructor(), omx_alsasink_component_GetParameter(), omx_alsasink_component_port_SendBufferFunction(), omx_alsasink_component_SetParameter(), OMX_AUDIO_ChannelNone, OMX_AUDIO_CodingPCM, OMX_AUDIO_PCMModeLinear, omx_base_sink_Constructor(), OMX_BASE_SINK_INPUTPORT_INDEX, OMX_EndianLittle, OMX_ErrorHardware, OMX_ErrorInsufficientResources, OMX_ErrorNone, OMX_IndexParamAudioPcm, OMX_NumericalDataSigned, OMX_PortDomainAudio, OMX_PortDomainOther, OMX_TIME_ClockStateStopped, OMX_TRUE, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_audio_PortType::Port_SendBufferFunction, omx_base_audio_PortType::sAudioParam, setHeader(), OMX_COMPONENTTYPE::SetParameter, and omx_base_audio_PortType::sPortParam.

Referenced by omx_component_library_Setup().

OMX_ERRORTYPE omx_alsasink_component_Destructor ( OMX_COMPONENTTYPE openmaxStandComp  ) 

The Destructor

Definition at line 181 of file omx_alsasink_component.c.

References fd, omx_base_sink_Destructor(), OMX_PortDomainAudio, OMX_PortDomainOther, and OMX_COMPONENTTYPE::pComponentPrivate.

Referenced by omx_alsasink_component_Constructor().

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

Definition at line 715 of file omx_alsasink_component.c.

References checkHeader(), DEB_LEV_SIMPLE_SEQ, DEBUG, err, OMX_OTHER_PARAM_PORTFORMATTYPE::nPortIndex, OMX_AUDIO_PARAM_PORTFORMATTYPE::nPortIndex, omx_base_component_GetParameter(), OMX_BASE_SINK_INPUTPORT_INDEX, OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorNone, OMX_IndexParamAudioInit, OMX_IndexParamAudioPcm, OMX_IndexParamAudioPortFormat, OMX_IndexParamOtherInit, OMX_IndexParamOtherPortFormat, OMX_PortDomainAudio, OMX_PortDomainOther, OMX_COMPONENTTYPE::pComponentPrivate, and omx_base_audio_PortType::sAudioParam.

Referenced by omx_alsasink_component_Constructor().

OMX_ERRORTYPE omx_alsasink_component_port_SendBufferFunction ( omx_base_PortType openmaxStandPort,
OMX_BUFFERHEADERTYPE pBuffer 
)

the entry point for sending buffers to the alsa sink port

This function can be called by the EmptyThisBuffer or FillThisBuffer. It depends on the nature of the port, that can be an input or output port.

Definition at line 218 of file omx_alsasink_component.c.

References omx_base_component_PrivateType::bMgmtSem, checkHeader(), DEB_LEV_ERR, DEB_LEV_FULL_SEQ, DEB_LEV_FUNCTION_NAME, DEB_LEV_PARAMS, DEBUG, OMX_PARAM_PORTDEFINITIONTYPE::eDir, err, omx_base_component_PrivateType::name, OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountActual, OMX_BUFFERHEADERTYPE::nFilledLen, OMX_BUFFERHEADERTYPE::nFlags, OMX_BUFFERHEADERTYPE::nInputPortIndex, OMX_BUFFERHEADERTYPE::nOutputPortIndex, OMX_PARAM_PORTDEFINITIONTYPE::nPortIndex, omx_alsasink_component_ClockPortHandleFunction(), OMX_BASE_SINK_CLOCKPORT_INDEX, OMX_BASE_SINK_INPUTPORT_INDEX, OMX_BUFFERFLAG_STARTTIME, OMX_DirInput, OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorIncorrectStateOperation, OMX_ErrorInvalidState, OMX_ErrorNone, OMX_FALSE, OMX_StateExecuting, OMX_StateIdle, OMX_StateInvalid, OMX_StatePause, OMX_TransStateExecutingToIdle, OMX_TRUE, OMX_BUFFERHEADERTYPE::pBuffer, omx_base_PortType::pBufferQueue, omx_base_PortType::pBufferSem, OMX_COMPONENTTYPE::pComponentPrivate, omx_base_PortType::pInternalBufferStorage, PORT_IS_BEING_DISABLED, PORT_IS_BEING_FLUSHED, PORT_IS_BUFFER_SUPPLIER, PORT_IS_ENABLED, PORT_IS_TUNNELED, PORT_IS_TUNNELED_N_BUFFER_SUPPLIER, omx_base_component_PrivateType::ports, queue(), omx_base_PortType::sPortParam, omx_base_PortType::standCompContainer, omx_base_component_PrivateType::state, omx_base_component_PrivateType::transientState, and tsem_up().

Referenced by omx_alsasink_component_Constructor().

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

Each time we are (re)configuring the hw_params thing we need to reinitialize it, otherwise previous changes will not take effect. e.g.: changing a previously configured sampling rate does not have any effect if we are not calling this each time.

Configure and prepare the ALSA handle

Definition at line 480 of file omx_alsasink_component.c.

References DEB_LEV_ERR, DEB_LEV_PARAMS, DEB_LEV_SIMPLE_SEQ, DEBUG, OMX_OTHER_PARAM_PORTFORMATTYPE::eFormat, err, OMX_AUDIO_PARAM_MP3TYPE::nPortIndex, OMX_OTHER_PARAM_PORTFORMATTYPE::nPortIndex, OMX_AUDIO_PARAM_PORTFORMATTYPE::nPortIndex, OMX_AUDIO_PCMModeALaw, OMX_AUDIO_PCMModeLinear, OMX_AUDIO_PCMModeMULaw, omx_base_component_ParameterSanityCheck(), omx_base_component_SetParameter(), OMX_BASE_SINK_INPUTPORT_INDEX, OMX_EndianLittle, OMX_ErrorBadParameter, OMX_ErrorBadPortIndex, OMX_ErrorHardware, OMX_ErrorNone, OMX_IndexParamAudioMp3, OMX_IndexParamAudioPcm, OMX_IndexParamAudioPortFormat, OMX_IndexParamOtherPortFormat, OMX_NumericalDataSigned, OMX_NumericalDataUnsigned, OMX_TRUE, OMX_COMPONENTTYPE::pComponentPrivate, rate, and omx_base_audio_PortType::sAudioParam.

Referenced by omx_alsasink_component_Constructor().


Generated for OpenMAX Bellagio rel. 0.9.0 by  doxygen 1.5.1
SourceForge.net Logo