clippy: clear the workspace errors and apply the machine fixes
- Mark the raw-pointer interop entry points unsafe with # Safety docs (oak-core upload/download/frame-from-pixels, oak-audio convert) and satisfy the existing callers (tests). - mut_from_ref: allow with the ABI contract documented (the handle get_mut helpers in oak-timeline/oak-render/oak-task take the shared reference the C ABI passes; exclusivity is the caller's unsafe contract). - Fix the eq_op in the white-balance normalization (green / green). - Apply cargo clippy --fix across the workspace (redundant closures and field names, field reassignment, items after test modules, ...). - Revert the replace_box fix in image_effect's clip_define: a redefinition must allocate a new box, otherwise the old clip handle stays valid and the HS-map replace contract (clip != clip2) breaks. - 283 warnings remain; they are all non-machine-applicable (chunks_exact -> as_chunks needs a manual iter_mut, too_many_arguments, complex types, missing Safety docs, ...) and are tracked as the follow-up.
This commit is contained in:
@@ -12,7 +12,9 @@ use oak_render::ticket::{AudioTicketParams, MontageClip, TicketPayload};
|
||||
fn main() {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
if args.len() < 6 {
|
||||
eprintln!("usage: render_audio_wav <media> <stream_index> <start_sec> <end_sec> <out.wav> [fps]");
|
||||
eprintln!(
|
||||
"usage: render_audio_wav <media> <stream_index> <start_sec> <end_sec> <out.wav> [fps]"
|
||||
);
|
||||
std::process::exit(64);
|
||||
}
|
||||
let media = &args[1];
|
||||
@@ -20,7 +22,11 @@ fn main() {
|
||||
let start_sec: f64 = args[3].parse().unwrap();
|
||||
let end_sec: f64 = args[4].parse().unwrap();
|
||||
let out_path = &args[5];
|
||||
let fps: i64 = if args.len() > 6 { args[6].parse().unwrap() } else { 25 };
|
||||
let fps: i64 = if args.len() > 6 {
|
||||
args[6].parse().unwrap()
|
||||
} else {
|
||||
25
|
||||
};
|
||||
|
||||
let sample_rate = 48000i32;
|
||||
let channel_layout = 0x3u64; // stereo
|
||||
@@ -58,7 +64,7 @@ fn main() {
|
||||
other => {
|
||||
eprintln!("frame {f}: render failed: {:?}", other.is_err());
|
||||
let frames = ((sample_rate as f64) / fps as f64).round() as usize;
|
||||
pcm.extend(std::iter::repeat(0i16).take(frames * channels));
|
||||
pcm.extend(std::iter::repeat_n(0i16, frames * channels));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user