Fix things from renaming and clippy

This commit is contained in:
Josh Holmer
2023-01-23 10:22:10 -05:00
parent b23133e43c
commit cff28ba207
18 changed files with 29 additions and 29 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "ffmpeg-the-third" name = "ffmpeg-the-third"
version = "5.1.1" version = "1.0.0+ffmpeg-5.1.2"
build = "build.rs" build = "build.rs"
authors = ["meh. <meh@schizofreni.co>", "Zhiming Wang <i@zhimingwang.org>"] authors = ["meh. <meh@schizofreni.co>", "Zhiming Wang <i@zhimingwang.org>"]
@ -120,9 +120,9 @@ libc = "0.2"
bitflags = "1.2" bitflags = "1.2"
[dependencies.image] [dependencies.image]
version = "0.23" version = "0.24"
optional = true optional = true
[dependencies.ffmpeg-sys-the-third] [dependencies.ffmpeg-sys-the-third]
version = "5.1.1" version = "1.0.0"
default-features = false default-features = false

View File

@ -1,4 +1,4 @@
extern crate ffmpeg_next as ffmpeg; extern crate ffmpeg_the_third as ffmpeg;
use std::env; use std::env;

View File

@ -1,4 +1,4 @@
extern crate ffmpeg_next as ffmpeg; extern crate ffmpeg_the_third as ffmpeg;
use std::env; use std::env;

View File

@ -1,4 +1,4 @@
extern crate ffmpeg_next as ffmpeg; extern crate ffmpeg_the_third as ffmpeg;
use ffmpeg::format::{input, Pixel}; use ffmpeg::format::{input, Pixel};
use ffmpeg::media::Type; use ffmpeg::media::Type;

View File

@ -1,4 +1,4 @@
extern crate ffmpeg_next as ffmpeg; extern crate ffmpeg_the_third as ffmpeg;
use std::env; use std::env;

View File

@ -1,4 +1,4 @@
extern crate ffmpeg_next as ffmpeg; extern crate ffmpeg_the_third as ffmpeg;
use std::env; use std::env;

View File

@ -1,4 +1,4 @@
extern crate ffmpeg_next as ffmpeg; extern crate ffmpeg_the_third as ffmpeg;
use std::env; use std::env;
use std::path::Path; use std::path::Path;

View File

@ -15,7 +15,7 @@
// transcode-x264 input.flv output.mp4 // transcode-x264 input.flv output.mp4
// transcode-x264 input.mkv output.mkv 'preset=veryslow,crf=18' // transcode-x264 input.mkv output.mkv 'preset=veryslow,crf=18'
extern crate ffmpeg_next as ffmpeg; extern crate ffmpeg_the_third as ffmpeg;
use std::collections::HashMap; use std::collections::HashMap;
use std::env; use std::env;

View File

@ -101,7 +101,7 @@ impl Context {
unsafe { unsafe {
(*self.as_mut_ptr()).thread_type = config.kind.into(); (*self.as_mut_ptr()).thread_type = config.kind.into();
(*self.as_mut_ptr()).thread_count = config.count as c_int; (*self.as_mut_ptr()).thread_count = config.count as c_int;
(*self.as_mut_ptr()).thread_safe_callbacks = if config.safe { 1 } else { 0 }; (*self.as_mut_ptr()).thread_safe_callbacks = i32::from(config.safe);
} }
} }

View File

@ -121,7 +121,7 @@ impl Packet {
pub fn pts(&self) -> Option<i64> { pub fn pts(&self) -> Option<i64> {
match self.0.pts { match self.0.pts {
AV_NOPTS_VALUE => None, AV_NOPTS_VALUE => None,
pts => Some(pts as i64), pts => Some(pts),
} }
} }
@ -134,7 +134,7 @@ impl Packet {
pub fn dts(&self) -> Option<i64> { pub fn dts(&self) -> Option<i64> {
match self.0.dts { match self.0.dts {
AV_NOPTS_VALUE => None, AV_NOPTS_VALUE => None,
dts => Some(dts as i64), dts => Some(dts),
} }
} }
@ -150,7 +150,7 @@ impl Packet {
#[inline] #[inline]
pub fn duration(&self) -> i64 { pub fn duration(&self) -> i64 {
self.0.duration as i64 self.0.duration
} }
#[inline] #[inline]

View File

@ -192,6 +192,6 @@ impl<'a> SideData<'a> {
} }
pub fn data(&self) -> &[u8] { pub fn data(&self) -> &[u8] {
unsafe { slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size as usize) } unsafe { slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size) }
} }
} }

View File

@ -76,7 +76,7 @@ impl Subtitle {
} }
pub fn start(&self) -> u32 { pub fn start(&self) -> u32 {
self.0.start_display_time as u32 self.0.start_display_time
} }
pub fn set_start(&mut self, value: u32) { pub fn set_start(&mut self, value: u32) {
@ -84,7 +84,7 @@ impl Subtitle {
} }
pub fn end(&self) -> u32 { pub fn end(&self) -> u32 {
self.0.end_display_time as u32 self.0.end_display_time
} }
pub fn set_end(&mut self, value: u32) { pub fn set_end(&mut self, value: u32) {

View File

@ -26,7 +26,7 @@ impl<'a> Chapter<'a> {
} }
pub fn id(&self) -> i64 { pub fn id(&self) -> i64 {
unsafe { (*self.as_ptr()).id as i64 } unsafe { (*self.as_ptr()).id }
} }
pub fn time_base(&self) -> Rational { pub fn time_base(&self) -> Rational {

View File

@ -5,7 +5,7 @@
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
pub extern crate ffmpeg_sys_next as sys; pub extern crate ffmpeg_sys_the_third as sys;
#[cfg(feature = "image")] #[cfg(feature = "image")]
extern crate image; extern crate image;
extern crate libc; extern crate libc;

View File

@ -69,7 +69,7 @@ impl Audio {
#[inline] #[inline]
pub fn set_channel_layout(&mut self, value: ChannelLayout) { pub fn set_channel_layout(&mut self, value: ChannelLayout) {
unsafe { unsafe {
(*self.as_mut_ptr()).channel_layout = value.bits() as u64; (*self.as_mut_ptr()).channel_layout = value.bits();
} }
} }
@ -140,7 +140,7 @@ impl Audio {
panic!("out of bounds"); panic!("out of bounds");
} }
if !<T as Sample>::is_valid(self.format(), self.channels() as u16) { if !<T as Sample>::is_valid(self.format(), self.channels()) {
panic!("unsupported type"); panic!("unsupported type");
} }
@ -153,7 +153,7 @@ impl Audio {
panic!("out of bounds"); panic!("out of bounds");
} }
if !<T as Sample>::is_valid(self.format(), self.channels() as u16) { if !<T as Sample>::is_valid(self.format(), self.channels()) {
panic!("unsupported type"); panic!("unsupported type");
} }

View File

@ -79,8 +79,8 @@ impl Frame {
pub fn packet(&self) -> Packet { pub fn packet(&self) -> Packet {
unsafe { unsafe {
Packet { Packet {
duration: (*self.as_ptr()).pkt_duration as i64, duration: (*self.as_ptr()).pkt_duration,
position: (*self.as_ptr()).pkt_pos as i64, position: (*self.as_ptr()).pkt_pos,
size: (*self.as_ptr()).pkt_size as usize, size: (*self.as_ptr()).pkt_size as usize,
#[cfg(not(feature = "ffmpeg_5_0"))] #[cfg(not(feature = "ffmpeg_5_0"))]
@ -95,7 +95,7 @@ impl Frame {
unsafe { unsafe {
match (*self.as_ptr()).pts { match (*self.as_ptr()).pts {
AV_NOPTS_VALUE => None, AV_NOPTS_VALUE => None,
pts => Some(pts as i64), pts => Some(pts),
} }
} }
} }
@ -112,7 +112,7 @@ impl Frame {
unsafe { unsafe {
match (*self.as_ptr()).best_effort_timestamp { match (*self.as_ptr()).best_effort_timestamp {
AV_NOPTS_VALUE => None, AV_NOPTS_VALUE => None,
t => Some(t as i64), t => Some(t),
} }
} }
} }

View File

@ -216,7 +216,7 @@ impl<'a> SideData<'a> {
#[inline] #[inline]
pub fn data(&self) -> &[u8] { pub fn data(&self) -> &[u8] {
unsafe { slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size as usize) } unsafe { slice::from_raw_parts((*self.as_ptr()).data, (*self.as_ptr()).size) }
} }
#[inline] #[inline]

View File

@ -3,12 +3,12 @@ use Error;
#[inline(always)] #[inline(always)]
pub fn current() -> i64 { pub fn current() -> i64 {
unsafe { av_gettime() as i64 } unsafe { av_gettime() }
} }
#[inline(always)] #[inline(always)]
pub fn relative() -> i64 { pub fn relative() -> i64 {
unsafe { av_gettime_relative() as i64 } unsafe { av_gettime_relative() }
} }
#[inline(always)] #[inline(always)]