Here's some general OMX related information you may be looking for:

1) The omx component contains the initial default parameters that are
hard-coded (e.g. sampling rate, num of channels etc.). These values
are prescribed by the omx specification.

2) THere are 2 methods to change the default parameters when decoding
starts

A) set parameters from outside the OMX component.

If you have a parser that you can trust - and the parser is capable of
parsing the configuration data - the OMX client (i.e. the omx decoder
node) can find out some of the parameters (by calling the
OMXConfigParser) and then
do a OMX_SetParameter call with the appropriate OMX index and the
"trusted" port parameters.
In some cases (e.g. AAC) - the parameters obtained from config data
cannot be trusted, and in some cases - there is no configuration
header (e.g. MP3) and it is necessary to decode the entire 1st frame
before having the correct parameters.

B) The OMX component detects parameters and sets the values in the
component output port.

The omx component (i.e. decoder within it) parses the config data
(located in the first omx buffer for most formats - or simply decodes
the first mp3 frame) and determines the parameters such as the number
of channels, sampling rate.
Once these parameters are known they are set in the omx component
output port.
If these parameters are different from the parameters that are already
in the port (either the initial/default ones or (if applicable - the
ones set from outside the component through method 2A)) - the omx
component needs to generate  the "port settings changed event" to let
the client know that the paramteres have changed.

I hope this is helpful.
Dusan


On Jul 14, 6:43 am, RaviY <yend...@pv.com> wrote:
> No. The config information (which is 2 bytes) is sent before any other
> frames are sent.
>
> On Jul 13, 11:57 pm, sesha giri <sesha_giri_n...@yahoo.co.in> wrote:
>
> > Do you mean to say that aac parser adds the header to the frame..
>
> > ________________________________
> > From: RaviY <yend...@pv.com>
> > To: android-framework <android-framework@googlegroups.com>
> > Sent: Monday, 13 July, 2009 11:49:45 PM
> > Subject: Re: how does omx component comes to know about the number of 
> > channels  and sampling rate of the audio clip
>
> > You can look at how this "config" information is passed from the aac
> > parser to the aac decoder. NOTE: The parameter values are not directly
> > sent to the decoder. Instead, they are sent in a buffer (called the
> > config buffer) which the decoder is supposed to understand and decode.
>
> > -Ravi
>
> > On Jul 13, 12:58 pm, sesha giri <sesha_giri_n...@yahoo.co.in> wrote:
>
> > > Hi Ravi,
>
> > > I am trying to use my own g711 decoder instead of the existing g711 
> > > decoder.
> > > But in case of g711 decoder the frames given to decoder does not decode 
> > > the sampling frequecy info.
> > > So thats the reason by some means I wanted to pass this info from wav 
> > > parser to decode component.
>
> > > --Giri
>
> > > ________________________________
> > > From: RaviY <yend...@pv.com>
> > > To: android-framework <android-framework@googlegroups.com>
> > > Sent: Monday, 13 July, 2009 7:11:20 PM
> > > Subject: Re: how does omx component comes to know about the number of 
> > > channels  and sampling rate of the audio clip
>
> > > - We don't pass that information from the parser node to the decoder
> > > node. The main reason being that we don't trust that information.
> > > - There isn't and shouldn't be any information about the bitstream
> > > that the decoder cannot decipher.
> > > - Once again, why do you have a decoder for a WAV content? Are you
> > > adding support for formats other than PCM, ulaw, and alaw?
>
> > > -Ravi
>
> > > On Jul 13, 1:28 am, sesha giri <sesha_giri_n...@yahoo.co.in> wrote:
>
> > > > Hi Ravi,
>
> > > > I had seen this case in pvmf_omx_audiodec_node.cpp
>
> > > > This is what the case(The code is from the cupcake version of Android):
> > > >        case OMX_EventPortSettingsChanged:
> > > >         {
> > > >             
> > > > LOGD("EventHandlerProcessing::OMX_EventPortSettingsChanged");
> > > >             PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, 
> > > > PVLOGMSG_STACK_TRACE,
> > > >                             (0, 
> > > > "PVMFOMXAudioDecNode::EventHandlerProcessing: 
> > > > OMX_EventPortSettingsChanged returned from OMX component"));
>
> > > >             // first check if dynamic reconfiguration is already in 
> > > > progress,
> > > >             // if so, wait until this is completed, and then initiate 
> > > > the 2nd reconfiguration
> > > >             if (iDynamicReconfigInProgress)
> > > >             {
> > > >                 
> > > > LOGD("EventHandlerProcessing::OMX_EventPortSettingsChanged::iDynamicReconfigInProgress");
> > > >                 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, 
> > > > PVLOGMSG_STACK_TRACE,
> > > >                                 (0, 
> > > > "PVMFOMXAudioDecNode::EventHandlerProcessing: 
> > > > OMX_EventPortSettingsChanged returned for port %d, dynamic reconfig 
> > > > already in progress", aData1));
>
> > > >                 iSecondPortToReconfig = aData1;
> > > >                 iSecondPortReportedChange = true;
>
> > > >                 // check the audio sampling rate and fs right away in 
> > > > case of output port
> > > >                 // is this output port?
> > > >                 if (iSecondPortToReconfig == iOutputPortIndex)
> > > >                 {
>
> > > >                     OMX_ERRORTYPE Err;
> > > >                     // GET the output buffer params and sizes
> > > >                     OMX_AUDIO_PARAM_PCMMODETYPE Audio_Pcm_Param;
> > > >                     Audio_Pcm_Param.nPortIndex = iOutputPortIndex; // 
> > > > we're looking for output port params
> > > >                     Audio_Pcm_Param.nSize = 
> > > > sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
> > > >                     Audio_Pcm_Param.nVersion.s.nVersionMajor = 
> > > > SPECVERSIONMAJOR;
> > > >                     Audio_Pcm_Param.nVersion.s.nVersionMinor = 
> > > > SPECVERSIONMINOR;
> > > >                     Audio_Pcm_Param.nVersion.s.nRevision = SPECREVISION;
> > > >                     Audio_Pcm_Param.nVersion.s.nStep = SPECSTEP;
>
> > > >                     Err = OMX_GetParameter(iOMXAudioDecoder, 
> > > > OMX_IndexParamAudioPcm, &Audio_Pcm_Param);
> > > >                     if (Err != OMX_ErrorNone)
> > > >                     {
> > > >                         PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, 
> > > > PVLOGMSG_ERR,
> > > >                                         (0, 
> > > > "PVMFOMXAudioDecNode::EventHandlerProcessing() PortSettingsChanged -> 
> > > > Cannot get component output parameters"));
>
> > > >                         SetState(EPVMFNodeError);
> > > >                         ReportErrorEvent(PVMFErrResource);
> > > >                     }
>
> > > >                     iPCMSamplingRate = Audio_Pcm_Param.nSamplingRate; 
> > > > // can be set to 0 (if unknown)
>
> > > >                     if (iPCMSamplingRate == 0) // use default sampling 
> > > > rate (i.e. 48000)
> > > >                         iPCMSamplingRate = 
> > > > PVOMXAUDIODEC_DEFAULT_SAMPLINGRATE;
>
> > > >                     iNumberOfAudioChannels = Audio_Pcm_Param.nChannels; 
> > > >        // should be 1 or 2
> > > >                     if (iNumberOfAudioChannels != 1 && 
> > > > iNumberOfAudioChannels != 2)
> > > >                     {
> > > >                         PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, 
> > > > PVLOGMSG_ERR,
> > > >                                         (0, 
> > > > "PVMFOMXAudioDecNode::EventHandlerProcessing() PortSettingsChanged -> 
> > > > Output parameters num channels = %d", iNumberOfAudioChannels));
>
> > > >                         SetState(EPVMFNodeError);
> > > >                         ReportErrorEvent(PVMFErrResource);
> > > >                     }
> > > >                 }
> > > >             }
> > > >             else
> > > >             {
> > > >                 PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, 
> > > > PVLOGMSG_STACK_TRACE,
> > > >                                 (0, 
> > > > "PVMFOMXAudioDecNode::EventHandlerProcessing: 
> > > > OMX_EventPortSettingsChanged returned for port %d", aData1));
>
> > > >                 iProcessingState = 
> > > > EPVMFOMXAudioDecNodeProcessingState_PortReconfig;
> > > >                 iPortIndexForDynamicReconfig = aData1;
> > > >                 // start "discarding" data right away, don't wait
> > > >                 // check the audio sampling rate and fs right away in 
> > > > case of output port
> > > >                 // is this output port?
> > > >                 if (iPortIndexForDynamicReconfig == iOutputPortIndex)
> > > >                 {
>
> > > >                     OMX_ERRORTYPE Err;
> > > >                     // GET the output buffer params and sizes
> > > >                     OMX_AUDIO_PARAM_PCMMODETYPE Audio_Pcm_Param;
> > > >                     Audio_Pcm_Param.nPortIndex = iOutputPortIndex; // 
> > > > we're looking for output port params
> > > >                     Audio_Pcm_Param.nSize = 
> > > > sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
> > > >                     Audio_Pcm_Param.nVersion.s.nVersionMajor = 
> > > > SPECVERSIONMAJOR;
> > > >                     Audio_Pcm_Param.nVersion.s.nVersionMinor = 
> > > > SPECVERSIONMINOR;
> > > >                     Audio_Pcm_Param.nVersion.s.nRevision = SPECREVISION;
> > > >                     Audio_Pcm_Param.nVersion.s.nStep = SPECSTEP;
>
> > > >                     Err = OMX_GetParameter(iOMXAudioDecoder, 
> > > > OMX_IndexParamAudioPcm, &Audio_Pcm_Param);
> > > >                     if (Err != OMX_ErrorNone)
> > > >                     {
> > > >                         PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, 
> > > > PVLOGMSG_ERR,
> > > >                                         (0, 
> > > > "PVMFOMXAudioDecNode::EventHandlerProcessing() PortSettingsChanged -> 
> > > > Cannot get component output parameters"));
>
> > > >                         SetState(EPVMFNodeError);
> > > >                         ReportErrorEvent(PVMFErrResource);
>
> > > >                     }
>
> > > >                     iPCMSamplingRate = Audio_Pcm_Param.nSamplingRate; 
> > > > // can be set to 0 (if unknown)
>
> > > >                     if (iPCMSamplingRate == 0) // use default sampling 
> > > > rate (i.e. 48000)
> > > >                         iPCMSamplingRate = 
> > > > PVOMXAUDIODEC_DEFAULT_SAMPLINGRATE;
>
> > > >                     iNumberOfAudioChannels = Audio_Pcm_Param.nChannels; 
> > > >        // should be 1 or 2
> > > >                     if (iNumberOfAudioChannels != 1 && 
> > > > iNumberOfAudioChannels != 2)
> > > >                     {
> > > >                         PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, 
> > > > PVLOGMSG_ERR,
> > > >                                         (0, 
> > > > "PVMFOMXAudioDecNode::EventHandlerProcessing() PortSettingsChanged -> 
> > > > Output parameters num channels = %d", iNumberOfAudioChannels));
>
> > > >                         SetState(EPVMFNodeError);
> > > >                         ReportErrorEvent(PVMFErrResource);
>
> > > >                     }
>
> > > >                 }
> > > >                 iDynamicReconfigInProgress = true;
> > > >             }
>
> > > >            
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to