Commit 2596d1ea authored by Nathan E. Egge's avatar Nathan E. Egge

Add an optional -l limit parameter.

parent 3c624b42
......@@ -23,5 +23,8 @@ fn main() {
break;
}
frame_number += 1;
if frame_number == files.limit {
break;
}
}
}
......@@ -33,6 +33,9 @@ fn main() {
process_frame(frame_number, &sequence, &fi,
&mut files.output_file, &mut y4m_dec, y4m_enc.as_mut());
frame_number += 1;
if frame_number == files.limit {
break;
}
},
Some("quit") => break,
Some("exit") => break,
......
......@@ -139,6 +139,7 @@ pub struct EncoderConfig {
pub input_file: Box<Read>,
pub output_file: Box<Write>,
pub rec_file: Option<Box<Write>>,
pub limit: u64
}
impl EncoderConfig {
......@@ -159,6 +160,12 @@ impl EncoderConfig {
.arg(Arg::with_name("RECONSTRUCTION")
.short("r")
.takes_value(true))
.arg(Arg::with_name("LIMIT")
.help("Maximum number of frames to encode")
.short("l")
.long("limit")
.takes_value(true)
.default_value("0"))
.get_matches();
EncoderConfig {
......@@ -172,7 +179,8 @@ impl EncoderConfig {
},
rec_file: matches.value_of("RECONSTRUCTION").map(|f| {
Box::new(File::create(&f).unwrap()) as Box<Write>
})
}),
limit: matches.value_of("LIMIT").unwrap().parse().unwrap()
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment