use crate::device::DacInfo;
use crate::error::Error;
use crate::point::LaserPoint;
use super::{Frame, OutputResetReason};
pub(crate) trait FifoContentSource: Send {
fn produce_chunk(&mut self, target_points: usize, pps: u32, is_armed: bool) -> &[LaserPoint];
fn cached_slice(&self) -> Option<&[LaserPoint]>;
fn commit_written(&mut self, n: usize, is_armed: bool);
#[allow(dead_code)]
fn discard_cached(&mut self);
fn reserve_buf(&mut self, n: usize);
fn on_reconnect(&mut self, info: &DacInfo);
#[allow(dead_code)]
fn is_ended(&self) -> bool;
#[allow(dead_code)]
fn submit_frame(&mut self, _frame: Frame) {}
#[allow(dead_code)]
fn arm_startup_blank(&mut self, _pps: u32) {}
#[allow(dead_code)]
fn on_disarm(&mut self) {}
#[allow(dead_code)]
fn reset_output_filter(&mut self, _reason: OutputResetReason) {}
#[allow(dead_code)]
fn resize_color_delay_micros(&mut self, _micros: u64, _pps: u32) {}
#[allow(dead_code)]
fn take_stop_error(&mut self) -> Option<Error> {
None
}
}
pub(crate) trait FrameContentSource: Send {
fn produce_frame(&mut self, pps: u32, is_armed: bool) -> &[LaserPoint];
fn cached_slice(&self) -> Option<&[LaserPoint]>;
fn commit_written(&mut self, n: usize, is_armed: bool);
#[allow(dead_code)]
fn discard_cached(&mut self);
fn on_reconnect(&mut self, info: &DacInfo);
#[allow(dead_code)]
fn set_frame_capacity(&mut self, _cap: Option<usize>) {}
#[allow(dead_code)]
fn submit_frame(&mut self, _frame: Frame) {}
#[allow(dead_code)]
fn arm_startup_blank(&mut self, _pps: u32) {}
#[allow(dead_code)]
fn on_disarm(&mut self) {}
#[allow(dead_code)]
fn reset_output_filter(&mut self, _reason: OutputResetReason) {}
#[allow(dead_code)]
fn resize_color_delay_micros(&mut self, _micros: u64, _pps: u32) {}
}
pub(crate) enum ContentSourceKind<'a> {
Fifo(&'a mut dyn FifoContentSource),
Frame(&'a mut dyn FrameContentSource),
}