Adec1

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

Typedefs

typedef struct Adec1_Object * Adec1_Handle
 Handle through which to reference an Audio Decode algorithm.

Functions

Adec1_Handle Adec1_create (Engine_Handle hEngine, Char *codecName, AUDDEC1_Params *params, AUDDEC1_DynamicParams *dynParams)
 Creates an Audio Decode (XDM 1.0) algorithm instance.
Int Adec1_process (Adec1_Handle hAd1, Buffer_Handle hInBuf, Buffer_Handle hOutBuf)
 Decodes an audio buffer.
Int Adec1_delete (Adec1_Handle hAd1)
 Deletes an Audio Decode algorithm instance.
AUDDEC1_Handle Adec1_getVisaHandle (Adec1_Handle hAd1)
 Get the AUDDEC1 handle from the Adec1 module instance.
Int Adec1_getSampleRate (Adec1_Handle hAd1)
 Get the sample rate detected by the algorithm.
Int32 Adec1_getInBufSize (Adec1_Handle hAd1)
 Get the input buffer size required by the codec.
Int32 Adec1_getOutBufSize (Adec1_Handle hAd1)
 Get the output buffer size required by the codec.

Variables

const AUDDEC1_Params Adec1_Params_DEFAULT
 Default XDM parameters for an Audio Decode algorithm.
const AUDDEC1_DynamicParams Adec1_DynamicParams_DEFAULT
 Default XDM dynamic parameters for an Audio Decode algorithm.

Detailed Description

Provides a simple interface to AUDDEC1 (XDM 1.0) 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/Adec1.h>

     Adec1_Handle hAd1;
     Loader_Handle hLoader;
     Buffer_Handle hOutBuf;
     Engine_Handle hEngine;
     AUDDEC1_Params params = Adec1_Params_DEFAULT;
     AUDDEC1_DynamicParams dynParams = Adec1_DynamicParams_DEFAULT;
     Loader_Attrs lAttrs = Loader_Attrs_DEFAULT;
     Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;

     CERuntime_init();
     Dmai_init();
     hEngine = Engine_open("myengine", NULL, NULL);
     hAd1 = Adec1_create(hEngine, "aacdec", &params, &dynParams);
     hOutBuf = Buffer_create(Adec1_getOutBufSize(hAd1), &bAttrs);
     lAttrs.readSize = Adec1_getInBufSize(hAd1);
     lAttrs.readBufSize = lAttrs.readSize * 2;
     hLoader = Loader_create("myfile.aac", &lAttrs);
     Loader_prime(hLoader, &hInBuf);

     while (1) {
         Adec1_process(hAd1, 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);
     Adec1_delete(hAd1);
     Engine_close(hEngine);

Typedef Documentation

typedef struct Adec1_Object* Adec1_Handle

Handle through which to reference an Audio Decode algorithm.


Function Documentation

Adec1_Handle Adec1_create ( Engine_Handle  hEngine,
Char *  codecName,
AUDDEC1_Params *  params,
AUDDEC1_DynamicParams *  dynParams 
)

Creates an Audio Decode (XDM 1.0) 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 Adec1_Handle).
NULL for failure.

Int Adec1_process ( Adec1_Handle  hAd1,
Buffer_Handle  hInBuf,
Buffer_Handle  hOutBuf 
)

Decodes an audio buffer.

Parameters:
[in] hAd1 The Adec1_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:
Adec1_create must be called before this function.

Int Adec1_delete ( Adec1_Handle  hAd1  ) 

Deletes an Audio Decode algorithm instance.

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

AUDDEC1_Handle Adec1_getVisaHandle ( Adec1_Handle  hAd1  ) 

Get the AUDDEC1 handle from the Adec1 module instance.

Parameters:
[in] hAd1 The Adec1_Handle for which to get the AUDDEC1 handle.
Return values:
Handle to the audio decode algorithm, see the XDM documentation for AUDDEC1.
Remarks:
Adec1_create must be called before this function.

Int Adec1_getSampleRate ( Adec1_Handle  hAd1  ) 

Get the sample rate detected by the algorithm.

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

Adec1_process must be called before this function.

Int32 Adec1_getInBufSize ( Adec1_Handle  hAd1  ) 

Get the input buffer size required by the codec.

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

Int32 Adec1_getOutBufSize ( Adec1_Handle  hAd1  ) 

Get the output buffer size required by the codec.

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


Variable Documentation

const AUDDEC1_Params Adec1_Params_DEFAULT

Default XDM parameters for an Audio Decode algorithm.

     size                 = sizeof(AUDDEC1_Params),
     outputPCMWidth       = 16,
     pcmFormat            = IAUDIO_INTERLEAVED,
     dataEndianness       = XDM_BYTE,

const AUDDEC1_DynamicParams Adec1_DynamicParams_DEFAULT

Default XDM dynamic parameters for an Audio Decode algorithm.

     size                 = sizeof(AUDDEC1_DynamicParams),
     downSampleSbrFlag    = XDAS_FALSE,


Copyright 2011, Texas Instruments Incorporated