This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

♻️ Take any impl Into<PathBuf> in Video methods

+13 -6
+1 -1
examples/schedule-hell/src/main.rs
··· 221 221 Ok(()) 222 222 }); 223 223 224 - video.render("schedule-hell.mp4".into())?; 224 + video.render("schedule-hell.mp4")?; 225 225 226 226 Ok(()) 227 227 }
+12 -5
src/video/encoding.rs
··· 56 56 } 57 57 58 58 impl<AdditionalContext: Default> Video<AdditionalContext> { 59 - fn setup_encoder(&mut self, output_path: &str) -> anyhow::Result<()> { 59 + fn setup_encoder( 60 + &mut self, 61 + output_path: impl Into<PathBuf>, 62 + ) -> anyhow::Result<()> { 60 63 debug_time!("setup_encoder"); 64 + let output_path: PathBuf = output_path.into(); 65 + 61 66 let (width, height) = 62 67 self.initial_canvas.resolution_to_size_even(self.resolution); 63 68 ··· 71 76 .expect("Failed to find libx264 encoder"); 72 77 73 78 self.encoder = Some(Arc::new(Mutex::new( 74 - video_rs::Encoder::new(PathBuf::from_str(output_path)?, settings) 79 + video_rs::Encoder::new(output_path, settings) 75 80 .expect("Failed to build encoder"), 76 81 ))); 77 82 ··· 221 226 Ok(written_frames_count) 222 227 } 223 228 224 - pub fn render(&mut self, output_file: String) -> Result<()> { 229 + pub fn render(&mut self, output_file: impl Into<PathBuf>) -> Result<()> { 225 230 debug_time!("render"); 226 231 232 + let output_file: PathBuf = output_file.into(); 233 + 227 234 // create_dir_all(self.frames_output_directory)?; 228 235 // remove_dir_all(self.frames_output_directory)?; 229 236 // create_dir(self.frames_output_directory)?; 230 - create_dir_all(Path::new(&output_file).parent().unwrap())?; 237 + create_dir_all(&output_file.parent().unwrap())?; 231 238 232 239 self.setup_encoder(&output_file)?; 233 240 ··· 246 253 247 254 self.progress_bar.log( 248 255 "Rendered", 249 - &format!("{} frames to {}", frames_written, output_file), 256 + &format!("{} frames to {:?}", frames_written, output_file), 250 257 ); 251 258 252 259 self.progress_bar.set_position(0);