Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

chore: cargo fmt

Richie McIlroyf1dac2cbc329
diff --git a/crates/editor/examples/editor-startup-benchmark.rs b/crates/editor/examples/editor-startup-benchmark.rs
index 395678abc..2004b0e82 100644
--- a/crates/editor/examples/editor-startup-benchmark.rs
+++ b/crates/editor/examples/editor-startup-benchmark.rs
@@ -6,8 +6,7 @@ use std::{
use cap_editor::{
EditorFrameOutput, EditorInstance, FrameLayout, Renderer, create_segments,
- finish_renderer_layers_creation,
- start_renderer_layers_creation,
+ finish_renderer_layers_creation, start_renderer_layers_creation,
};
use cap_project::{ProjectConfiguration, RecordingMeta, RecordingMetaInner};
use cap_rendering::{ProjectRecordingsMeta, RenderVideoConstants};
diff --git a/crates/recording/src/output_pipeline/core.rs b/crates/recording/src/output_pipeline/core.rs
index a24f019cd..266615559 100644
--- a/crates/recording/src/output_pipeline/core.rs
+++ b/crates/recording/src/output_pipeline/core.rs
@@ -732,7 +732,10 @@ const SILENCE_FRAME_MAX: Duration = Duration::from_secs(1);
/// (a system-audio track whose last sound came long before stop stayed
/// short) came from comparing an epoch-relative target against the
/// track-local timeline.
-fn audio_tail_padding_duration(audio_elapsed: Duration, track_target_elapsed: Duration) -> Duration {
+fn audio_tail_padding_duration(
+ audio_elapsed: Duration,
+ track_target_elapsed: Duration,
+) -> Duration {
track_target_elapsed.saturating_sub(audio_elapsed)
}
@@ -826,7 +829,9 @@ impl AudioGapTracker {
/// capture time of the first muxed frame, or zero when the track is
/// anchored at the epoch itself.
fn track_start_offset(&self) -> Option<Duration> {
- let secs = self.first_frame_ts?.signed_duration_since_secs(self.reference);
+ let secs = self
+ .first_frame_ts?
+ .signed_duration_since_secs(self.reference);
Some(Duration::from_secs_f64(secs.max(0.0)))
}
@@ -2762,7 +2767,9 @@ async fn process_audio_frame<TMutex: AudioMuxer>(
&& !state.gap_tracker.started()
{
let epoch_ts = Timestamp::Instant(ctx.timestamps.instant());
- state.gap_tracker.mark_started(epoch_ts, ctx.timestamps.instant());
+ state
+ .gap_tracker
+ .mark_started(epoch_ts, ctx.timestamps.instant());
let head_secs = frame.timestamp.signed_duration_since_secs(ctx.timestamps);
let head = Duration::from_secs_f64(head_secs.max(0.0))
@@ -2812,13 +2819,12 @@ async fn process_audio_frame<TMutex: AudioMuxer>(
}
if let Some(first_tx) = state.first_tx.take() {
- let anchor_ts = if ctx.anchor == AudioAnchor::PipelineEpoch
- && ctx.video_start_gate.is_none()
- {
- Timestamp::Instant(ctx.timestamps.instant())
- } else {
- frame.timestamp
- };
+ let anchor_ts =
+ if ctx.anchor == AudioAnchor::PipelineEpoch && ctx.video_start_gate.is_none() {
+ Timestamp::Instant(ctx.timestamps.instant())
+ } else {
+ frame.timestamp
+ };
let _ = first_tx.send(anchor_ts);
}
@@ -5681,7 +5687,9 @@ mod tests {
let first_frame_at = Duration::from_millis(2_500);
assert!(matches!(
- harness.process_at(first_frame_at, first_frame_at, 960).await,
+ harness
+ .process_at(first_frame_at, first_frame_at, 960)
+ .await,
AudioFrameOutcome::Sent
));
@@ -5786,7 +5794,9 @@ mod tests {
let first_frame_at = Duration::from_millis(2_500);
assert!(matches!(
- harness.process_at(first_frame_at, first_frame_at, 960).await,
+ harness
+ .process_at(first_frame_at, first_frame_at, 960)
+ .await,
AudioFrameOutcome::Sent
));
diff --git a/crates/recording/tests/sync_matrix.rs b/crates/recording/tests/sync_matrix.rs
index fb1d394f6..734ce7f99 100644
--- a/crates/recording/tests/sync_matrix.rs
+++ b/crates/recording/tests/sync_matrix.rs
@@ -682,15 +682,19 @@ fn read_audio_envelope(path: &Path, win_secs: f64) -> Result<(Vec<f64>, f64), St
let mut rate = 0u32;
let mut frame = ffmpeg::frame::Audio::empty();
let drain = |decoder: &mut ffmpeg::decoder::Audio,
- samples: &mut Vec<f64>,
- rate: &mut u32,
- frame: &mut ffmpeg::frame::Audio| {
+ samples: &mut Vec<f64>,
+ rate: &mut u32,
+ frame: &mut ffmpeg::frame::Audio| {
while decoder.receive_frame(frame).is_ok() {
*rate = frame.rate();
if let ffmpeg::format::Sample::F32(ffmpeg::format::sample::Type::Planar) =
frame.format()
{
- samples.extend(frame.plane::<f32>(0)[..frame.samples()].iter().map(|&v| f64::from(v)));
+ samples.extend(
+ frame.plane::<f32>(0)[..frame.samples()]
+ .iter()
+ .map(|&v| f64::from(v)),
+ );
}
}
};
@@ -865,12 +869,8 @@ async fn run_mic_with_system_audio_case() -> Result<String, String> {
let (sys_tx, sys_rx) = futures::channel::mpsc::channel::<AudioFrame>(32);
// The mic delivers continuously from device-ready at 0.15s to stop.
- let mic_emit = spawn_burst_emitter(
- mic_tx,
- info,
- timestamps,
- vec![(MIC_START_SECS, TOTAL_SECS)],
- );
+ let mic_emit =
+ spawn_burst_emitter(mic_tx, info, timestamps, vec![(MIC_START_SECS, TOTAL_SECS)]);
let sys_emit = spawn_burst_emitter(sys_tx, info, timestamps, system_bursts.clone());
let mic_pipeline = OutputPipeline::builder(mic_path.clone())
diff --git a/crates/rendering/src/zoom_spring.rs b/crates/rendering/src/zoom_spring.rs
index 119cceaab..34f9d2af2 100644
--- a/crates/rendering/src/zoom_spring.rs
+++ b/crates/rendering/src/zoom_spring.rs
@@ -237,8 +237,7 @@ fn map_timeline_to_recording_secs(map: &[TimeMapSegment], timeline_secs: f64) ->
/// One precomputed step. Sample times are implicit: `samples[i]` is the state
/// at `i * STEP_MS`, so lookup is pure index math.
-#[derive(Clone, Copy)]
-#[derive(Debug)]
+#[derive(Clone, Copy, Debug)]
struct TimelineSample {
amount: f32,
center: XY<f32>,