Feature: Add menu to set screen strategy for remote control

This commit is contained in:
yuanyuanxiang
2026-01-08 22:10:38 +01:00
parent e0239dce8d
commit 808371ed6e
31 changed files with 541 additions and 425 deletions

View File

@@ -8,33 +8,33 @@ size_t zstd_compress_auto(
size_t threshold
)
{
// 妫€鏌ヨ緭鍏ユ湁鏁堟€?
// 检查输入有效性
if (!cctx || !dst || !src) {
return ZSTD_error_GENERIC;
}
// --- 灏忔暟鎹垨搴撲笉鏀寔澶氱嚎绋?鈫?閫€鍥炲埌鍗曠嚎绋?ZSTD_compress2 ---
// --- 小数据或库不支持多线程 → 退回到单线程 ZSTD_compress2 ---
if (srcSize < threshold) {
return ZSTD_compress2(cctx, dst, dstCapacity, src, srcSize);
}
// --- 澶氱嚎绋嬫祦寮忓帇缂?---
ZSTD_inBuffer input = {src, srcSize, 0};
ZSTD_outBuffer output = {dst, dstCapacity, 0};
// --- 多线程流式压缩 ---
ZSTD_inBuffer input = { src, srcSize, 0 };
ZSTD_outBuffer output = { dst, dstCapacity, 0 };
// 寰幆鍘嬬缉杈撳叆鏁版嵁
// 循环压缩输入数据
size_t ret = 0;
while (input.pos < input.size) {
ret = ZSTD_compressStream2(cctx, &output, &input, ZSTD_e_continue);
if (ZSTD_isError(ret)) break;
// 杈撳嚭缂撳啿鍖哄凡婊★紙鐞嗚涓婁笉搴斿彂鐢燂紝鍥?dstCapacity >= ZSTD_compressBound锛?
// 输出缓冲区已满(理论上不应发生,因 dstCapacity >= ZSTD_compressBound
if (output.pos == output.size) {
return ZSTD_error_dstSize_tooSmall;
}
}
// 缁撴潫鍘嬬缉锛堢‘淇濇墍鏈夌嚎绋嬪畬鎴愶級
// 结束压缩(确保所有线程完成)
if (!ZSTD_isError(ret)) {
ret = ZSTD_compressStream2(cctx, &output, &input, ZSTD_e_end);
}