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

@@ -216,24 +216,16 @@ impl<T: InvokeUiSession> Session<T> {
true
}
pub fn supported_hwcodec(&self) -> (bool, bool) {
#[cfg(any(feature = "hwcodec", feature = "mediacodec"))]
{
let decoder = scrap::codec::Decoder::video_codec_state(&self.id);
let mut h264 = decoder.score_h264 > 0;
let mut h265 = decoder.score_h265 > 0;
let (encoding_264, encoding_265) = self
.lc
.read()
.unwrap()
.supported_encoding
.unwrap_or_default();
h264 = h264 && encoding_264;
h265 = h265 && encoding_265;
return (h264, h265);
}
#[allow(unreachable_code)]
(false, false)
pub fn alternative_codecs(&self) -> (bool, bool, bool) {
let decoder = scrap::codec::Decoder::supported_decodings(None);
let mut vp8 = decoder.ability_vp8 > 0;
let mut h264 = decoder.ability_h264 > 0;
let mut h265 = decoder.ability_h265 > 0;
let enc = &self.lc.read().unwrap().supported_encoding;
vp8 = vp8 && enc.vp8;
h264 = h264 && enc.h264;
h265 = h265 && enc.h265;
(vp8, h264, h265)
}
pub fn change_prefer_codec(&self) {