feat: Android Codec Preference

This commit is contained in:
csf
2022-09-16 20:31:01 +08:00
parent c6e1e84c72
commit 6f92edca5c
3 changed files with 76 additions and 41 deletions

View File

@@ -136,15 +136,8 @@ impl<T: InvokeUiSession> Session<T> {
true
}
pub fn has_hwcodec(&self) -> bool {
#[cfg(not(feature = "hwcodec"))]
return false;
#[cfg(feature = "hwcodec")]
return true;
}
pub fn supported_hwcodec(&self) -> (bool, bool) {
#[cfg(feature = "hwcodec")]
#[cfg(any(feature = "hwcodec", feature = "mediacodec"))]
{
let decoder = scrap::codec::Decoder::video_codec_state(&self.id);
let mut h264 = decoder.score_h264 > 0;
@@ -155,10 +148,6 @@ impl<T: InvokeUiSession> Session<T> {
}
return (h264, h265);
}
#[cfg(feature = "mediacodec")]
{
todo!();
}
(false, false)
}