Adec1
Provides a simple interface to AUDDEC1 (XDM 1.0) based algorithms. Typical usage (AAC, no error checking):.
More...
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", ¶ms, &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);
Loader_getFrame(hLoader, hInBuf);
if (Buffer_getUserPtr(hInBuf) == NULL) break;
}
Loader_delete(hLoader);
Buffer_delete(hOutBuf);
Adec1_delete(hAd1);
Engine_close(hEngine);
Typedef Documentation
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. |
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. |
Deletes an Audio Decode algorithm instance.
- Parameters:
-
- Return values:
-
| Dmai_EOK | for success. |
| Negative value | for failure, see Dmai.h. |
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. |
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. |
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. |
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. |
Variable Documentation
Default XDM parameters for an Audio Decode algorithm.
size = sizeof(AUDDEC1_Params),
outputPCMWidth = 16,
pcmFormat = IAUDIO_INTERLEAVED,
dataEndianness = XDM_BYTE,
Default XDM dynamic parameters for an Audio Decode algorithm.
size = sizeof(AUDDEC1_DynamicParams),
downSampleSbrFlag = XDAS_FALSE,