# 函数：vdec_create_channel

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | x |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

创建视频数据处理的通道，同一个通道可以重复使用，销毁后不再可用。


#### 函数原型

- C函数原型
  1 aclError aclvdecCreateChannel(aclvdecChannelDesc *channelDesc)

- python函数
  1 ret = acl.media.vdec_create_channel(vdec_channel_desc)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| vdec\_channel\_desc | int，通道描述信息的指针地址。 调用acl.media.vdec\_create\_channel\_desc接口创建vdec\_channel\_desc类型的数据，调用acl.media.vdec\_set\_channel\_desc系列接口设置通道描述信息的属性。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |


#### 约束说明

- 通道为非线程安全，即不同线程要求创建不同的通道。
- 通道数的限制，请参见  功能及约束说明
。
- acl.media.vdec_create_channel接口内部封装了acl.rt.create_stream(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0079.html)接口和acl.rt.subscribe_report(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0104.html)：

  - 调用2次    acl.rt.create_stream(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0079.html)
接口创建了2个Stream，一个Stream用于视频码流解码任务，另一个用于回调函数的处理。这些Stream资源只有在调用    acl.media.vdec_destroy_channel
接口销毁通道后才能自动释放。
  - 调用    acl.rt.subscribe_report(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0104.html)
接口指定处理Stream上回调函数的线程，回调函数和线程是由用户调用acl.media.vdec_set_channel_desc系列接口时指定的。
用户在实现VDEC功能时，无需再单独调用acl.rt.create_stream(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0079.html)接口、acl.rt.subscribe_report(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0104.html)接口，但acl.rt.create_stream(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0079.html)接口、acl.rt.subscribe_report(https://www.hiascend.com/document/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0104.html)接口的约束需要遵循，例如Stream的数量、处理Stream上回调函数的线程数量等。


#### 资源参考

接口调用流程及示例，参见媒体数据处理V1(https://www.hiascend.com/document/detail/zh/canncommercial/900/programug/acldevg/aclpythondevg_0052.html)。
