122 lines
3.0 KiB
C
122 lines
3.0 KiB
C
/*
|
|
* @Date: 2024-07-22 15:48:03
|
|
* @LastEditors: Jacky
|
|
* @LastEditTime: 2024-07-22 19:35:03
|
|
* @FilePath: /impp-1.2.0/home/jacky/ingenic/S7215/FTD2000/S7215_FT/venc/VencStream.h
|
|
*/
|
|
#ifndef _VENC_STREAM_H_
|
|
#define _VENC_STREAM_H_
|
|
|
|
#include <stdint.h>
|
|
#include "PlatformDefine.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum {
|
|
H264 = 0,
|
|
H265,
|
|
MPEGTS,
|
|
}encodeFormat_e;
|
|
|
|
typedef struct {
|
|
GD_PIXEL_FORMAT_E inputFormat; //输入图像类型
|
|
encodeFormat_e outputFormat; //编码类型
|
|
uint32_t srcWidth; //原始图像宽
|
|
uint32_t srcHeight; //原始图像高
|
|
uint32_t profile; //编码profile
|
|
|
|
float fps; //输出帧率
|
|
uint32_t targetBitrate; //码率
|
|
uint32_t gop; //gop
|
|
uint32_t minQp; //qp值
|
|
uint32_t maxQp;
|
|
}encodeAttr_t;
|
|
|
|
typedef struct{
|
|
uint32_t frameIndex;
|
|
uint8_t islice;
|
|
}encodeData_t;
|
|
|
|
/**
|
|
* @brief: 编码数据接收回调函数
|
|
* @param {int} chn 编码通道
|
|
* @param {uint32_t} index 数据帧编号
|
|
* @param {char} *ptr 编码数据
|
|
* @param {int} size 编码数据大小
|
|
* @param {void} *userdata 用户指针
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:26:16
|
|
*/
|
|
typedef int32_t (*encodeFrameCallback)(const int chn, char *ptr, int size, encodeData_t *param, void *userdata);
|
|
|
|
|
|
/**
|
|
* @brief: 打开编码通道
|
|
* @param {int} 编码通道号
|
|
* @param {encodeAttr_t} 编码参数(不带会使用默认参数)
|
|
* @param {encodeFrameCallback} 接收编码数据回调
|
|
* @param {void} 用户指针
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:26:35
|
|
*/
|
|
module_error_t encodeOpen(const int chn, encodeAttr_t *param, encodeFrameCallback callback, void *userdata);
|
|
|
|
/**
|
|
* @brief: 关闭编码通道
|
|
* @param {int} 编码通道
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:26:40
|
|
*/
|
|
module_error_t encodeClose(const int chn);
|
|
|
|
/**
|
|
* @brief: 开始编码
|
|
* @param {int} 编码通道
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:26:45
|
|
*/
|
|
|
|
module_error_t encodeStart(const int chn);
|
|
/**
|
|
* @brief: 停止编码
|
|
* @param {int} 编码通道
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:27:54
|
|
*/
|
|
module_error_t encodeStop(const int chn);
|
|
|
|
/**
|
|
* @brief: 设置编码参数
|
|
* @param {int} 编码通道
|
|
* @param {encodeAttr_t}
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:28:45
|
|
*/
|
|
module_error_t encodeSetAttr(const int chn, encodeAttr_t *param);
|
|
|
|
/**
|
|
* @brief: 获取编码参数
|
|
* @param {int} 编码通道
|
|
* @param {encodeAttr_t}
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:30:22
|
|
*/
|
|
module_error_t encodeGetAttr(const int chn, encodeAttr_t *param);
|
|
|
|
/**
|
|
* @brief: 编码发送接口,用于送原始图像帧
|
|
* @param {int} 编码通道
|
|
* @param {GD_VIDEO_FRAME_S} 图像数据结构体
|
|
* @return {*}
|
|
* @Date: 2024-07-22 19:30:26
|
|
*/
|
|
module_error_t encodeSendFrame(const int chn, GD_VIDEO_FRAME_S *frame);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
#endif |