From 1fecd7168a3f9b15e0ed8e973d215e66551fd604 Mon Sep 17 00:00:00 2001 From: 21pages Date: Thu, 7 Jul 2022 20:55:19 +0800 Subject: [PATCH] hwcodec: linux compatible Signed-off-by: 21pages --- Cargo.lock | 2 +- libs/scrap/Cargo.toml | 2 +- libs/scrap/src/common/convert.rs | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c91272112..21224012f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2209,7 +2209,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hwcodec" version = "0.1.0" -source = "git+https://github.com/21pages/hwcodec#91d1cd327c88490f917457072aeef0676ddb2be7" +source = "git+https://github.com/21pages/hwcodec#890204e0703a3d361fc7a45f035fe75c0575bb1d" dependencies = [ "bindgen", "cc", diff --git a/libs/scrap/Cargo.toml b/libs/scrap/Cargo.toml index 1b269d96e..d40eb0cfd 100644 --- a/libs/scrap/Cargo.toml +++ b/libs/scrap/Cargo.toml @@ -50,5 +50,5 @@ gstreamer = { version = "0.16", optional = true } gstreamer-app = { version = "0.16", features = ["v1_10"], optional = true } gstreamer-video = { version = "0.16", optional = true } -[target.'cfg(target_os = "windows")'.dependencies] +[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies] hwcodec = { git = "https://github.com/21pages/hwcodec", optional = true } diff --git a/libs/scrap/src/common/convert.rs b/libs/scrap/src/common/convert.rs index 306a217ea..2b0223a0a 100644 --- a/libs/scrap/src/common/convert.rs +++ b/libs/scrap/src/common/convert.rs @@ -246,6 +246,7 @@ pub unsafe fn nv12_to_i420( #[cfg(feature = "hwcodec")] pub mod hw { use hbb_common::{anyhow::anyhow, ResultType}; + #[cfg(target_os = "windows")] use hwcodec::{ffmpeg::ffmpeg_linesize_offset_length, AVPixelFormat}; pub fn hw_bgra_to_i420( @@ -381,6 +382,8 @@ pub mod hw { src_stride_y: usize, src_stride_uv: usize, dst: &mut Vec, + _i420: &mut Vec, + _align: usize, ) -> ResultType<()> { dst.resize(width * height * 4, 0); unsafe {