Adec
Provides a simple interface to AUDDEC (XDM 0.9) based algorithms. Typical usage (AAC, no error checking):.
More...
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", ¶ms, &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);
Loader_getFrame(hLoader, hInBuf);
if (Buffer_getUserPtr(hInBuf) == NULL) break;
}
Loader_delete(hLoader);
Buffer_delete(hOutBuf);
Adec_delete(hAd);
Engine_close(hEngine);
Typedef Documentation
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. |
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. |
Deletes an Audio Decode algorithm instance.
- Parameters:
-
- Return values:
-
| Dmai_EOK | for success. |
| Negative value | for failure, see Dmai.h. |
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. |
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. |
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. |
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. |
Variable Documentation
Default XDM parameters for an Audio Decode algorithm.
size = sizeof(AUDDEC_Params),
maxSampleRate = 48000,
maxBitrate = 448000,
maxNoOfCh = IAUDIO_STEREO,
dataEndianness = XDM_BYTE,
Default XDM dynamic parameters for an Audio Decode algorithm.
size = sizeof(AUDDEC_DynamicParams),
outputFormat = IAUDIO_INTERLEAVED,