From 39e2d7abbb9dcc8b9e1fa2c50f969fb731a0128d Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_zero@gentoo.org>
Date: Tue, 11 Sep 2018 00:28:08 +0200
Subject: [PATCH] Add Display for Context

And use it in rav1e to output the same stats it did before.
---
 src/api.rs        | 7 +++++++
 src/bin/common.rs | 1 +
 2 files changed, 8 insertions(+)

diff --git a/src/api.rs b/src/api.rs
index 604a8e06..6579eb5c 100644
--- a/src/api.rs
+++ b/src/api.rs
@@ -3,6 +3,7 @@ use context::CDFContext;
 use partition::LAST_FRAME;
 
 use std::collections::VecDeque;
+use std::fmt;
 use std::sync::Arc;
 
 // TODO: use the num crate?
@@ -148,3 +149,9 @@ impl Context {
     self.frame_q.push_back(None);
   }
 }
+
+impl fmt::Display for Context {
+  fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+    write!(f, "Frame {} - {}", self.fi.number, self.fi.frame_type)
+  }
+}
diff --git a/src/bin/common.rs b/src/bin/common.rs
index 04f20c6c..d43038ab 100644
--- a/src/bin/common.rs
+++ b/src/bin/common.rs
@@ -126,6 +126,7 @@ 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();
-- 
GitLab