Adec

Provides a simple interface to AUDDEC (XDM 0.9) based algorithms. Typical usage (AAC, no error checking):. More...

Typedefs

typedef struct Adec_Object * Adec_Handle
 Handle through which to reference an Audio Decode algorithm.

Functions

Adec_Handle Adec_create (Engine_Handle hEngine, Char *codecName, AUDDEC_Params *params, AUDDEC_DynamicParams *dynParams)
 Creates an Audio Decode (XDM 0.9) algorithm instance.
Int Adec_process (Adec_Handle hAd, Buffer_Handle hInBuf, Buffer_Handle hOutBuf)
 Decodes an audio buffer.
Int Adec_delete (Adec_Handle hAd)
 Deletes an Audio Decode algorithm instance.
AUDDEC_Handle Adec_getVisaHandle (Adec_Handle hAd)
 Get the AUDDEC handle from the Adec module instance.
Int Adec_getSampleRate (Adec_Handle hAd)
 Get the sample rate detected by the algorithm.
Int32 Adec_getInBufSize (Adec_Handle hAd)
 Get the input buffer size required by the codec.
Int32 Adec_getOutBufSize (Adec_Handle hAd)
 Get the output buffer size required by the codec.

Variables

const AUDDEC_Params Adec_Params_DEFAULT
 Default XDM parameters for an Audio Decode algorithm.
const AUDDEC_DynamicParams Adec_DynamicParams_DEFAULT
 Default XDM dynamic parameters for an Audio Decode algorithm.

Detailed Description

Provides a simple interface to AUDDEC (XDM 0.9) based algorithms. Typical usage (AAC, no error checking):.

     #include <xdc/std.h>
     #include <ti/sdo/ce/Engine.h>
     #include <ti/sdo/ce/CERuntime.h>
     #include <ti/sdo/dmai/Dmai.h>
     #include <ti/sdo/dmai/Buffer.h>
     #include <ti/sdo/dmai/Loader.h>
     #include <ti/sdo/dmai/ce/Adec.h>

     Adec_Handle hAd;
     Loader_Handle hLoader;
     Buffer_Handle hOutBuf;
     Engine_Handle hEngine;
     AUDDEC_Params params = Adec_Params_DEFAULT;
     AUDDEC_DynamicParams dynParams = Adec_DynamicParams_DEFAULT;
     Loader_Attrs lAttrs = Loader_Attrs_DEFAULT;
     Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;

     CERuntime_init();
     Dmai_init();
     hEngine = Engine_open("myengine", NULL, NULL);
     hAd = Adec_create(hEngine, "aacdec", &params, &dynParams);
     hOutBuf = Buffer_create(Adec_getOutBufSize(hAd), &bAttrs);
     lAttrs.readSize = Adec_getInBufSize(hAd);
     lAttrs.readBufSize = lAttrs.readSize * 2;
     hLoader = Loader_create("myfile.aac", &lAttrs);
     Loader_prime(hLoader, &hInBuf);

     while (1) {
         Adec_process(hAd, hInBuf, hOutBuf);
         // Raw decoded samples now available in hOutBuf.
         Loader_getFrame(hLoader, hInBuf);
         if (Buffer_getUserPtr(hInBuf) == NULL) break;
     }
     Loader_delete(hLoader);
     Buffer_delete(hOutBuf);
     Adec_delete(hAd);
     Engine_close(hEngine);

Typedef Documentation

typedef struct Adec_Object* Adec_Handle

Handle through which to reference an Audio Decode algorithm.


Function Documentation

Adec_Handle Adec_create ( Engine_Handle  hEngine,
Char *  codecName,
AUDDEC_Params *  params,
AUDDEC_DynamicParams *  dynParams 
)

Creates an Audio Decode (XDM 0.9) algorithm instance.

Parameters:
[in] hEngine An opened engine containing the algorithm to create.
[in] codecName The name of the algorithm to open. Corresponds to the string name given in the .cfg file.
[in] params XDM parameters to use while creating the codec.
[in] dynParams XDM dynamic parameters to use while creating the codec.
Return values:
Handle for use in subsequent operations (see Adec_Handle).
NULL for failure.

Int Adec_process ( Adec_Handle  hAd,
Buffer_Handle  hInBuf,
Buffer_Handle  hOutBuf 
)

Decodes an audio buffer.

Parameters:
[in] hAd The Adec_Handle to use for decoding.
[in] hInBuf The Buffer_Handle for the buffer containing the encoded data.
[in] hOutBuf The Buffer_Handle for the buffer to fill with decoded data.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Adec_create must be called before this function.

Int Adec_delete ( Adec_Handle  hAd  ) 

Deletes an Audio Decode algorithm instance.

Parameters:
[in] hAd The Adec_Handle to delete.
Return values:
Dmai_EOK for success.
Negative value for failure, see Dmai.h.
Remarks:
Adec_create must be called before this function.

AUDDEC_Handle Adec_getVisaHandle ( Adec_Handle  hAd  ) 

Get the AUDDEC handle from the Adec module instance.

Parameters:
[in] hAd The Adec_Handle for which to get the AUDDEC handle.
Return values:
Handle to the audio decode algorithm, see the XDM documentation for AUDDEC.
Remarks:
Adec_create must be called before this function.

Int Adec_getSampleRate ( Adec_Handle  hAd  ) 

Get the sample rate detected by the algorithm.

Parameters:
[in] hAd The Adec_Handle for which to get the sample rate.
Return values:
Sample rate detected in encoded stream.
Remarks:
Adec_create must be called before this function.

Adec_process must be called before this function.

Int32 Adec_getInBufSize ( Adec_Handle  hAd  ) 

Get the input buffer size required by the codec.

Parameters:
[in] hAd The Adec_Handle for which to get the buffer size.
Return values:
Size in bytes of the input buffer required.
Remarks:
Adec_create must be called before this function.

Int32 Adec_getOutBufSize ( Adec_Handle  hAd  ) 

Get the output buffer size required by the codec.

Parameters:
[in] hAd The Adec_Handle for which to get the buffer size.
Return values:
Size in bytes of the output buffer required.
Remarks:
Adec_create must be called before this function.


Variable Documentation

const AUDDEC_Params Adec_Params_DEFAULT

Default XDM parameters for an Audio Decode algorithm.

     size                 = sizeof(AUDDEC_Params),
     maxSampleRate        = 48000,
     maxBitrate           = 448000,
     maxNoOfCh            = IAUDIO_STEREO,
     dataEndianness       = XDM_BYTE,

const AUDDEC_DynamicParams Adec_DynamicParams_DEFAULT

Default XDM dynamic parameters for an Audio Decode algorithm.

     size                 = sizeof(AUDDEC_DynamicParams),
     outputFormat         = IAUDIO_INTERLEAVED,


Copyright 2011, Texas Instruments Incorporated