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

@@ -24,7 +24,7 @@ fn get_display(i: usize) -> Display {
fn record(i: usize) {
use std::time::Duration;
use scrap::TraitFrame;
use scrap::{Frame, TraitPixelBuffer};
for d in Display::all().unwrap() {
println!("{:?} {} {}", d.origin(), d.width(), d.height());
@@ -44,8 +44,11 @@ fn record(i: usize) {
println!("Filter window for cls {} name {}", wnd_cls, wnd_name);
}
let captured_frame = capture_mag.frame(Duration::from_millis(0)).unwrap();
let frame = captured_frame.data();
let frame = capture_mag.frame(Duration::from_millis(0)).unwrap();
let Frame::PixelBuffer(frame) = frame else {
return;
};
let frame = frame.data();
println!("Capture data len: {}, Saving...", frame.len());
let mut bitflipped = Vec::with_capacity(w * h * 4);
@@ -81,6 +84,9 @@ fn record(i: usize) {
}
let frame = capture_mag.frame(Duration::from_millis(0)).unwrap();
let Frame::PixelBuffer(frame) = frame else {
return;
};
println!("Capture data len: {}, Saving...", frame.data().len());
let mut raw = Vec::new();