---
title: SetDecodeParams
description: "设置解码器参数。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC2/armnative/kunpengcpsvideo_16_0072.html
sourcePath: /source/zh/kunpengboostkithistory/240RC2/armnative/kunpengcpsvideo_16_0072.html
indexId: b7fc61fa38c2d88fed5e19c46a60d62721f293d5f0a9c3fae91e65025876f7cd79
---
# SetDecodeParams

#### 函数功能

设置解码器参数。


#### 约束说明

NA


#### 函数原型

DecoderRetCode SetDecodeParams(DecodeParamsIndex index, void *decParams)


#### 参数说明

| 参数名称 | 输入/输出 | 参数类型 | 参数描述 |
| --- | --- | --- | --- |
| index | 输入 | DecodeParamsIndex | 表示要设置的参数的类型。 |
| decParams | 输入 | void \* | 对应参数的内存地址。 |


可设置的参数的定义如下：
```
// 解码参数
enum DecodeParamsIndex : uint32_t {
INDEX_PIC_INFO,
INDEX_PORT_FORMAT_INFO,
INDEX_ALIGN_INFO,
INDEX_PARAM_NONE
};
enum DecoderPort : uint32_t {
IN_PORT,
OUT_PORT
};
// 解码输出格式
enum MediaPixelFormat : uint32_t {
PIXEL_FORMAT_RGBA_8888,
PIXEL_FORMAT_YUV_420P,
PIXEL_FORMAT_FLEX_YUV_420P,
PIXEL_FORMAT_NV12,
PIXEL_FORMAT_NV21,
PIXEL_FORMAT_NONE
};
struct PortFormatParams {
DecoderPort port {};
int32_t format = 0;
};
struct PicInfoParams {
uint32_t width = 0;        // 图像宽度
uint32_t height = 0;       // 图像高度
int32_t stride = 0;        // 图像横向对齐后高度
uint32_t scanLines = 0;    // 图像纵向对齐后高度
uint32_t cropWidth = 0;    // 图像左侧的空余像素数量
uint32_t cropHeight = 0;   // 图像上侧的空余像素数量
};
struct AlignInfoParams {
uint32_t widthAlign = 0;
uint32_t heightAlign = 0;
};
```


#### 返回值说明

数据类型：DecoderRetCode

取值如下：

- VIDEO_DECODER_SUCCESS：配置解码器成功。
- VIDEO_DECODER_SET_DECODE_PARAMS_FAIL：配置解码器失败。
