fix_capturer_trait_name_shadowing: build win

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2022-07-21 20:04:39 +08:00
parent 416832a1ed
commit d19a8fdc43
13 changed files with 122 additions and 117 deletions

View File

@@ -1,4 +1,4 @@
use crate::common::x11::Frame;
use crate::common::{x11::Frame, TraitCapturer};
use crate::wayland::{capturable::*, *};
use std::{io, time::Duration};
@@ -14,10 +14,6 @@ impl Capturer {
Ok(Capturer(display, r, yuv, Default::default()))
}
pub fn set_use_yuv(&mut self, use_yuv: bool) {
self.2 = use_yuv;
}
pub fn width(&self) -> usize {
self.0.width()
}
@@ -25,8 +21,14 @@ impl Capturer {
pub fn height(&self) -> usize {
self.0.height()
}
}
pub fn frame<'a>(&'a mut self, timeout: Duration) -> io::Result<Frame<'a>> {
impl TraitCapturer for Capturer {
fn set_use_yuv(&mut self, use_yuv: bool) {
self.2 = use_yuv;
}
fn frame<'a>(&'a mut self, timeout: Duration) -> io::Result<Frame<'a>> {
match self.1.capture(timeout.as_millis() as _).map_err(map_err)? {
PixelProvider::BGR0(w, h, x) => Ok(Frame(if self.2 {
crate::common::bgra_to_i420(w as _, h as _, &x, &mut self.3);