mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-01 01:21:06 +03:00
Updated build.rs to tell RustC that dxgi, quartz and x11 are expected configurations.
Added lifetime annotations to various methods in common/aom.rs and common/vpxcodec.rs. Updated common/vpx.rs to allow unused_imports in the generated bindings. Updated dxgi/mag.rs to allow non_snake_case identifiers like "dwFilterMode".
This commit is contained in:
@@ -227,6 +227,9 @@ fn ffmpeg() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// in this crate, these are also valid configurations
|
||||||
|
println!("cargo::rustc-check-cfg=cfg(dxgi,quartz,x11)");
|
||||||
|
|
||||||
// there is problem with cfg(target_os) in build.rs, so use our workaround
|
// there is problem with cfg(target_os) in build.rs, so use our workaround
|
||||||
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
|
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ impl EncoderApi for AomEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AomEncoder {
|
impl AomEncoder {
|
||||||
pub fn encode(&mut self, ms: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames> {
|
pub fn encode<'a>(&'a mut self, ms: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames<'a>> {
|
||||||
let bpp = if self.i444 { 24 } else { 12 };
|
let bpp = if self.i444 { 24 } else { 12 };
|
||||||
if data.len() < self.width * self.height * bpp / 8 {
|
if data.len() < self.width * self.height * bpp / 8 {
|
||||||
return Err(Error::FailedCall("len not enough".to_string()));
|
return Err(Error::FailedCall("len not enough".to_string()));
|
||||||
@@ -461,7 +461,7 @@ impl AomDecoder {
|
|||||||
Ok(Self { ctx })
|
Ok(Self { ctx })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode(&mut self, data: &[u8]) -> Result<DecodeFrames> {
|
pub fn decode<'a>(&'a mut self, data: &[u8]) -> Result<DecodeFrames<'a>> {
|
||||||
call_aom!(aom_codec_decode(
|
call_aom!(aom_codec_decode(
|
||||||
&mut self.ctx,
|
&mut self.ctx,
|
||||||
data.as_ptr(),
|
data.as_ptr(),
|
||||||
@@ -476,7 +476,7 @@ impl AomDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Notify the decoder to return any pending frame
|
/// Notify the decoder to return any pending frame
|
||||||
pub fn flush(&mut self) -> Result<DecodeFrames> {
|
pub fn flush<'a>(&'a mut self) -> Result<DecodeFrames<'a>> {
|
||||||
call_aom!(aom_codec_decode(
|
call_aom!(aom_codec_decode(
|
||||||
&mut self.ctx,
|
&mut self.ctx,
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
#![allow(improper_ctypes)]
|
#![allow(improper_ctypes)]
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
impl Default for vpx_codec_enc_cfg {
|
impl Default for vpx_codec_enc_cfg {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ impl EncoderApi for VpxEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VpxEncoder {
|
impl VpxEncoder {
|
||||||
pub fn encode(&mut self, pts: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames> {
|
pub fn encode<'a>(&'a mut self, pts: i64, data: &[u8], stride_align: usize) -> Result<EncodeFrames<'a>> {
|
||||||
let bpp = if self.i444 { 24 } else { 12 };
|
let bpp = if self.i444 { 24 } else { 12 };
|
||||||
if data.len() < self.width * self.height * bpp / 8 {
|
if data.len() < self.width * self.height * bpp / 8 {
|
||||||
return Err(Error::FailedCall("len not enough".to_string()));
|
return Err(Error::FailedCall("len not enough".to_string()));
|
||||||
@@ -268,7 +268,7 @@ impl VpxEncoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Notify the encoder to return any pending packets
|
/// Notify the encoder to return any pending packets
|
||||||
pub fn flush(&mut self) -> Result<EncodeFrames> {
|
pub fn flush<'a>(&'a mut self) -> Result<EncodeFrames<'a>> {
|
||||||
call_vpx!(vpx_codec_encode(
|
call_vpx!(vpx_codec_encode(
|
||||||
&mut self.ctx,
|
&mut self.ctx,
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
@@ -473,7 +473,7 @@ impl VpxDecoder {
|
|||||||
/// The `data` slice is sent to the decoder
|
/// The `data` slice is sent to the decoder
|
||||||
///
|
///
|
||||||
/// It matches a call to `vpx_codec_decode`.
|
/// It matches a call to `vpx_codec_decode`.
|
||||||
pub fn decode(&mut self, data: &[u8]) -> Result<DecodeFrames> {
|
pub fn decode<'a>(&'a mut self, data: &[u8]) -> Result<DecodeFrames<'a>> {
|
||||||
call_vpx!(vpx_codec_decode(
|
call_vpx!(vpx_codec_decode(
|
||||||
&mut self.ctx,
|
&mut self.ctx,
|
||||||
data.as_ptr(),
|
data.as_ptr(),
|
||||||
@@ -489,7 +489,7 @@ impl VpxDecoder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Notify the decoder to return any pending frame
|
/// Notify the decoder to return any pending frame
|
||||||
pub fn flush(&mut self) -> Result<DecodeFrames> {
|
pub fn flush<'a>(&'a mut self) -> Result<DecodeFrames<'a>> {
|
||||||
call_vpx!(vpx_codec_decode(
|
call_vpx!(vpx_codec_decode(
|
||||||
&mut self.ctx,
|
&mut self.ctx,
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// logic from webrtc -- https://github.com/shiguredo/libwebrtc/blob/main/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
|
// logic from webrtc -- https://github.com/shiguredo/libwebrtc/blob/main/modules/desktop_capture/win/screen_capturer_win_magnifier.cc
|
||||||
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use lazy_static;
|
use lazy_static;
|
||||||
use std::{
|
use std::{
|
||||||
ffi::CString,
|
ffi::CString,
|
||||||
|
|||||||
Reference in New Issue
Block a user