feat(avhw): integrate transform into VA-API filter graph
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
16
src/state.rs
16
src/state.rs
@@ -35,7 +35,7 @@ use crate::args::Args;
|
||||
use crate::avhw::{AvHwDevCtx, EncState};
|
||||
use crate::cap_wlr_screencopy::CapWlrScreencopy;
|
||||
use crate::fps_limit::FpsLimit;
|
||||
use crate::transform::Transform;
|
||||
use crate::transform::{transpose_if_transform_transposed, Transform};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// CaptureSource trait
|
||||
@@ -429,14 +429,19 @@ impl<S: CaptureSource> State<S> {
|
||||
});
|
||||
let gop_size = self.args.gop_size.unwrap_or(self.args.fps);
|
||||
let fps = self.args.fps;
|
||||
let (enc_w, enc_h) =
|
||||
transpose_if_transform_transposed(output_info.transform, width as i32, height as i32);
|
||||
let enc = match EncState::new(
|
||||
&drm_path,
|
||||
Path::new(&self.args.output),
|
||||
width,
|
||||
height,
|
||||
enc_w as u32,
|
||||
enc_h as u32,
|
||||
bitrate,
|
||||
gop_size,
|
||||
fps,
|
||||
output_info.transform,
|
||||
) {
|
||||
Ok(enc) => enc,
|
||||
Err(e) => {
|
||||
@@ -473,7 +478,7 @@ impl<S: CaptureSource> State<S> {
|
||||
match pos {
|
||||
Some(i) => Some(i),
|
||||
None => {
|
||||
let all_probed = outputs.iter().all(|o| o.done_count >= 2);
|
||||
let all_probed = outputs.iter().all(|o| o.done_count >= 1);
|
||||
if all_probed {
|
||||
let available: Vec<&str> =
|
||||
outputs.iter().filter_map(|o| o.name.as_deref()).collect();
|
||||
@@ -487,7 +492,7 @@ impl<S: CaptureSource> State<S> {
|
||||
None
|
||||
}
|
||||
}
|
||||
} else if outputs.iter().all(|o| o.done_count >= 2) {
|
||||
} else if outputs.iter().all(|o| o.done_count >= 1) {
|
||||
if outputs.is_empty() {
|
||||
return false;
|
||||
}
|
||||
@@ -635,6 +640,7 @@ impl<S: CaptureSource> Dispatch<WlRegistry, GlobalListContents> for State<S> {
|
||||
qhandle: &QueueHandle<State<S>>,
|
||||
) {
|
||||
use wayland_client::protocol::wl_registry::Event as RegistryEvent;
|
||||
tracing::debug!("Dispatch<WlRegistry>::event fired: {:?}", event);
|
||||
|
||||
match event {
|
||||
RegistryEvent::Global {
|
||||
@@ -793,7 +799,7 @@ impl<S: CaptureSource> Dispatch<WlOutput, OutputId> for State<S> {
|
||||
if let EncConstructionStage::ProbingOutputs { outputs, .. } = &mut state.stage {
|
||||
if let Some(info) = outputs.get_mut(idx) {
|
||||
info.done_count += 1;
|
||||
if info.done_count >= 2 {
|
||||
if info.done_count >= 1 {
|
||||
state.try_finalize_output(idx);
|
||||
}
|
||||
}
|
||||
@@ -849,7 +855,7 @@ impl<S: CaptureSource> Dispatch<ZxdgOutputV1, OutputId> for State<S> {
|
||||
if let EncConstructionStage::ProbingOutputs { outputs, .. } = &mut state.stage {
|
||||
if let Some(info) = outputs.get_mut(idx) {
|
||||
info.done_count += 1;
|
||||
if info.done_count >= 2 {
|
||||
if info.done_count >= 1 {
|
||||
state.try_finalize_output(idx);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user