Commit c38d9325 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Rename Context field frames_to_encode to limit.

parent 38358968
......@@ -305,7 +305,7 @@ impl Config {
Context {
frame_count: 0,
frames_to_be_coded: 0,
limit: 0,
idx: 0,
frames_processed: 0,
frame_q: BTreeMap::new(),
......@@ -323,7 +323,7 @@ impl Config {
pub struct Context {
// timebase: Rational,
frame_count: u64,
frames_to_be_coded: u64,
limit: u64,
idx: u64,
frames_processed: u64,
/// Maps frame *number* to frames
......@@ -397,8 +397,8 @@ impl Context {
self.frame_count
}
pub fn set_frames_to_be_coded(&mut self, frames_to_be_coded: u64) {
self.frames_to_be_coded = frames_to_be_coded;
pub fn set_limit(&mut self, limit: u64) {
self.limit = limit;
}
pub fn needs_more_lookahead(&self) -> bool {
......@@ -406,7 +406,7 @@ impl Context {
}
pub fn needs_more_frames(&self, frame_count: u64) -> bool {
self.frames_to_be_coded == 0 || frame_count < self.frames_to_be_coded
self.limit == 0 || frame_count < self.limit
}
pub fn container_sequence_header(&mut self) -> Vec<u8> {
......
......@@ -255,7 +255,8 @@ fn read_frame_batch<D: Decoder>(ctx: &mut Context, decoder: &mut D, video_info:
}
_ => {
let frames_to_be_coded = ctx.get_frame_count();
ctx.set_frames_to_be_coded(frames_to_be_coded);
// This is a hack, instead when EOF is reached simply "close" the encoder to input (flag)
ctx.set_limit(frames_to_be_coded);
ctx.flush();
}
}
......
......@@ -70,7 +70,7 @@ fn main() {
cfg.enc.show_psnr
);
ctx.set_frames_to_be_coded(cli.limit as u64);
ctx.set_limit(cli.limit as u64);
loop {
match process_frame(&mut ctx, &mut cli.io.output, &mut y4m_dec, y4m_enc.as_mut()) {
......
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