Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2023-03-31 16:10:52 +08:00
parent 02561c3fff
commit 78748271ac
22 changed files with 470 additions and 441 deletions

View File

@@ -969,6 +969,13 @@ pub fn main_has_hwcodec() -> SyncReturn<bool> {
SyncReturn(has_hwcodec())
}
pub fn main_supported_hwdecodings() -> SyncReturn<String> {
let decoding = supported_hwdecodings();
let msg = HashMap::from([("h264", decoding.0), ("h265", decoding.1)]);
SyncReturn(serde_json::ser::to_string(&msg).unwrap_or("".to_owned()))
}
pub fn main_is_root() -> bool {
is_root()
}
@@ -1054,10 +1061,10 @@ pub fn session_send_note(id: String, note: String) {
}
}
pub fn session_supported_hwcodec(id: String) -> String {
pub fn session_alternative_codecs(id: String) -> String {
if let Some(session) = SESSIONS.read().unwrap().get(&id) {
let (h264, h265) = session.supported_hwcodec();
let msg = HashMap::from([("h264", h264), ("h265", h265)]);
let (vp8, h264, h265) = session.alternative_codecs();
let msg = HashMap::from([("vp8", vp8), ("h264", h264), ("h265", h265)]);
serde_json::ser::to_string(&msg).unwrap_or("".to_owned())
} else {
String::new()