Feature: Implement H.264 and AV1 hardware encoding for remote control
Remark: Need to update FFmpeg static libraries to take effort
This commit is contained in:
25
client/EncoderFactory.h
Normal file
25
client/EncoderFactory.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "VideoEncoderBase.h"
|
||||
#include "common/commands.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
// 创建编码器的请求参数。
|
||||
struct EncoderRequest {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
int fps = 30;
|
||||
int bitrate_kbps = 4000;
|
||||
int encodeLevel = LEVEL_H264_SOFT;
|
||||
};
|
||||
|
||||
// 按客户端能力 + 本机硬件能力创建一个 VideoEncoderBase。
|
||||
//
|
||||
// 探测顺序(第一个 open 成功的就用):
|
||||
// AV1 硬编路径
|
||||
// H.264 硬编(CFFmpegH264Encoder 内部按 nvenc/qsv/amf/mf 探)
|
||||
// x264 软编(CX264Encoder,CPU 兜底)
|
||||
//
|
||||
// 失败路径在日志中可见(Mprintf)。返回 nullptr 仅在 x264 也开不起来时(极少见)。
|
||||
std::unique_ptr<VideoEncoderBase> CreateEncoder(const EncoderRequest& req);
|
||||
Reference in New Issue
Block a user