1094332d3Sopenharmony_ci# Codec<a name="EN-US_TOPIC_0000001131751215"></a> 2094332d3Sopenharmony_ci 3094332d3Sopenharmony_ci- [Codec<a name="EN-US_TOPIC_0000001131751215"></a>](#codec) 4094332d3Sopenharmony_ci - [Introduction<a name="section11660541593"></a>](#introduction) 5094332d3Sopenharmony_ci - [Directory Structure<a name="section161941989596"></a>](#directory-structure) 6094332d3Sopenharmony_ci - [Available APIs<a name="section1551164914237"></a>](#available-apis) 7094332d3Sopenharmony_ci - [Usage Guidelines<a name="section129654513264"></a>](#usage-guidelines) 8094332d3Sopenharmony_ci - [Repositories Involved<a name="section1371113476307"></a>](#repositories-involved) 9094332d3Sopenharmony_ci 10094332d3Sopenharmony_ci- [Repositories Involved](#section1371113476307) 11094332d3Sopenharmony_ci 12094332d3Sopenharmony_ci## Introduction<a name="section11660541593"></a> 13094332d3Sopenharmony_ci 14094332d3Sopenharmony_ciThis repository mainly defines and implements the Hardware Driver Interfaces \(HDIs\) of the codec module, allowing upper-layer services to perform the following operations: 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci- Creating and destroying a codec 17094332d3Sopenharmony_ci- Starting and stopping the codec 18094332d3Sopenharmony_ci- Encoding original code streams into compressed code streams 19094332d3Sopenharmony_ci- Decoding compressed code streams into original code streams 20094332d3Sopenharmony_ci- Flushing the cache 21094332d3Sopenharmony_ci 22094332d3Sopenharmony_ci## Directory Structure<a name="section161941989596"></a> 23094332d3Sopenharmony_ci 24094332d3Sopenharmony_ciThe source code directory structure is as follows: 25094332d3Sopenharmony_ci 26094332d3Sopenharmony_ci``` 27094332d3Sopenharmony_ci/drivers/peripheral/codec 28094332d3Sopenharmony_ci├── interfaces # Driver capability APIs provided for upper-layer services 29094332d3Sopenharmony_ci│ └── include # APIs exposed externally 30094332d3Sopenharmony_ci``` 31094332d3Sopenharmony_ci 32094332d3Sopenharmony_ci### Available APIs<a name="section1551164914237"></a> 33094332d3Sopenharmony_ci 34094332d3Sopenharmony_ciThe codec module provides APIs that can be directly called by the framework layer to create or destroy a codec, start or stop a codec, perform encoding or decoding operations, flush the cache, and set a callback. 35094332d3Sopenharmony_ci 36094332d3Sopenharmony_ciThe table below describes major HDI 1.0 APIs provided by the codec module. 37094332d3Sopenharmony_ci 38094332d3Sopenharmony_ci**Table 1** Major HDI 1.0 APIs of the codec module 39094332d3Sopenharmony_ci 40094332d3Sopenharmony_ci<a name="table1513255710559"></a> 41094332d3Sopenharmony_ci<table><thead align="left"><tr id="row171321857155517"><th class="cellrowborder" align="center" valign="top" width="12.821282128212822%" id="mcps1.2.4.1.1"><p id="p6132957115511"><a name="p6132957115511"></a><a name="p6132957115511"></a>Header File</p> 42094332d3Sopenharmony_ci</th> 43094332d3Sopenharmony_ci<th class="cellrowborder" align="center" valign="top" width="63.61636163616362%" id="mcps1.2.4.1.2"><p id="p14132125715552"><a name="p14132125715552"></a><a name="p14132125715552"></a>API</p> 44094332d3Sopenharmony_ci</th> 45094332d3Sopenharmony_ci<th class="cellrowborder" align="center" valign="top" width="23.562356235623565%" id="mcps1.2.4.1.3"><p id="p18132205755516"><a name="p18132205755516"></a><a name="p18132205755516"></a>Description</p> 46094332d3Sopenharmony_ci</th> 47094332d3Sopenharmony_ci</tr> 48094332d3Sopenharmony_ci</thead> 49094332d3Sopenharmony_ci<tbody><tr id="row1267017500274"><td class="cellrowborder" rowspan="17" align="left" valign="top" width="12.821282128212822%" headers="mcps1.2.4.1.1 "><p id="p15674038913"><a name="p15674038913"></a><a name="p15674038913"></a></p> 50094332d3Sopenharmony_ci<p id="p169466917181"><a name="p169466917181"></a><a name="p169466917181"></a></p> 51094332d3Sopenharmony_ci<p id="p12106161012185"><a name="p12106161012185"></a><a name="p12106161012185"></a></p> 52094332d3Sopenharmony_ci<p id="p7255161017181"><a name="p7255161017181"></a><a name="p7255161017181"></a></p> 53094332d3Sopenharmony_ci<p id="p1839901041815"><a name="p1839901041815"></a><a name="p1839901041815"></a></p> 54094332d3Sopenharmony_ci<p id="p4540171015188"><a name="p4540171015188"></a><a name="p4540171015188"></a></p> 55094332d3Sopenharmony_ci<p id="p368816102189"><a name="p368816102189"></a><a name="p368816102189"></a></p> 56094332d3Sopenharmony_ci<p id="p679481051814"><a name="p679481051814"></a><a name="p679481051814"></a></p> 57094332d3Sopenharmony_ci<p id="p7399191241817"><a name="p7399191241817"></a><a name="p7399191241817"></a></p> 58094332d3Sopenharmony_ci<p id="p11902121271818"><a name="p11902121271818"></a><a name="p11902121271818"></a></p> 59094332d3Sopenharmony_ci<p id="p1296415129182"><a name="p1296415129182"></a><a name="p1296415129182"></a></p> 60094332d3Sopenharmony_ci<p id="p1742101311180"><a name="p1742101311180"></a><a name="p1742101311180"></a></p> 61094332d3Sopenharmony_ci<p id="p171041613101815"><a name="p171041613101815"></a><a name="p171041613101815"></a></p> 62094332d3Sopenharmony_ci<p id="p10172141314183"><a name="p10172141314183"></a><a name="p10172141314183"></a></p> 63094332d3Sopenharmony_ci<p id="p723216132180"><a name="p723216132180"></a><a name="p723216132180"></a></p> 64094332d3Sopenharmony_ci<p id="p825185015460"><a name="p825185015460"></a><a name="p825185015460"></a>codec_interface.h</p> 65094332d3Sopenharmony_ci<p id="p2133757135510"><a name="p2133757135510"></a><a name="p2133757135510"></a></p> 66094332d3Sopenharmony_ci<p id="p14171441118"><a name="p14171441118"></a><a name="p14171441118"></a></p> 67094332d3Sopenharmony_ci<p id="p57063567463"><a name="p57063567463"></a><a name="p57063567463"></a></p> 68094332d3Sopenharmony_ci<p id="p1285144710118"><a name="p1285144710118"></a><a name="p1285144710118"></a></p> 69094332d3Sopenharmony_ci<p id="p854114711117"><a name="p854114711117"></a><a name="p854114711117"></a></p> 70094332d3Sopenharmony_ci<p id="p15741647517"><a name="p15741647517"></a><a name="p15741647517"></a></p> 71094332d3Sopenharmony_ci<p id="p7909447418"><a name="p7909447418"></a><a name="p7909447418"></a></p> 72094332d3Sopenharmony_ci<p id="p12525910165811"><a name="p12525910165811"></a><a name="p12525910165811"></a></p> 73094332d3Sopenharmony_ci<p id="p942322013262"><a name="p942322013262"></a><a name="p942322013262"></a></p> 74094332d3Sopenharmony_ci<p id="p1040515339526"><a name="p1040515339526"></a><a name="p1040515339526"></a></p> 75094332d3Sopenharmony_ci<p id="p19405533115216"><a name="p19405533115216"></a><a name="p19405533115216"></a></p> 76094332d3Sopenharmony_ci</td> 77094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="63.61636163616362%" headers="mcps1.2.4.1.2 "><p id="p174121125175619"><a name="p174121125175619"></a><a name="p174121125175619"></a>int32_t CodecInit();</p> 78094332d3Sopenharmony_ci</td> 79094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="23.562356235623565%" headers="mcps1.2.4.1.3 "><p id="p114126258569"><a name="p114126258569"></a><a name="p114126258569"></a>Initializes the internal audio and video submodules of the codec.</p> 80094332d3Sopenharmony_ci</td> 81094332d3Sopenharmony_ci</tr> 82094332d3Sopenharmony_ci<tr id="row2661171172814"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1341212595610"><a name="p1341212595610"></a><a name="p1341212595610"></a>int32_t CodecDeinit();</p> 83094332d3Sopenharmony_ci</td> 84094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1341272515610"><a name="p1341272515610"></a><a name="p1341272515610"></a>Deinitializes the internal audio and video submodules of the codec.</p> 85094332d3Sopenharmony_ci</td> 86094332d3Sopenharmony_ci</tr> 87094332d3Sopenharmony_ci<tr id="row4385112822818"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p14413122555620"><a name="p14413122555620"></a><a name="p14413122555620"></a>int32_t CodecEnumerateCapbility(uint32_t index, CodecCapbility *cap);</p> 88094332d3Sopenharmony_ci</td> 89094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1141372575614"><a name="p1141372575614"></a><a name="p1141372575614"></a>Obtains the capabilities of a specified media type based on an index.</p> 90094332d3Sopenharmony_ci</td> 91094332d3Sopenharmony_ci</tr> 92094332d3Sopenharmony_ci<tr id="row181371630162816"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1941362515561"><a name="p1941362515561"></a><a name="p1941362515561"></a>int32_t CodecGetCapbility(AvCodecMime mime, CodecType type, uint32_t flags, CodecCapbility *cap);</p> 93094332d3Sopenharmony_ci</td> 94094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p44131025115619"><a name="p44131025115619"></a><a name="p44131025115619"></a>Obtains the capabilities of a specified media type.</p> 95094332d3Sopenharmony_ci</td> 96094332d3Sopenharmony_ci</tr> 97094332d3Sopenharmony_ci<tr id="row01531026142811"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p241312251562"><a name="p241312251562"></a><a name="p241312251562"></a>int32_t CodecCreate(const char* name, const Param *attr, int len, CODEC_HANDLETYPE *handle);</p> 98094332d3Sopenharmony_ci</td> 99094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p12413525135615"><a name="p12413525135615"></a><a name="p12413525135615"></a>Creates a specific codec component and returns the component context through a handle.</p> 100094332d3Sopenharmony_ci</td> 101094332d3Sopenharmony_ci</tr> 102094332d3Sopenharmony_ci<tr id="row11460182372815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p44133252564"><a name="p44133252564"></a><a name="p44133252564"></a>int32_t CodecDestroy(CODEC_HANDLETYPE handle);</p> 103094332d3Sopenharmony_ci</td> 104094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p041392535610"><a name="p041392535610"></a><a name="p041392535610"></a>Destroys a codec component.</p> 105094332d3Sopenharmony_ci</td> 106094332d3Sopenharmony_ci</tr> 107094332d3Sopenharmony_ci<tr id="row61462216285"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p84134251566"><a name="p84134251566"></a><a name="p84134251566"></a>int32_t CodecSetPortMode(CODEC_HANDLETYPE handle, DirectionType type, BufferMode mode);</p> 108094332d3Sopenharmony_ci</td> 109094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p204131258569"><a name="p204131258569"></a><a name="p204131258569"></a>Sets the input or output buffer mode.</p> 110094332d3Sopenharmony_ci</td> 111094332d3Sopenharmony_ci</tr> 112094332d3Sopenharmony_ci<tr id="row791355812713"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p10413112575617"><a name="p10413112575617"></a><a name="p10413112575617"></a>int32_t CodecSetParameter(CODEC_HANDLETYPE handle, const Param *params, int paramCnt);</p> 113094332d3Sopenharmony_ci</td> 114094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p94138253562"><a name="p94138253562"></a><a name="p94138253562"></a>Sets parameters required by a codec component.</p> 115094332d3Sopenharmony_ci</td> 116094332d3Sopenharmony_ci</tr> 117094332d3Sopenharmony_ci<tr id="row3731175622711"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p441318251564"><a name="p441318251564"></a><a name="p441318251564"></a>int32_t CodecGetParameter(CODEC_HANDLETYPE handle, Param *params, int paramCnt);</p> 118094332d3Sopenharmony_ci</td> 119094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p74132257566"><a name="p74132257566"></a><a name="p74132257566"></a>Obtains parameters from a codec component.</p> 120094332d3Sopenharmony_ci</td> 121094332d3Sopenharmony_ci</tr> 122094332d3Sopenharmony_ci<tr id="row131131754172718"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p14132257567"><a name="p14132257567"></a><a name="p14132257567"></a>int32_t CodecStart(CODEC_HANDLETYPE handle);</p> 123094332d3Sopenharmony_ci</td> 124094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1741382510566"><a name="p1741382510566"></a><a name="p1741382510566"></a>Starts a codec component.</p> 125094332d3Sopenharmony_ci</td> 126094332d3Sopenharmony_ci</tr> 127094332d3Sopenharmony_ci<tr id="row133541652202712"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p11413125185617"><a name="p11413125185617"></a><a name="p11413125185617"></a>int32_t CodecStop(CODEC_HANDLETYPE handle);</p> 128094332d3Sopenharmony_ci</td> 129094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p154137256566"><a name="p154137256566"></a><a name="p154137256566"></a>Stops a codec component.</p> 130094332d3Sopenharmony_ci</td> 131094332d3Sopenharmony_ci</tr> 132094332d3Sopenharmony_ci<tr id="row148624820271"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p124141425125610"><a name="p124141425125610"></a><a name="p124141425125610"></a>int32_t CodecFlush(CODEC_HANDLETYPE handle, DirectionType directType);</p> 133094332d3Sopenharmony_ci</td> 134094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p64141258565"><a name="p64141258565"></a><a name="p64141258565"></a>Clears the cache when the codec component is the running state.</p> 135094332d3Sopenharmony_ci</td> 136094332d3Sopenharmony_ci</tr> 137094332d3Sopenharmony_ci<tr id="row1676314450275"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p144141225165615"><a name="p144141225165615"></a><a name="p144141225165615"></a>int32_t CodecQueueInput(CODEC_HANDLETYPE handle, const InputInfo *inputData, uint32_t timeoutMs);</p> 138094332d3Sopenharmony_ci</td> 139094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p6414182535616"><a name="p6414182535616"></a><a name="p6414182535616"></a>Queues input data.</p> 140094332d3Sopenharmony_ci</td> 141094332d3Sopenharmony_ci</tr> 142094332d3Sopenharmony_ci<tr id="row194281341102710"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p15414112510561"><a name="p15414112510561"></a><a name="p15414112510561"></a>int32_t CodecDequeInput(CODEC_HANDLETYPE handle, uint32_t timeoutMs, InputInfo *inputData);</p> 143094332d3Sopenharmony_ci</td> 144094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p341492555613"><a name="p341492555613"></a><a name="p341492555613"></a>Dequeues input data that has been used.</p> 145094332d3Sopenharmony_ci</td> 146094332d3Sopenharmony_ci</tr> 147094332d3Sopenharmony_ci<tr id="row560213915277"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p8414525145610"><a name="p8414525145610"></a><a name="p8414525145610"></a>int32_t CodecQueueOutput(CODEC_HANDLETYPE handle, OutputInfo *outInfo, uint32_t timeoutMs, int releaseFenceFd);</p> 148094332d3Sopenharmony_ci</td> 149094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1241442513569"><a name="p1241442513569"></a><a name="p1241442513569"></a>Queues output data.</p> 150094332d3Sopenharmony_ci</td> 151094332d3Sopenharmony_ci</tr> 152094332d3Sopenharmony_ci<tr id="row933244161410"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p6414425185619"><a name="p6414425185619"></a><a name="p6414425185619"></a>int32_t CodecDequeueOutput(CODEC_HANDLETYPE handle, uint32_t timeoutMs, int *acquireFd, OutputInfo *outInfo);</p> 153094332d3Sopenharmony_ci</td> 154094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p16414112518560"><a name="p16414112518560"></a><a name="p16414112518560"></a>Dequeues output data.</p> 155094332d3Sopenharmony_ci</td> 156094332d3Sopenharmony_ci</tr> 157094332d3Sopenharmony_ci<tr id="row182432045121416"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p104148252565"><a name="p104148252565"></a><a name="p104148252565"></a>int32_t CodecSetCallback(CODEC_HANDLETYPE handle, const CodecCallback *cb, UINTPTR instance);</p> 158094332d3Sopenharmony_ci</td> 159094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p20414172595617"><a name="p20414172595617"></a><a name="p20414172595617"></a>Sets the callback function.</p> 160094332d3Sopenharmony_ci</td> 161094332d3Sopenharmony_ci</tr> 162094332d3Sopenharmony_ci</tbody> 163094332d3Sopenharmony_ci</table> 164094332d3Sopenharmony_ci 165094332d3Sopenharmony_ciThe codec module also provides codec HDI 2.0 APIs based on the OMX interfaces. The table below describes the HDI 2.0 APIs. 166094332d3Sopenharmony_ci 167094332d3Sopenharmony_ci**Table 2** HDI 2.0 APIs of the codec module 168094332d3Sopenharmony_ci 169094332d3Sopenharmony_ci<a name="table1513255710560"></a> 170094332d3Sopenharmony_ci<table><thead align="left"><tr id="row171321857155518"><th class="cellrowborder" align="center" valign="top" width="12.821282128212822%" id="mcps1.2.4.2.1"><p id="p6132957115521"><a name="p6132957115521"></a><a name="p6132957115521"></a>Header File</p> 171094332d3Sopenharmony_ci</th> 172094332d3Sopenharmony_ci<th class="cellrowborder" align="center" valign="top" width="63.61636163616362%" id="mcps1.2.4.2.2"><p id="p14132125715562"><a name="p14132125715562"></a><a name="p14132125715562"></a>API</p> 173094332d3Sopenharmony_ci</th> 174094332d3Sopenharmony_ci<th class="cellrowborder" align="center" valign="top" width="23.562356235623565%" id="mcps1.2.4.2.3"><p id="p18132205755526"><a name="p18132205755526"></a><a name="p18132205755526"></a>Description</p> 175094332d3Sopenharmony_ci</th> 176094332d3Sopenharmony_ci</tr> 177094332d3Sopenharmony_ci</thead> 178094332d3Sopenharmony_ci<tbody><tr id="row1267017500275"><td class="cellrowborder" rowspan="4" align="left" valign="top" width="12.821282128212822%" headers="mcps1.2.4.2.1 "><p id="p15674038923"><a name="p15674038923"></a><a name="p15674038923"></a>codec_component 179094332d3Sopenharmony_ci_manager.h</p> 180094332d3Sopenharmony_ci</td> 181094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="63.61636163616362%" headers="mcps1.2.4.2.2 "><p id="p174121125175619"><a name="p174121125175619"></a><a name="p174121125175619"></a>int32_t (*GetComponentNum)();</p> 182094332d3Sopenharmony_ci</td> 183094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="23.562356235623565%" headers="mcps1.2.4.2.3 "><p id="p114126258569"><a name="p114126258569"></a><a name="p114126258569"></a>Obtains the number of codec components</p> 184094332d3Sopenharmony_ci</td> 185094332d3Sopenharmony_ci</tr> 186094332d3Sopenharmony_ci<tr id="row2661171172814"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p1341212595610"><a name="p1341212595610"></a><a name="p1341212595610"></a>int32_t (*GetComponentCapabilityList)(CodecCompCapability *capList, int32_t count);</p> 187094332d3Sopenharmony_ci</td> 188094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1341272515610"><a name="p1341272515610"></a><a name="p1341272515610"></a>Obtains the codec capability list</p> 189094332d3Sopenharmony_ci</td> 190094332d3Sopenharmony_ci</tr> 191094332d3Sopenharmony_ci<tr id="row4385112822818"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p14413122555620"><a name="p14413122555620"></a><a name="p14413122555620"></a>int32_t (*CreateComponent)(struct CodecComponentType **component, uint32_t *componentId, char *compName, int64_t appData, struct CodecCallbackType *callbacks);</p> 192094332d3Sopenharmony_ci</td> 193094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1141372575614"><a name="p1141372575614"></a><a name="p1141372575614"></a>Creates a codec instance</p> 194094332d3Sopenharmony_ci</td> 195094332d3Sopenharmony_ci</tr> 196094332d3Sopenharmony_ci<tr id="row181371630162816"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p1941362515561"><a name="p1941362515561"></a><a name="p1941362515561"></a>int32_t (*DestroyComponent)(uint32_t componentId);</p> 197094332d3Sopenharmony_ci</td> 198094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p44131025115619"><a name="p44131025115619"></a><a name="p44131025115619"></a>Destroys a codec component instance</p> 199094332d3Sopenharmony_ci</td> 200094332d3Sopenharmony_ci</tr> 201094332d3Sopenharmony_ci</tbody> 202094332d3Sopenharmony_ci<tbody><tr id="row1267017500275"><td class="cellrowborder" rowspan="18" align="left" valign="top" width="12.821282128212822%" headers="mcps1.2.4.2.1 "><p id="p15674038923"><a name="p15674038923"></a><a name="p15674038923"></a>codec_component 203094332d3Sopenharmony_ci_if.h</p> 204094332d3Sopenharmony_ci</td> 205094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="63.61636163616362%" headers="mcps1.2.4.2.2 "><p id="p174121125175619"><a name="p174121125175619"></a><a name="p174121125175619"></a>int32_t (*GetComponentVersion)(struct CodecComponentType *self, struct CompVerInfo *verInfo);</p> 206094332d3Sopenharmony_ci</td> 207094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="23.562356235623565%" headers="mcps1.2.4.2.3 "><p id="p114126258569"><a name="p114126258569"></a><a name="p114126258569"></a>Obtains the version of a codec component</p> 208094332d3Sopenharmony_ci</td> 209094332d3Sopenharmony_ci</tr> 210094332d3Sopenharmony_ci<tr id="row2661171172814"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p1341212595610"><a name="p1341212595610"></a><a name="p1341212595610"></a>int32_t (*SendCommand)(struct CodecComponentType *self, enum OMX_COMMANDTYPE cmd, uint32_t param, int8_t *cmdData, uint32_t cmdDataLen);</p> 211094332d3Sopenharmony_ci</td> 212094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1341272515610"><a name="p1341272515610"></a><a name="p1341272515610"></a>Sends a command to a component</p> 213094332d3Sopenharmony_ci</td> 214094332d3Sopenharmony_ci</tr> 215094332d3Sopenharmony_ci<tr id="row4385112822818"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p14413122555620"><a name="p14413122555620"></a><a name="p14413122555620"></a>int32_t (*GetParameter)(struct CodecComponentType *self, uint32_t paramIndex, int8_t *paramStruct, uint32_t paramStructLen);</p> 216094332d3Sopenharmony_ci</td> 217094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1141372575614"><a name="p1141372575614"></a><a name="p1141372575614"></a>Obtains parameter settings of a component</p> 218094332d3Sopenharmony_ci</td> 219094332d3Sopenharmony_ci</tr> 220094332d3Sopenharmony_ci<tr id="row181371630162816"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p1941362515561"><a name="p1941362515561"></a><a name="p1941362515561"></a>int32_t (*SetParameter)(struct CodecComponentType *self, uint32_t index, int8_t *paramStruct, uint32_t paramStructLen);</p> 221094332d3Sopenharmony_ci</td> 222094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p44131025115619"><a name="p44131025115619"></a><a name="p44131025115619"></a>Sets parameters for a component</p> 223094332d3Sopenharmony_ci</td> 224094332d3Sopenharmony_ci</tr> 225094332d3Sopenharmony_ci<tr id="row01531026142811"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p241312251562"><a name="p241312251562"></a><a name="p241312251562"></a>int32_t (*GetConfig)(struct CodecComponentType *self, uint32_t index, int8_t *cfgStruct, uint32_t cfgStructLen);</p> 226094332d3Sopenharmony_ci</td> 227094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p12413525135615"><a name="p12413525135615"></a><a name="p12413525135615"></a>Obtains the configuration of a component</p> 228094332d3Sopenharmony_ci</td> 229094332d3Sopenharmony_ci</tr> 230094332d3Sopenharmony_ci<tr id="row11460182372815"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p44133252564"><a name="p44133252564"></a><a name="p44133252564"></a>int32_t (*SetConfig)(struct CodecComponentType *self, uint32_t index, int8_t *cfgStruct, uint32_t cfgStructLen);</p> 231094332d3Sopenharmony_ci</td> 232094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p041392535610"><a name="p041392535610"></a><a name="p041392535610"></a>Sets the component parameters</p> 233094332d3Sopenharmony_ci</td> 234094332d3Sopenharmony_ci</tr> 235094332d3Sopenharmony_ci<tr id="row61462216285"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p84134251566"><a name="p84134251566"></a><a name="p84134251566"></a>int32_t (*GetExtensionIndex)(struct CodecComponentType *self, const char *paramName, uint32_t *indexType);</p> 236094332d3Sopenharmony_ci</td> 237094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p204131258569"><a name="p204131258569"></a><a name="p204131258569"></a>Obtains the extended index of a component based on a given string</p> 238094332d3Sopenharmony_ci</td> 239094332d3Sopenharmony_ci</tr> 240094332d3Sopenharmony_ci<tr id="row791355812713"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p10413112575617"><a name="p10413112575617"></a><a name="p10413112575617"></a>int32_t (*GetState)(struct CodecComponentType *self, enum OMX_STATETYPE *state);</p> 241094332d3Sopenharmony_ci</td> 242094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p94138253562"><a name="p94138253562"></a><a name="p94138253562"></a>Obtains component status</p> 243094332d3Sopenharmony_ci</td> 244094332d3Sopenharmony_ci</tr> 245094332d3Sopenharmony_ci<tr id="row3731175622711"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p441318251564"><a name="p441318251564"></a><a name="p441318251564"></a>int32_t (*ComponentTunnelRequest)(struct CodecComponentType *self, uint32_t port, int32_t tunneledComp, uint32_t tunneledPort, struct OMX_TUNNELSETUPTYPE *tunnelSetup);</p> 246094332d3Sopenharmony_ci</td> 247094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p74132257566"><a name="p74132257566"></a><a name="p74132257566"></a>Sets tunnel communication for a component</p> 248094332d3Sopenharmony_ci</td> 249094332d3Sopenharmony_ci</tr> 250094332d3Sopenharmony_ci<tr id="row131131754172718"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p14132257567"><a name="p14132257567"></a><a name="p14132257567"></a>int32_t (*UseBuffer)(struct CodecComponentType *self, uint32_t portIndex, struct OmxCodecBuffer *buffer);</p> 251094332d3Sopenharmony_ci</td> 252094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1741382510566"><a name="p1741382510566"></a><a name="p1741382510566"></a>Specify the buffer of the component port</p> 253094332d3Sopenharmony_ci</td> 254094332d3Sopenharmony_ci</tr> 255094332d3Sopenharmony_ci<tr id="row133541652202712"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p11413125185617"><a name="p11413125185617"></a><a name="p11413125185617"></a>int32_t (*AllocateBuffer)(struct CodecComponentType *self, uint32_t portIndex, struct OmxCodecBuffer *buffer);</p> 256094332d3Sopenharmony_ci</td> 257094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p154137256566"><a name="p154137256566"></a><a name="p154137256566"></a>Requests a port buffer from the component</p> 258094332d3Sopenharmony_ci</td> 259094332d3Sopenharmony_ci</tr> 260094332d3Sopenharmony_ci<tr id="row148624820271"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p124141425125610"><a name="p124141425125610"></a><a name="p124141425125610"></a>int32_t (*FreeBuffer)(struct CodecComponentType *self, uint32_t portIndex, const struct OmxCodecBuffer *buffer);</p> 261094332d3Sopenharmony_ci</td> 262094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p64141258565"><a name="p64141258565"></a><a name="p64141258565"></a>Releases a buffer</p> 263094332d3Sopenharmony_ci</td> 264094332d3Sopenharmony_ci</tr> 265094332d3Sopenharmony_ci<tr id="row1676314450275"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p144141225165615"><a name="p144141225165615"></a><a name="p144141225165615"></a>int32_t (*EmptyThisBuffer)(struct CodecComponentType *self, const struct OmxCodecBuffer *buffer);</p> 266094332d3Sopenharmony_ci</td> 267094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p6414182535616"><a name="p6414182535616"></a><a name="p6414182535616"></a>Specify the buffer to be emptied by a component</p> 268094332d3Sopenharmony_ci</td> 269094332d3Sopenharmony_ci</tr> 270094332d3Sopenharmony_ci<tr id="row194281341102710"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p15414112510561"><a name="p15414112510561"></a><a name="p15414112510561"></a>int32_t (*FillThisBuffer)(struct CodecComponentType *self, const struct OmxCodecBuffer *buffer);</p> 271094332d3Sopenharmony_ci</td> 272094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p341492555613"><a name="p341492555613"></a><a name="p341492555613"></a>Specify the buffer to be filled with the encoding and decoding output by a component</p> 273094332d3Sopenharmony_ci</td> 274094332d3Sopenharmony_ci</tr> 275094332d3Sopenharmony_ci<tr id="row560213915277"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p8414525145610"><a name="p8414525145610"></a><a name="p8414525145610"></a>int32_t (*SetCallbacks)(struct CodecComponentType *self, struct CodecCallbackType *callback, int64_t appData);</p> 276094332d3Sopenharmony_ci</td> 277094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1241442513569"><a name="p1241442513569"></a><a name="p1241442513569"></a>Set a callback for the codec component</p> 278094332d3Sopenharmony_ci</td> 279094332d3Sopenharmony_ci</tr> 280094332d3Sopenharmony_ci<tr id="row933244161410"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p6414425185619"><a name="p6414425185619"></a><a name="p6414425185619"></a>int32_t (*ComponentDeInit)(struct CodecComponentType *self);</p> 281094332d3Sopenharmony_ci</td> 282094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p16414112518560"><a name="p16414112518560"></a><a name="p16414112518560"></a>Deinitializes a component</p> 283094332d3Sopenharmony_ci</td> 284094332d3Sopenharmony_ci</tr> 285094332d3Sopenharmony_ci<tr id="row182432045121416"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p104148252565"><a name="p104148252565"></a><a name="p104148252565"></a>int32_t (*UseEglImage)(struct CodecComponentType *self, struct OmxCodecBuffer *buffer, uint32_t portIndex, int8_t *eglImage, uint32_t eglImageLen);</p> 286094332d3Sopenharmony_ci</td> 287094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p20414172595617"><a name="p20414172595617"></a><a name="p20414172595617"></a>Uses the space allocated by EGL</p> 288094332d3Sopenharmony_ci</td> 289094332d3Sopenharmony_ci</tr> 290094332d3Sopenharmony_ci<tr id="row182432045121416"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p104148252565"><a name="p104148252565"></a><a name="p104148252565"></a>int32_t (*ComponentRoleEnum)(struct CodecComponentType *self, uint8_t *role, uint32_t roleLen, uint32_t index);</p> 291094332d3Sopenharmony_ci</td> 292094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p20414172595617"><a name="p20414172595617"></a><a name="p20414172595617"></a>Obtains the component roles</p> 293094332d3Sopenharmony_ci</td> 294094332d3Sopenharmony_ci</tr> 295094332d3Sopenharmony_ci</tbody> 296094332d3Sopenharmony_ci<tbody><tr id="row1267017500275"><td class="cellrowborder" rowspan="3" align="left" valign="top" width="12.821282128212822%" headers="mcps1.2.4.2.1 "><p id="p15674038923"><a name="p15674038923"></a><a name="p15674038923"></a>codec_callback_if.h</p> 297094332d3Sopenharmony_ci</td> 298094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="63.61636163616362%" headers="mcps1.2.4.2.2 "><p id="p174121125175619"><a name="p174121125175619"></a><a name="p174121125175619"></a>int32_t (*EventHandler)(struct CodecCallbackType *self, enum OMX_EVENTTYPE event, struct EventInfo *info);</p> 299094332d3Sopenharmony_ci</td> 300094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" width="23.562356235623565%" headers="mcps1.2.4.2.3 "><p id="p114126258569"><a name="p114126258569"></a><a name="p114126258569"></a>Reports an event</p> 301094332d3Sopenharmony_ci</td> 302094332d3Sopenharmony_ci</tr> 303094332d3Sopenharmony_ci<tr id="row2661171172814"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p1341212595610"><a name="p1341212595610"></a><a name="p1341212595610"></a>int32_t (*EmptyBufferDone)(struct CodecCallbackType *self, int64_t appData, const struct OmxCodecBuffer *buffer);</p> 304094332d3Sopenharmony_ci</td> 305094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1341272515610"><a name="p1341272515610"></a><a name="p1341272515610"></a>Reports an event indicating that the encoding or decoding in the input buffer is complete</p> 306094332d3Sopenharmony_ci</td> 307094332d3Sopenharmony_ci</tr> 308094332d3Sopenharmony_ci<tr id="row4385112822818"><td class="cellrowborder" valign="top" headers="mcps1.2.4.2.1 "><p id="p14413122555620"><a name="p14413122555620"></a><a name="p14413122555620"></a>int32_t (*FillBufferDone)(struct CodecCallbackType *self, int64_t appData, const struct OmxCodecBuffer *buffer);</p> 309094332d3Sopenharmony_ci</td> 310094332d3Sopenharmony_ci<td class="cellrowborder" valign="top" headers="mcps1.2.4.2.2 "><p id="p1141372575614"><a name="p1141372575614"></a><a name="p1141372575614"></a>Reports an event indicating that the output buffer is filled</p> 311094332d3Sopenharmony_ci</td> 312094332d3Sopenharmony_ci</tr> 313094332d3Sopenharmony_ci</tbody> 314094332d3Sopenharmony_ci</table> 315094332d3Sopenharmony_ci 316094332d3Sopenharmony_ci### Usage Guidelines<a name="section129654513264"></a> 317094332d3Sopenharmony_ci 318094332d3Sopenharmony_ciThe core functionalities of this repository are as follows: 319094332d3Sopenharmony_ci 320094332d3Sopenharmony_ci- Provides codec HDIs that can be directly called by the framework layer to perform encoding and decoding-related operations. 321094332d3Sopenharmony_ci- Provides standard interfaces for device developers to ensure that the OEM vendors comply with the HDI adapter standard. This promises a healthy evolution of the ecosystem. 322094332d3Sopenharmony_ci 323094332d3Sopenharmony_ciFor details about the invocation and implementation, see the API reference. 324094332d3Sopenharmony_ci 325094332d3Sopenharmony_ci## Repositories Involved<a name="section1371113476307"></a> 326094332d3Sopenharmony_ci 327094332d3Sopenharmony_ci[Driver subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/driver.md) 328094332d3Sopenharmony_ci 329094332d3Sopenharmony_ci[drivers\_framework](https://gitee.com/openharmony/drivers_framework/blob/master/README.md) 330094332d3Sopenharmony_ci 331094332d3Sopenharmony_ci[drivers\_adapter](https://gitee.com/openharmony/drivers_adapter/blob/master/README.md) 332094332d3Sopenharmony_ci 333094332d3Sopenharmony_ci[drivers\_adapter\_khdf\_linux](https://gitee.com/openharmony/drivers_adapter_khdf_linux/blob/master/README.md) 334094332d3Sopenharmony_ci 335094332d3Sopenharmony_ci[drivers\_peripheral](https://gitee.com/openharmony/drivers_peripheral) 336094332d3Sopenharmony_ci 337