Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

Davinci Multimedia Application Interface

89 bytes added, 00:10, 18 December 2010
Example
== Example ==
Below is a simple DMAI example showing audio decode using an AAC decoder and the Codec Engine (no error checking). Input is an elementary stream file and output is the sound device driver:
<code lang='"c'">{</code>{ #include <&lt;xdc/std.h>&gt; #include <&lt;ti/sdo/ce/Engine.h>&gt; #include <&lt;ti/sdo/ce/CERuntime.h>&gt; #include <&lt;ti/sdo/dmai/Dmai.h>&gt; #include <&lt;ti/sdo/dmai/Buffer.h>&gt; #include <&lt;ti/sdo/dmai/Sound.h>&gt; #include <&lt;ti/sdo/dmai/Loader.h>&gt; #include <&lt;ti/sdo/dmai/ce/Adec.h>&gt;
Adec_Handle hAd;
Loader_Handle hLoader;
Buffer_Handle hOutBuf, hInBuf;
Engine_Handle hEngine;
Sound_Handle hSound;
AUDDEC_Params params = Adec_Params_DEFAULT;
AUDDEC_DynamicParams dynParams = Adec_DynamicParams_DEFAULT;
Loader_Attrs lAttrs = Loader_Attrs_DEFAULT;
Buffer_Attrs bAttrs = Buffer_Attrs_DEFAULT;
Sound_Attrs sAttrs = Sound_Attrs_STEREO_DEFAULT;
CERuntime_init();
Dmai_init();
hSound = Sound_create(&amp;sAttrs);
hEngine = Engine_open("myengine", NULL, NULL);
hAd = Adec_create(hEngine, "aacdec", &amp;params, &amp;dynParams); hOutBuf = Buffer_create(Adec_getOutBufSize(hAd), &amp;bAttrs);
lAttrs.readSize = Adec_getInBufSize(hAd);
lAttrs.readBufSize = lAttrs.readSize * 2;
hLoader = Loader_create("myfile.aac", &amp;lAttrs); Loader_prime(hLoader, &amp;hInBuf);
while (1) {
Adec_process(hAd, hInBuf, hOutBuf);
Loader_getFrame(hLoader, hInBuf);
if (Buffer_getUserPtr(hInBuf) == NULL) break;
}
Loader_delete(hLoader);
Buffer_delete(hOutBuf);
Engine_close(hEngine);
Sound_delete(hSound);
 
}
</code>
==Versions==