1use crate::{error::FfProbeError, ffprobe::FfProbe, ffprobe_config, IntoFfprobeArg};
2
3#[derive(Clone, Debug)]
7pub struct Config {
8 pub(crate) count_frames: bool,
9 pub(crate) ffprobe_bin: std::path::PathBuf,
10}
11
12impl Config {
13 pub fn new() -> Config {
15 Config {
16 count_frames: false,
17 ffprobe_bin: "ffprobe".into(),
18 }
19 }
20
21 pub fn count_frames(mut self, count_frames: bool) -> Self {
25 self.count_frames = count_frames;
26 self
27 }
28
29 pub fn ffprobe_bin(mut self, ffprobe_bin: impl AsRef<std::path::Path>) -> Self {
32 self.ffprobe_bin = ffprobe_bin.as_ref().to_path_buf();
33 self
34 }
35
36 pub fn run<'a, T: IntoFfprobeArg<'a>>(self, path: T) -> Result<FfProbe, FfProbeError> {
38 ffprobe_config(self, path)
39 }
40}
41
42impl Default for Config {
43 fn default() -> Self {
44 Self::new()
45 }
46}