add zero copy mode hareware codec for windows (#6778)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2024-01-02 16:58:10 +08:00
committed by GitHub
parent f47faa548b
commit 89150317e1
55 changed files with 2540 additions and 429 deletions

View File

@@ -830,11 +830,29 @@ pub fn has_hwcodec() -> bool {
return true;
}
#[inline]
pub fn has_gpucodec() -> bool {
cfg!(feature = "gpucodec")
}
#[cfg(feature = "flutter")]
#[inline]
pub fn supported_hwdecodings() -> (bool, bool) {
let decoding = scrap::codec::Decoder::supported_decodings(None);
(decoding.ability_h264 > 0, decoding.ability_h265 > 0)
let decoding = scrap::codec::Decoder::supported_decodings(None, true, None);
#[allow(unused_mut)]
let (mut h264, mut h265) = (decoding.ability_h264 > 0, decoding.ability_h265 > 0);
#[cfg(feature = "gpucodec")]
{
// supported_decodings check runtime luid
let gpu = scrap::gpucodec::GpuDecoder::possible_available_without_check();
if gpu.0 {
h264 = true;
}
if gpu.1 {
h265 = true;
}
}
(h264, h265)
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]