Skip to content

Commit

Permalink
Add a way to set the framerate at runtime
Browse files Browse the repository at this point in the history
The right way to do this is with a Parameter, but I'm a little pressed for time so I'll go back and do it the right way later.
  • Loading branch information
rrbutani authored and HeroicKatora committed Jun 13, 2020
1 parent 7bdeaa8 commit 11d9be6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ impl<W: Write> Encoder<W> {
Encoder { w, info }
}

pub fn new_animated_with_frame_rate(w: W, width: u32, height: u32, frames: u32, delay_num: u16, delay_den: u16) -> Result<Encoder<W>> {
let mut enc = Encoder::new_animated(w, width, height, frames)?;

let mut frame_ctl = enc.info.frame_control.unwrap();
frame_ctl.delay_num = delay_num;
frame_ctl.delay_den = delay_den;

enc.info.frame_control = Some(frame_ctl);
Ok(enc)
}

pub fn new_animated(w: W, width: u32, height: u32, frames: u32) -> Result<Encoder<W>> {
if frames > 0 {
let mut encoder = Encoder::new(w, width, height);
Expand Down

0 comments on commit 11d9be6

Please sign in to comment.