Files
One-KVM/libs/hwcodec/cpp/common/util.h
a15355447898 1d48d45592 feat: 支持高通 iris v4l2m2m 硬件编码器
- 新增高通平台检测,避免 Amlogic v4l2m2m 检测误判
- 对高通 Iris 编码器调整 GOP 和 capture buffers
- 强制关键帧仅在高通 Iris 之外启用
2026-08-26 15:51:55 +08:00

56 lines
1.7 KiB
C++

#ifndef UTIL_H
#define UTIL_H
#include <string>
#include <chrono>
extern "C" {
#include <libavcodec/avcodec.h>
}
namespace util_encode {
bool is_qcom_iris_platform();
bool supports_forced_keyframe(const std::string &name);
void set_av_codec_ctx(AVCodecContext *c, const std::string &name, int kbs,
int gop, int fps, int thread_count);
bool set_lantency_free(void *priv_data, const std::string &name);
bool set_quality(void *priv_data, const std::string &name, int quality);
bool set_rate_control(AVCodecContext *c, const std::string &name, int rc,
int q);
bool set_gpu(void *priv_data, const std::string &name, int gpu);
bool force_hw(void *priv_data, const std::string &name);
bool set_others(void *priv_data, const std::string &name);
bool change_bit_rate(AVCodecContext *c, const std::string &name, int kbs);
void vram_encode_test_callback(const uint8_t *data, int32_t len, int32_t key, const void *obj, int64_t pts);
} // namespace util
namespace util_decode {
bool has_flag_could_not_find_ref_with_poc();
}
namespace util {
inline std::chrono::steady_clock::time_point now() {
return std::chrono::steady_clock::now();
}
inline int64_t elapsed_ms(std::chrono::steady_clock::time_point start) {
return std::chrono::duration_cast<std::chrono::milliseconds>(now() - start).count();
}
inline bool skip_test(const int64_t *excludedLuids, const int32_t *excludeFormats, int32_t excludeCount, int64_t currentLuid, int32_t dataFormat) {
for (int32_t i = 0; i < excludeCount; i++) {
if (excludedLuids[i] == currentLuid && excludeFormats[i] == dataFormat) {
return true;
}
}
return false;
}
}
#endif