Skip to content

Commit

Permalink
Update libgifski
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 3, 2020
1 parent 38dee2b commit 15db51b
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 172 deletions.
141 changes: 10 additions & 131 deletions gifski-api/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions gifski-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "AGPL-3.0+"
name = "gifski"
readme = "README.md"
repository = "https://github.com/ImageOptim/gifski"
version = "0.10.1"
version = "0.10.2"
autobins = false
edition = "2018"

Expand All @@ -28,7 +28,6 @@ imagequant = "2.11.9"
imgref = "1.3.5"
lodepng = "2.1.5"
pbr = "1.0.0"
rayon = "1.0.3"
resize = "0.3.0"
rgb = "0.8.10"
wild = "2.0"
Expand Down
8 changes: 4 additions & 4 deletions gifski-api/gifski.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ gifski *gifski_new(const GifskiSettings *settings);
* You can add frames in any order, and they will be sorted by their `frame_number`.
*
* Presentation timestamp (PTS) is time in seconds, since start of the file, when this frame is to be displayed.
* For a 20fps video it could be `frame_number/20.0`.
* First frame must have PTS=0, and frames must not be more than 1 second apart.
* For a 20fps video it could be `frame_number/20.0`. First frame must have PTS=0.
* Frames with duplicate or out-of-order PTS will be skipped.
*
* Returns 0 (`GIFSKI_OK`) on success, and non-0 `GIFSKI_*` constant on error.
*/
Expand All @@ -129,8 +129,8 @@ GifskiError gifski_add_frame_png_file(gifski *handle,
* You can add frames in any order, and they will be sorted by their `frame_number`.
*
* Presentation timestamp (PTS) is time in seconds, since start of the file, when this frame is to be displayed.
* For a 20fps video it could be `frame_number/20.0`.
* First frame must have PTS=0, and frames must not be more than 1 second apart.
* For a 20fps video it could be `frame_number/20.0`. First frame must have PTS=0.
* Frames with duplicate or out-of-order PTS will be skipped.
*
* Returns 0 (`GIFSKI_OK`) on success, and non-0 `GIFSKI_*` constant on error.
*/
Expand Down
2 changes: 1 addition & 1 deletion gifski-api/src/bin/ffmpeg_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl Source for FfmpegDecoder {
}

impl FfmpegDecoder {
pub fn new(path: &Path, fps: usize) -> BinResult<Self> {
pub fn new(path: &Path, fps: f32) -> BinResult<Self> {
ffmpeg::init().chain_err(|| "Unable to initialize ffmpeg")?;
let input_context = ffmpeg::format::input(&path)
.chain_err(|| format!("Unable to open video file {}", path.display()))?;
Expand Down
6 changes: 3 additions & 3 deletions gifski-api/src/bin/gifski.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn bin_main() -> BinResult<()> {
fast: matches.is_present("fast"),
};
let quiet = matches.is_present("quiet");
let fps: usize = matches.value_of("fps").ok_or("Missing fps")?.parse().chain_err(|| "FPS must be a number")?;
let fps: f32 = matches.value_of("fps").ok_or("Missing fps")?.parse().chain_err(|| "FPS must be a number")?;

if settings.quality < 20 {
if settings.quality < 1 {
Expand Down Expand Up @@ -183,12 +183,12 @@ fn parse_opt<T: ::std::str::FromStr<Err = ::std::num::ParseIntError>>(s: Option<
}

#[cfg(feature = "video")]
fn get_video_decoder(path: &Path, fps: usize) -> BinResult<Box<dyn Source + Send>> {
fn get_video_decoder(path: &Path, fps: f32) -> BinResult<Box<dyn Source + Send>> {
Ok(Box::new(ffmpeg_source::FfmpegDecoder::new(path, fps)?))
}

#[cfg(not(feature = "video"))]
fn get_video_decoder(_: &Path, _fps: usize) -> BinResult<Box<dyn Source + Send>> {
fn get_video_decoder(_: &Path, _fps: f32) -> BinResult<Box<dyn Source + Send>> {
Err(r"Video support is permanently disabled in this executable.
To enable video decoding you need to recompile gifski from source with:
Expand Down
4 changes: 2 additions & 2 deletions gifski-api/src/bin/png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use std::path::PathBuf;

pub struct Lodecoder {
frames: Vec<PathBuf>,
fps: usize,
fps: f32,
}

impl Lodecoder {
pub fn new(frames: Vec<PathBuf>, fps: usize) -> Self {
pub fn new(frames: Vec<PathBuf>, fps: f32) -> Self {
Self { frames, fps }
}
}
Expand Down
Loading

0 comments on commit 15db51b

Please # to comment.