mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-07-30 07:21:44 +08:00
feat: 适配 RK 原生 HDMI IN 适配采集
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
include!(concat!(env!("OUT_DIR"), "/ffmpeg_ffi.rs"));
|
||||
|
||||
use serde_derive::{Deserialize, Serialize};
|
||||
use std::env;
|
||||
use std::{env, ffi::CString};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Copy, Serialize, Deserialize)]
|
||||
pub enum AVHWDeviceType {
|
||||
@@ -59,6 +59,22 @@ pub(crate) fn init_av_log() {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn resolve_pixel_format(name: &str, fallback: AVPixelFormat) -> i32 {
|
||||
let c_name = match CString::new(name) {
|
||||
Ok(name) => name,
|
||||
Err(_) => return fallback as i32,
|
||||
};
|
||||
|
||||
unsafe {
|
||||
let resolved = av_get_pix_fmt(c_name.as_ptr());
|
||||
if resolved >= 0 {
|
||||
resolved
|
||||
} else {
|
||||
fallback as i32
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_ffmpeg_log_level() -> i32 {
|
||||
let raw = match env::var("ONE_KVM_FFMPEG_LOG") {
|
||||
Ok(value) => value,
|
||||
|
||||
Reference in New Issue
Block a user