luc4
Posts: 46
Joined: Mon Nov 12, 2012 12:28 am

OMX_ErrorUnsupportedSetting from audio_decode component

Mon Dec 31, 2012 4:38 pm

Hi! I'm trying to use the audio_decode component to decode an AAC stream. My problem is that I keep getting a OMX_ErrorUnsupportedSetting error event after the buffers are provided. I checked the omxplayer code but I seem to be doing the same steps. I see there is no sample code for this component in the hello_pi collection. Is there a way to get information about which setup is wrong?
I've done more or less the same I've done for the video_decode component:

Created the component;
disabled all the ports;
set state to idle;
set port format to use OMX_AUDIO_CodingAAC;
set port definition with these values (not sure if needed):
profileType.nSampleRate = 48000;
profileType.nFrameLength = 0;
profileType.nChannels = 6;
profileType.nBitRate = 288000;
profileType.nAudioBandWidth = 0;
set OMX_PARAM_CODECCONFIGTYPE with bCodecConfigIsComplete to 1;
set OMX_IndexParamBrcmDecoderPassThrough to true.

Anything missing?
Is the audio_decode component sources available? In that case I could place some logs to try to guess what I'm missing... Anyone who can provide any advice?
Thanks!

adamzimny
Posts: 2
Joined: Sun Jan 06, 2013 9:49 pm

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Sun Jan 06, 2013 9:57 pm

Hi,
I have the same problem, I was trying to adapt hello_audio example from the hello_pi collection to decode mp3 but I got stuck at the same point. The code is here: https://github.com/adamzimny/hello_pi

luc4
Posts: 46
Joined: Mon Nov 12, 2012 12:28 am

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Sun Jan 06, 2013 10:17 pm

For the moment I'm decoding in software using ffmpeg, but isn't there anyone who can be asked this?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23646
Joined: Sat Jul 30, 2011 7:41 pm

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Mon Jan 07, 2013 12:01 am

luc4 wrote:For the moment I'm decoding in software using ffmpeg, but isn't there anyone who can be asked this?
i'm looking at the source now, but something is odd - I can only find a few references to OMX_ErrorUnsupportedSetting being returned, and they are all related to video. There's something I'm not understanding, so will need to take a deeper look. This code is pretty convoluted. It one of my bugbears about OpenMAX - the error reporting sucks - you get an error, but absolutely no idea what caused it. Especially in these port settings cases where there are so many options that could cause a failure, but you have no idea which one it is. You then need to debug, and in the Raspi's case you don't have access to the GPU side where some of this stuff is worked out.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23646
Joined: Sat Jul 30, 2011 7:41 pm

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Mon Jan 07, 2013 12:10 am

These are the possible setting available for AAC, worth making sure as much as possible is set up. I presume one of the setting you need is actually missing in your code.

Code: Select all

typedef enum OMX_AUDIO_AACSTREAMFORMATTYPE {
    OMX_AUDIO_AACStreamFormatMP2ADTS = 0, /**< AAC Audio Data Transport Stream 2 format */
    OMX_AUDIO_AACStreamFormatMP4ADTS,     /**< AAC Audio Data Transport Stream 4 format */
    OMX_AUDIO_AACStreamFormatMP4LOAS,     /**< AAC Low Overhead Audio Stream format */
    OMX_AUDIO_AACStreamFormatMP4LATM,     /**< AAC Low overhead Audio Transport Multiplex */
    OMX_AUDIO_AACStreamFormatADIF,        /**< AAC Audio Data Interchange Format */
    OMX_AUDIO_AACStreamFormatMP4FF,       /**< AAC inside MPEG-4/ISO File Format */
    OMX_AUDIO_AACStreamFormatRAW,         /**< AAC Raw Format */
    OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
    OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
    OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF
} OMX_AUDIO_AACSTREAMFORMATTYPE;


/** AAC mode type.  Note that the term profile is used with the MPEG-2
 * standard and the term object type and profile is used with MPEG-4 */
typedef enum OMX_AUDIO_AACPROFILETYPE{
 OMX_AUDIO_AACObjectNull = 0,      /**< Null, not used */
  OMX_AUDIO_AACObjectMain = 1,      /**< AAC Main object */
  OMX_AUDIO_AACObjectLC,            /**< AAC Low Complexity object (AAC profile) */
  OMX_AUDIO_AACObjectSSR,           /**< AAC Scalable Sample Rate object */
  OMX_AUDIO_AACObjectLTP,           /**< AAC Long Term Prediction object */
  OMX_AUDIO_AACObjectHE,            /**< AAC High Efficiency (object type SBR, HE-AAC profile) */
  OMX_AUDIO_AACObjectScalable,      /**< AAC Scalable object */
  OMX_AUDIO_AACObjectERLC = 17,     /**< ER AAC Low Complexity object (Error Resilient AAC-LC) */
  OMX_AUDIO_AACObjectLD = 23,       /**< AAC Low Delay object (Error Resilient) */
  OMX_AUDIO_AACObjectHE_PS = 29,    /**< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) */
  OMX_AUDIO_AACObjectKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
  OMX_AUDIO_AACObjectVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
  OMX_AUDIO_AACObjectMax = 0x7FFFFFFF
} OMX_AUDIO_AACPROFILETYPE;


/** AAC tool usage (for nAACtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
 * Required for encoder configuration and optional as decoder info output.
 * For MP3, OMX_AUDIO_CHANNELMODETYPE is sufficient. */
#define OMX_AUDIO_AACToolNone 0x00000000 /**< no AAC tools allowed (encoder config) or active (decoder info output) */
#define OMX_AUDIO_AACToolMS   0x00000001 /**< MS: Mid/side joint coding tool allowed or active */
#define OMX_AUDIO_AACToolIS   0x00000002 /**< IS: Intensity stereo tool allowed or active */
#define OMX_AUDIO_AACToolTNS  0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */
#define OMX_AUDIO_AACToolPNS  0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */
#define OMX_AUDIO_AACToolLTP  0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */
#define OMX_AUDIO_AACToolAll  0x7FFFFFFF /**< all AAC tools allowed or active (*/

/** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE).
 * Required for ER encoder configuration and optional as decoder info output */
#define OMX_AUDIO_AACERNone  0x00000000  /**< no AAC ER tools allowed/used */
#define OMX_AUDIO_AACERVCB11 0x00000001  /**< VCB11: Virtual Code Books for AAC section data */
#define OMX_AUDIO_AACERRVLC  0x00000002  /**< RVLC: Reversible Variable Length Coding */
#define OMX_AUDIO_AACERHCR   0x00000004  /**< HCR: Huffman Codeword Reordering */
#define OMX_AUDIO_AACERAll   0x7FFFFFFF  /**< all AAC ER tools allowed/used */


/** AAC params */
typedef struct OMX_AUDIO_PARAM_AACPROFILETYPE {
    OMX_U32 nSize;                 /**< Size of this structure, in Bytes */
    OMX_VERSIONTYPE nVersion;      /**< OMX specification version information */
    OMX_U32 nPortIndex;            /**< Port that this structure applies to */
    OMX_U32 nChannels;             /**< Number of channels */
    OMX_U32 nSampleRate;           /**< Sampling rate of the source data.  Use 0 for
                                        variable or unknown sampling rate. */
   OMX_U32 nBitRate;              /**< Bit rate of the input data.  Use 0 for variable
                                        rate or unknown bit rates */
    OMX_U32 nAudioBandWidth;       /**< Audio band width (in Hz) to which an encoder should
                                        limit the audio signal. Use 0 to let encoder decide */
    OMX_U32 nFrameLength;          /**< Frame length (in audio samples per channel) of the codec.
                                        Can be 1024 or 960 (AAC-LC), 2048 (HE-AAC), 480 or 512 (AAC-LD).
                                        Use 0 to let encoder decide */
    OMX_U32 nAACtools;             /**< AAC tool usage */
    OMX_U32 nAACERtools;           /**< MPEG-4 AAC error resilience tool usage */
    OMX_AUDIO_AACPROFILETYPE eAACProfile;   /**< AAC profile enumeration */
    OMX_AUDIO_AACSTREAMFORMATTYPE eAACStreamFormat; /**< AAC stream format enumeration */
    OMX_AUDIO_CHANNELMODETYPE eChannelMode;   /**< Channel mode enumeration */
} OMX_AUDIO_PARAM_AACPROFILETYPE;
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

luc4
Posts: 46
Joined: Mon Nov 12, 2012 12:28 am

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Mon Jan 07, 2013 7:30 am

I tried many configurations, but this is what I supposed is needed:

Code: Select all

    // Query input buffer requirements.
    OMX_PARAM_PORTDEFINITIONTYPE portDef;
    OMX_INIT_STRUCTURE(portDef);
    portDef.nPortIndex = 120;
    compDecoder->GetParameter(OMX_IndexParamPortDefinition, &portDef);
    portDef.nBufferCountActual = 4;
    portDef.nBufferSize = 6144;
    portDef.format.audio.eEncoding = OMX_AUDIO_CodingAAC;
    compDecoder->SetParameter(OMX_IndexParamPortDefinition, &portDef);
    LOG_DEBUG(LOG_TAG,
              "bufferCount = %lu, bufferSize = %lu, min = %lu.",
              portDef.nBufferCountActual,
              portDef.nBufferSize,
              portDef.nBufferCountMin
              );

    OMX_AUDIO_PARAM_PORTFORMATTYPE portFormat;
    OMX_INIT_STRUCTURE(portFormat);
    portFormat.nPortIndex = 120;
    compDecoder->GetParameter(OMX_IndexParamAudioPortFormat, &portFormat);
    portFormat.eEncoding  = OMX_AUDIO_CodingAAC;
    compDecoder->SetParameter(OMX_IndexParamAudioPortFormat, &portFormat);

    LOG_VERBOSE(LOG_TAG, "Setting profile type...");
    OMX_AUDIO_PARAM_AACPROFILETYPE profileType;
    OMX_INIT_STRUCTURE(profileType);
    profileType.nPortIndex  = 120;
    compDecoder->GetParameter(OMX_IndexParamAudioAac, &profileType);

    profileType.nSampleRate = 48000;
    profileType.nFrameLength = 0;
    profileType.nChannels = 6;
    profileType.nBitRate = 288000;
    profileType.nAudioBandWidth = 0;
    profileType.eAACProfile = OMX_AUDIO_AACObjectLC;
    profileType.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMP4ADTS;
    profileType.eChannelMode = OMX_AUDIO_ChannelModeStereo;
    compDecoder->SetParameter(OMX_IndexParamAudioAac, &profileType);
I'm not sure at all this is correct for the data I want to decode, but as the error event arrives after the input buffers are provided but before any data is sent to the component, I guess it has nothing to do with the data itself.
Maybe something wrong with the output port instead? But I'm not enabling it yet...

I suppose the code you're reading is not the public part right? Otherwise I could try to investigate what I'm doing wrong myself.
Thank you for your help!

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23646
Joined: Sat Jul 30, 2011 7:41 pm

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Mon Jan 07, 2013 8:26 am

We don't supply a DTS decoder on the GPU - can you try a different setting there - maybe its rejected because there is no DTS codec present.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

luc4
Posts: 46
Joined: Mon Nov 12, 2012 12:28 am

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Tue Jan 08, 2013 12:03 am

Tried with OMX_AUDIO_AACStreamFormatRAW. Same event occurs. Maybe some other param is needed? Or some of those are not supported? Maybe something related to the size or number of the buffers?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23646
Joined: Sat Jul 30, 2011 7:41 pm

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Tue Jan 08, 2013 12:32 am

And that's the problem I have with OpenMAX in a nutshell. Not knowing which parameter is incorrect when an error occurs. Or indeed it could be a combination.

Of course, there may be a way of recovering the required information, but I don't know what it is short of debugging it.

However, I will email the codec team to see if they can give me some ideas!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

luc4
Posts: 46
Joined: Mon Nov 12, 2012 12:28 am

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Sat Jan 19, 2013 9:36 am

Any news on this?
Thanks.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5331
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Sat Jan 19, 2013 10:14 am

There are no audio codecs licensed for GPU decode, so all audio_decode can play is PCM.
You will need to use an ARM library like linavcodec for audio decode to PCM.

We are working on getting DTS, AC3 and others licensed, but this is proving a difficult process with the licence owners.

kevleyski
Posts: 5
Joined: Tue Feb 14, 2012 7:36 pm

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Wed Jul 20, 2016 2:06 am

dom wrote:There are no audio codecs licensed for GPU decode, so all audio_decode can play is PCM.
You will need to use an ARM library like linavcodec for audio decode to PCM.

We are working on getting DTS, AC3 and others licensed, but this is proving a difficult process with the licence owners.

Do we know if there been any progress on this? I'm trying to create a av player avoiding FFmpeg if at all possible...

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5331
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: OMX_ErrorUnsupportedSetting from audio_decode component

Wed Jul 20, 2016 11:17 am

kevleyski wrote:Do we know if there been any progress on this? I'm trying to create a av player avoiding FFmpeg if at all possible...
No this will never happen. We tried to negotiate a licence deal similar to the one we use for video codecs, but they weren't interested in that model
(they could do a hardware licence that applied to every Pi sold, or a software licence that applied to a specific application, like Kodi, but not an optional hardware licence).

Since those days the DTS/AC3 codecs have been optimised on the arm, so even on a Pi1 the CPU usage isn't a big problem and it is negligable cpu on a Pi2/Pi3.
You will need to use an arm library like libavcodec to decode the audio to PCM.

Return to “Graphics, sound and multimedia”