mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 04:55:42 +09:00
chore(repo): prune dead code and duplicate abstractions (#3413)
This commit is contained in:
1 parent
c17091768c
commit
c9fdf8fead
2937 files changed
+42233
-176793
No files matched your search
@@ -13,18 +13,6 @@ fn main() {
|
||||
let has_windows_nvenc = target_os == "windows" && supports_nvenc_arch();
|
||||
let has_windows_nvenc_encoder = has_windows_nvenc;
|
||||
|
||||
println!(
|
||||
"cargo:rustc-env=FLUXER_LINUX_NVENC_COMPILED={}",
|
||||
if has_linux_nvenc { "1" } else { "0" }
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-env=FLUXER_WINDOWS_NVENC_COMPILED={}",
|
||||
if has_windows_nvenc { "1" } else { "0" }
|
||||
);
|
||||
println!(
|
||||
"cargo:rustc-env=FLUXER_WINDOWS_NVENC_ENCODER_COMPILED={}",
|
||||
if has_windows_nvenc_encoder { "1" } else { "0" }
|
||||
);
|
||||
if has_linux_nvenc {
|
||||
println!("cargo:rustc-cfg=fluxer_linux_nvenc");
|
||||
}
|
||||
@@ -34,10 +22,6 @@ fn main() {
|
||||
if has_windows_nvenc_encoder {
|
||||
println!("cargo:rustc-cfg=fluxer_windows_nvenc_encoder");
|
||||
}
|
||||
println!(
|
||||
"cargo:rustc-env=FLUXER_MACOS_VIDEOTOOLBOX_COMPILED={}",
|
||||
if is_macos { "1" } else { "0" }
|
||||
);
|
||||
if is_macos {
|
||||
println!("cargo:rustc-cfg=fluxer_macos_videotoolbox");
|
||||
println!("cargo:rustc-link-lib=framework=CoreFoundation");
|
||||
|
||||
@@ -12,5 +12,4 @@ export interface HardwareEncoderCapability {
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
export declare function isSupported(): boolean;
|
||||
export declare function getHardwareEncoderCapabilities(): HardwareEncoderCapability;
|
||||
@@ -39,10 +39,6 @@ try {
|
||||
loadError = error instanceof Error ? error : new Error(String(error));
|
||||
}
|
||||
|
||||
function isSupported() {
|
||||
return Boolean(binding);
|
||||
}
|
||||
|
||||
function unavailableHardwareEncoderCapability(reason, detail) {
|
||||
return {
|
||||
available: false,
|
||||
@@ -78,6 +74,5 @@ function getHardwareEncoderCapabilities() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isSupported,
|
||||
getHardwareEncoderCapabilities,
|
||||
};
|
||||
@@ -349,36 +349,6 @@ pub fn hardware_encoder_capability() -> HardwareEncoderCapability {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn require_publish_codec_runtime_support(canonical_codec: &str) -> Result<(), String> {
|
||||
let capability = hardware_encoder_capability();
|
||||
require_publish_codec_runtime_support_for_capability(canonical_codec, &capability)
|
||||
}
|
||||
|
||||
fn require_publish_codec_runtime_support_for_capability(
|
||||
canonical_codec: &str,
|
||||
capability: &HardwareEncoderCapability,
|
||||
) -> Result<(), String> {
|
||||
if !canonical_codec.eq_ignore_ascii_case("h265") {
|
||||
return Ok(());
|
||||
}
|
||||
if capability.available
|
||||
&& capability
|
||||
.codecs
|
||||
.iter()
|
||||
.any(|codec| codec.eq_ignore_ascii_case(canonical_codec))
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
let detail = capability
|
||||
.detail
|
||||
.as_deref()
|
||||
.or(capability.reason.as_deref())
|
||||
.unwrap_or("hardware encoder is unavailable");
|
||||
Err(format!(
|
||||
"H.265 publishing requires hardware encoder support; {detail}"
|
||||
))
|
||||
}
|
||||
|
||||
fn current_platform() -> CapabilityPlatform {
|
||||
if cfg!(target_os = "linux") {
|
||||
CapabilityPlatform::Linux
|
||||
@@ -930,10 +900,8 @@ fn probe_macos_videotoolbox_runtime() -> Option<VideoToolboxRuntimeProbe> {
|
||||
}
|
||||
|
||||
unsafe fn hardware_required_dictionary() -> CFDictionaryRef {
|
||||
let key = unsafe {
|
||||
kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder as *const c_void
|
||||
};
|
||||
let value = unsafe { kCFBooleanTrue as *const c_void };
|
||||
let key = unsafe { kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder };
|
||||
let value = unsafe { kCFBooleanTrue };
|
||||
let keys = [key];
|
||||
let values = [value];
|
||||
unsafe {
|
||||
@@ -1048,26 +1016,6 @@ mod tests {
|
||||
assert!(capability.zero_copy);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn publish_codec_runtime_gate_only_requires_hardware_for_h265() {
|
||||
let unavailable = describe_capability(CapabilityPlatform::Linux, false, None);
|
||||
|
||||
assert!(require_publish_codec_runtime_support_for_capability("h264", &unavailable).is_ok());
|
||||
assert!(require_publish_codec_runtime_support_for_capability("vp8", &unavailable).is_ok());
|
||||
let error =
|
||||
require_publish_codec_runtime_support_for_capability("h265", &unavailable).unwrap_err();
|
||||
assert!(error.contains("H.265 publishing requires hardware encoder support"));
|
||||
assert!(error.contains("vendored CUDA Driver API header"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn publish_codec_runtime_gate_accepts_h265_when_reported_available() {
|
||||
let capability = describe_videotoolbox_capability(Some(videotoolbox_ready()));
|
||||
|
||||
assert!(require_publish_codec_runtime_support_for_capability("h265", &capability).is_ok());
|
||||
assert!(require_publish_codec_runtime_support_for_capability("H265", &capability).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reports_no_supported_codecs_when_guid_query_finds_no_fluxer_codecs() {
|
||||
let capability = describe_capability(
|
||||
|
||||
Reference in new issue
Block a user