update hwcodec, add windows ffmpeg vram encoding (#7876)

* windows add ffmpeg vram encoding
* windows add missing nvenc and qsv ram encoding, linux add vaapi, current codec table:  https://github.com/21pages/hwcodec?tab=readme-ov-file#codec

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2024-05-01 00:07:09 +08:00
committed by GitHub
parent f74374e759
commit 34c7c25908
6 changed files with 99 additions and 79 deletions

View File

@@ -208,12 +208,13 @@ impl Encoder {
let mut h265hw_encoding = None;
#[cfg(feature = "hwcodec")]
if enable_hwcodec_option() {
let best = HwRamEncoder::best();
if _all_support_h264_decoding {
h264hw_encoding = best.h264.map_or(None, |c| Some(c.name));
h264hw_encoding =
HwRamEncoder::try_get(CodecFormat::H264).map_or(None, |c| Some(c.name));
}
if _all_support_h265_decoding {
h265hw_encoding = best.h265.map_or(None, |c| Some(c.name));
h265hw_encoding =
HwRamEncoder::try_get(CodecFormat::H265).map_or(None, |c| Some(c.name));
}
}
let h264_useable =
@@ -317,9 +318,8 @@ impl Encoder {
};
#[cfg(feature = "hwcodec")]
if enable_hwcodec_option() {
let best = HwRamEncoder::best();
encoding.h264 |= best.h264.is_some();
encoding.h265 |= best.h265.is_some();
encoding.h264 |= HwRamEncoder::try_get(CodecFormat::H264).is_some();
encoding.h265 |= HwRamEncoder::try_get(CodecFormat::H265).is_some();
}
#[cfg(feature = "vram")]
if enable_vram_option() {
@@ -410,9 +410,16 @@ impl Decoder {
};
#[cfg(feature = "hwcodec")]
{
let best = HwRamDecoder::best();
decoding.ability_h264 |= if best.h264.is_some() { 1 } else { 0 };
decoding.ability_h265 |= if best.h265.is_some() { 1 } else { 0 };
decoding.ability_h264 |= if HwRamDecoder::try_get(CodecFormat::H264).is_some() {
1
} else {
0
};
decoding.ability_h265 |= if HwRamDecoder::try_get(CodecFormat::H265).is_some() {
1
} else {
0
};
}
#[cfg(feature = "vram")]
if enable_vram_option() && _flutter {