region capture overlay window
This commit is contained in:
@@ -5,6 +5,8 @@ use anyhow::{anyhow, Result};
|
||||
use windows_capture::capture::{
|
||||
CaptureControl, Context as CaptureContext, GraphicsCaptureApiHandler,
|
||||
};
|
||||
|
||||
use crate::CaptureRect;
|
||||
use windows_capture::encoder::{
|
||||
AudioSettingsBuilder, ContainerSettingsBuilder, VideoEncoder, VideoSettingsBuilder,
|
||||
};
|
||||
@@ -73,10 +75,16 @@ pub struct CaptureSession {
|
||||
pub started_at: Instant,
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
pub crop: Option<CaptureRect>,
|
||||
control: CaptureControl<CaptureHandler, anyhow::Error>,
|
||||
}
|
||||
|
||||
pub fn start(output_path: PathBuf, capture_cursor: bool, audio: bool) -> Result<CaptureSession> {
|
||||
pub fn start(
|
||||
output_path: PathBuf,
|
||||
capture_cursor: bool,
|
||||
audio: bool,
|
||||
crop: Option<CaptureRect>,
|
||||
) -> Result<CaptureSession> {
|
||||
let monitor = Monitor::primary().map_err(|e| anyhow!("primary monitor: {e:?}"))?;
|
||||
let width = monitor
|
||||
.width()
|
||||
@@ -117,6 +125,7 @@ pub fn start(output_path: PathBuf, capture_cursor: bool, audio: bool) -> Result<
|
||||
started_at: Instant::now(),
|
||||
width,
|
||||
height,
|
||||
crop,
|
||||
control,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user