Skip to content
Snippets Groups Projects
Commit fd6bfc88 authored by Luca Barbato's avatar Luca Barbato Committed by Thomas Daede
Browse files

Fix and improve the stats output

Store the frame_type in the packet and implement Display for it.
parent 2444eeaf
No related branches found
No related tags found
No related merge requests found
......@@ -69,7 +69,14 @@ pub enum EncoderStatus {
pub struct Packet {
pub data: Vec<u8>,
pub rec: Frame,
pub number: usize
pub number: usize,
pub frame_type: FrameType
}
impl fmt::Display for Packet {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Frame {} - {} - {} bytes", self.number, self.frame_type, self.data.len())
}
}
impl Context {
......@@ -139,7 +146,7 @@ impl Context {
update_rec_buffer(&mut self.fi, fs);
Ok(Packet { data, rec, number })
Ok(Packet { data, rec, number, frame_type: self.fi.frame_type })
} else {
unimplemented!("Flushing not implemented")
}
......
......@@ -126,10 +126,9 @@ pub fn process_frame(ctx: &mut Context,
_ => panic! ("unknown input bit depth!"),
}
eprintln!("{}", ctx);
let _ = ctx.send_frame(input);
let pkt = ctx.receive_packet().unwrap();
eprintln!("{}", pkt);
write_ivf_frame(output_file, pkt.number as u64, pkt.data.as_ref());
if let Some(mut y4m_enc) = y4m_enc {
let pitch_y = if bit_depth > 8 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment