diff --git a/examples/decode_avcc.rs b/examples/decode_avcc.rs
new file mode 100644
index 0000000..1e53fd6
--- /dev/null
+++ b/examples/decode_avcc.rs
@@ -0,0 +1,22 @@
+//! Creates a context from an encoded
+//! [`h264_reader::avc::AVCDecoderConfigurationRecord`] and prints it.
+
+use std::convert::TryFrom;
+
+use h264_reader::avcc::AvcDecoderConfigurationRecord;
+
+fn main() {
+ let path = {
+ let mut args = std::env::args_os();
+ if args.len() != 2 {
+ eprintln!("Usage: decode_avcc path/to/avcc");
+ std::process::exit(1);
+ }
+ args.nth(1).unwrap()
+ };
+
+ let raw = std::fs::read(path).unwrap();
+ let record = AvcDecoderConfigurationRecord::try_from(&raw[..]).unwrap();
+ let ctx = record.create_context().unwrap();
+ println!("{:#?}", &ctx);
+}
diff --git a/src/lib.rs b/src/lib.rs
index 00f32da..2755568 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,6 +3,8 @@
#![forbid(unsafe_code)]
#![deny(rust_2018_idioms)]
+use std::fmt::Debug;
+
pub mod annexb;
pub mod avcc;
pub mod nal;
@@ -11,58 +13,89 @@ pub mod rbsp;
/// Contextual data that needs to be tracked between evaluations of different portions of H264
/// syntax.
+#[derive(Default, Debug)]
pub struct Context {
- seq_param_sets: Vec