Merge pull request #66 from zmwangx/fix-linting-errors

Fix linting errors
This commit is contained in:
Polochon-street 2021-07-07 17:12:55 +02:00 committed by GitHub
commit 10a83ff8fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 109 additions and 108 deletions

View File

@ -11,7 +11,7 @@ jobs:
container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu
strategy:
matrix:
ffmpeg_version: ["3.4", "4.0", "4.1", "4.2", "4.3"]
ffmpeg_version: ["3.4", "4.0", "4.1", "4.2", "4.3", "4.4"]
fail-fast: false
steps:
- uses: actions/checkout@v2
@ -87,6 +87,7 @@ jobs:
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:

View File

@ -31,9 +31,9 @@ impl From<AVAudioServiceType> for AudioService {
}
}
impl Into<AVAudioServiceType> for AudioService {
fn into(self) -> AVAudioServiceType {
match self {
impl From<AudioService> for AVAudioServiceType {
fn from(value: AudioService) -> AVAudioServiceType {
match value {
AudioService::Main => AV_AUDIO_SERVICE_TYPE_MAIN,
AudioService::Effects => AV_AUDIO_SERVICE_TYPE_EFFECTS,
AudioService::VisuallyImpaired => AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED,

View File

@ -24,9 +24,9 @@ impl From<c_int> for Compliance {
}
}
impl Into<c_int> for Compliance {
fn into(self) -> c_int {
match self {
impl From<Compliance> for c_int {
fn from(value: Compliance) -> c_int {
match value {
Compliance::VeryStrict => FF_COMPLIANCE_VERY_STRICT,
Compliance::Strict => FF_COMPLIANCE_STRICT,
Compliance::Normal => FF_COMPLIANCE_NORMAL,

View File

@ -26,9 +26,9 @@ impl From<AVDiscard> for Discard {
}
}
impl Into<AVDiscard> for Discard {
fn into(self) -> AVDiscard {
match self {
impl From<Discard> for AVDiscard {
fn from(value: Discard) -> AVDiscard {
match value {
Discard::None => AVDISCARD_NONE,
Discard::Default => AVDISCARD_DEFAULT,
Discard::NonReference => AVDISCARD_NONREF,

View File

@ -46,9 +46,9 @@ impl From<c_int> for Comparison {
}
}
impl Into<c_int> for Comparison {
fn into(self) -> c_int {
match self {
impl From<Comparison> for c_int {
fn from(value: Comparison) -> c_int {
match value {
Comparison::SAD => FF_CMP_SAD,
Comparison::SSE => FF_CMP_SSE,
Comparison::SATD => FF_CMP_SATD,

View File

@ -20,9 +20,9 @@ impl From<c_int> for Decision {
}
}
impl Into<c_int> for Decision {
fn into(self) -> c_int {
match self {
impl From<Decision> for c_int {
fn from(value: Decision) -> c_int {
match value {
Decision::Simple => FF_MB_DECISION_SIMPLE,
Decision::Bits => FF_MB_DECISION_BITS,
Decision::RateDistortion => FF_MB_DECISION_RD,

View File

@ -33,9 +33,9 @@ impl From<c_int> for MotionEstimation {
}
}
impl Into<c_int> for MotionEstimation {
fn into(self) -> c_int {
match self {
impl From<MotionEstimation> for c_int {
fn from(value: MotionEstimation) -> c_int {
match value {
MotionEstimation::Zero => 1,
MotionEstimation::Full => 2,
MotionEstimation::Log => 3,

View File

@ -20,9 +20,9 @@ impl From<c_int> for Prediction {
}
}
impl Into<c_int> for Prediction {
fn into(self) -> c_int {
match self {
impl From<Prediction> for c_int {
fn from(value: Prediction) -> c_int {
match value {
Prediction::Left => FF_PRED_LEFT,
Prediction::Plane => FF_PRED_PLANE,
Prediction::Median => FF_PRED_MEDIAN,

View File

@ -24,9 +24,9 @@ impl From<AVFieldOrder> for FieldOrder {
}
}
impl Into<AVFieldOrder> for FieldOrder {
fn into(self) -> AVFieldOrder {
match self {
impl From<FieldOrder> for AVFieldOrder {
fn from(value: FieldOrder) -> AVFieldOrder {
match value {
FieldOrder::Unknown => AV_FIELD_UNKNOWN,
FieldOrder::Progressive => AV_FIELD_PROGRESSIVE,
FieldOrder::TT => AV_FIELD_TT,

View File

@ -594,7 +594,7 @@ pub enum Id {
#[cfg(feature = "ffmpeg_4_4")]
ADPCM_IMA_MOFLEX,
#[cfg(feature = "ffmpeg_4_4")]
FASTAUDIO
FASTAUDIO,
}
impl Id {
@ -1196,14 +1196,14 @@ impl From<AVCodecID> for Id {
#[cfg(feature = "ffmpeg_4_4")]
AV_CODEC_ID_ADPCM_IMA_MOFLEX => Id::ADPCM_IMA_MOFLEX,
#[cfg(feature = "ffmpeg_4_4")]
AV_CODEC_ID_FASTAUDIO => Id::FASTAUDIO
AV_CODEC_ID_FASTAUDIO => Id::FASTAUDIO,
}
}
}
impl Into<AVCodecID> for Id {
fn into(self) -> AVCodecID {
match self {
impl From<Id> for AVCodecID {
fn from(value: Id) -> AVCodecID {
match value {
Id::None => AV_CODEC_ID_NONE,
/* video codecs */
@ -1790,7 +1790,7 @@ impl Into<AVCodecID> for Id {
#[cfg(feature = "ffmpeg_4_4")]
Id::ADPCM_IMA_MOFLEX => AV_CODEC_ID_ADPCM_IMA_MOFLEX,
#[cfg(feature = "ffmpeg_4_4")]
Id::FASTAUDIO => AV_CODEC_ID_FASTAUDIO
Id::FASTAUDIO => AV_CODEC_ID_FASTAUDIO,
}
}
}

View File

@ -50,7 +50,7 @@ pub enum Type {
DOVI_CONF,
#[cfg(feature = "ffmpeg_4_4")]
S12M_TIMECODE
S12M_TIMECODE,
}
impl From<AVPacketSideDataType> for Type {
@ -99,14 +99,14 @@ impl From<AVPacketSideDataType> for Type {
AV_PKT_DATA_DOVI_CONF => Type::DOVI_CONF,
#[cfg(feature = "ffmpeg_4_4")]
AV_PKT_DATA_S12M_TIMECODE => Type::S12M_TIMECODE
AV_PKT_DATA_S12M_TIMECODE => Type::S12M_TIMECODE,
}
}
}
impl Into<AVPacketSideDataType> for Type {
fn into(self) -> AVPacketSideDataType {
match self {
impl From<Type> for AVPacketSideDataType {
fn from(value: Type) -> AVPacketSideDataType {
match value {
Type::Palette => AV_PKT_DATA_PALETTE,
Type::NewExtraData => AV_PKT_DATA_NEW_EXTRADATA,
Type::ParamChange => AV_PKT_DATA_PARAM_CHANGE,
@ -150,7 +150,7 @@ impl Into<AVPacketSideDataType> for Type {
Type::DOVI_CONF => AV_PKT_DATA_DOVI_CONF,
#[cfg(feature = "ffmpeg_4_4")]
Type::S12M_TIMECODE => AV_PKT_DATA_S12M_TIMECODE
Type::S12M_TIMECODE => AV_PKT_DATA_S12M_TIMECODE,
}
}
}

View File

@ -279,9 +279,9 @@ impl From<(Id, c_int)> for Profile {
}
}
impl Into<c_int> for Profile {
fn into(self) -> c_int {
match self {
impl From<Profile> for c_int {
fn from(value: Profile) -> c_int {
match value {
Profile::Unknown => FF_PROFILE_UNKNOWN,
Profile::Reserved => FF_PROFILE_RESERVED,

View File

@ -33,9 +33,9 @@ impl From<AVSubtitleType> for Type {
}
}
impl Into<AVSubtitleType> for Type {
fn into(self) -> AVSubtitleType {
match self {
impl From<Type> for AVSubtitleType {
fn from(value: Type) -> AVSubtitleType {
match value {
Type::None => SUBTITLE_NONE,
Type::Bitmap => SUBTITLE_BITMAP,
Type::Text => SUBTITLE_TEXT,

View File

@ -59,9 +59,9 @@ impl From<c_int> for Type {
}
}
impl Into<c_int> for Type {
fn into(self) -> c_int {
match self {
impl From<Type> for c_int {
fn from(value: Type) -> c_int {
match value {
Type::None => 0,
Type::Frame => FF_THREAD_FRAME,
Type::Slice => FF_THREAD_SLICE,

View File

@ -38,9 +38,9 @@ impl From<SwrDitherType> for Dither {
}
}
impl Into<SwrDitherType> for Dither {
fn into(self) -> SwrDitherType {
match self {
impl From<Dither> for SwrDitherType {
fn from(value: Dither) -> SwrDitherType {
match value {
Dither::None => SWR_DITHER_NONE,
Dither::Rectangular => SWR_DITHER_RECTANGULAR,
Dither::Triangular => SWR_DITHER_TRIANGULAR,

View File

@ -17,9 +17,9 @@ impl From<SwrEngine> for Engine {
}
}
impl Into<SwrEngine> for Engine {
fn into(self) -> SwrEngine {
match self {
impl From<Engine> for SwrEngine {
fn from(value: Engine) -> SwrEngine {
match value {
Engine::Software => SWR_ENGINE_SWR,
Engine::SoundExchange => SWR_ENGINE_SOXR,
}

View File

@ -18,9 +18,9 @@ impl From<SwrFilterType> for Filter {
}
}
impl Into<SwrFilterType> for Filter {
fn into(self) -> SwrFilterType {
match self {
impl From<Filter> for SwrFilterType {
fn from(value: Filter) -> SwrFilterType {
match value {
Filter::Cubic => SWR_FILTER_TYPE_CUBIC,
Filter::BlackmanNuttall => SWR_FILTER_TYPE_BLACKMAN_NUTTALL,
Filter::Kaiser => SWR_FILTER_TYPE_KAISER,

View File

@ -26,9 +26,9 @@ impl From<c_int> for ColorSpace {
}
}
impl Into<c_int> for ColorSpace {
fn into(self) -> c_int {
match self {
impl From<ColorSpace> for c_int {
fn from(value: ColorSpace) -> c_int {
match value {
ColorSpace::Default => SWS_CS_DEFAULT,
ColorSpace::ITU709 => SWS_CS_ITU709,
ColorSpace::FCC => SWS_CS_FCC,

View File

@ -27,9 +27,9 @@ impl From<AVChromaLocation> for Location {
}
}
impl Into<AVChromaLocation> for Location {
fn into(self) -> AVChromaLocation {
match self {
impl From<Location> for AVChromaLocation {
fn from(value: Location) -> AVChromaLocation {
match value {
Location::Unspecified => AVCHROMA_LOC_UNSPECIFIED,
Location::Left => AVCHROMA_LOC_LEFT,
Location::Center => AVCHROMA_LOC_CENTER,

View File

@ -70,9 +70,9 @@ impl From<AVColorPrimaries> for Primaries {
}
}
impl Into<AVColorPrimaries> for Primaries {
fn into(self) -> AVColorPrimaries {
match self {
impl From<Primaries> for AVColorPrimaries {
fn from(value: Primaries) -> AVColorPrimaries {
match value {
Primaries::Reserved0 => AVCOL_PRI_RESERVED0,
Primaries::BT709 => AVCOL_PRI_BT709,
Primaries::Unspecified => AVCOL_PRI_UNSPECIFIED,

View File

@ -35,9 +35,9 @@ impl From<AVColorRange> for Range {
}
}
impl Into<AVColorRange> for Range {
fn into(self) -> AVColorRange {
match self {
impl From<Range> for AVColorRange {
fn from(value: Range) -> AVColorRange {
match value {
Range::Unspecified => AVCOL_RANGE_UNSPECIFIED,
Range::MPEG => AVCOL_RANGE_MPEG,
Range::JPEG => AVCOL_RANGE_JPEG,

View File

@ -63,9 +63,9 @@ impl From<AVColorSpace> for Space {
}
}
impl Into<AVColorSpace> for Space {
fn into(self) -> AVColorSpace {
match self {
impl From<Space> for AVColorSpace {
fn from(value: Space) -> AVColorSpace {
match value {
Space::RGB => AVCOL_SPC_RGB,
Space::BT709 => AVCOL_SPC_BT709,
Space::Unspecified => AVCOL_SPC_UNSPECIFIED,

View File

@ -67,9 +67,9 @@ impl From<AVColorTransferCharacteristic> for TransferCharacteristic {
}
}
impl Into<AVColorTransferCharacteristic> for TransferCharacteristic {
fn into(self) -> AVColorTransferCharacteristic {
match self {
impl From<TransferCharacteristic> for AVColorTransferCharacteristic {
fn from(value: TransferCharacteristic) -> AVColorTransferCharacteristic {
match value {
TransferCharacteristic::Reserved0 => AVCOL_TRC_RESERVED0,
TransferCharacteristic::BT709 => AVCOL_TRC_BT709,
TransferCharacteristic::Unspecified => AVCOL_TRC_UNSPECIFIED,

View File

@ -100,9 +100,9 @@ impl From<c_int> for Error {
}
}
impl Into<c_int> for Error {
fn into(self) -> c_int {
match self {
impl From<Error> for c_int {
fn from(value: Error) -> c_int {
match value {
Error::BsfNotFound => AVERROR_BSF_NOT_FOUND,
Error::Bug => AVERROR_BUG,
Error::BufferTooSmall => AVERROR_BUFFER_TOO_SMALL,
@ -202,7 +202,7 @@ fn index(error: &Error) -> usize {
// XXX: the length has to be synced with the number of errors
static mut STRINGS: [[c_char; AV_ERROR_MAX_STRING_SIZE]; 27] =
[[0 as c_char; AV_ERROR_MAX_STRING_SIZE]; 27];
[[0_i8; AV_ERROR_MAX_STRING_SIZE]; 27];
pub fn register_all() {
unsafe {

View File

@ -702,10 +702,10 @@ impl From<AVPixelFormat> for Pixel {
}
}
impl Into<AVPixelFormat> for Pixel {
impl From<Pixel> for AVPixelFormat {
#[inline]
fn into(self) -> AVPixelFormat {
match self {
fn from(value: Pixel) -> AVPixelFormat {
match value {
Pixel::None => AV_PIX_FMT_NONE,
Pixel::YUV420P => AV_PIX_FMT_YUV420P,

View File

@ -101,10 +101,10 @@ impl From<&'static str> for Sample {
}
}
impl Into<AVSampleFormat> for Sample {
impl From<Sample> for AVSampleFormat {
#[inline]
fn into(self) -> AVSampleFormat {
match self {
fn from(value: Sample) -> AVSampleFormat {
match value {
Sample::None => AV_SAMPLE_FMT_NONE,
Sample::U8(Type::Packed) => AV_SAMPLE_FMT_U8,

View File

@ -47,7 +47,7 @@ pub enum Type {
#[cfg(feature = "ffmpeg_4_4")]
SEI_UNREGISTERED,
#[cfg(feature = "ffmpeg_4_4")]
FILM_GRAIN_PARAMS
FILM_GRAIN_PARAMS,
}
impl Type {
@ -100,15 +100,15 @@ impl From<AVFrameSideDataType> for Type {
#[cfg(feature = "ffmpeg_4_4")]
AV_FRAME_DATA_SEI_UNREGISTERED => Type::SEI_UNREGISTERED,
#[cfg(feature = "ffmpeg_4_4")]
AV_FRAME_DATA_FILM_GRAIN_PARAMS => Type::FILM_GRAIN_PARAMS
AV_FRAME_DATA_FILM_GRAIN_PARAMS => Type::FILM_GRAIN_PARAMS,
}
}
}
impl Into<AVFrameSideDataType> for Type {
impl From<Type> for AVFrameSideDataType {
#[inline(always)]
fn into(self) -> AVFrameSideDataType {
match self {
fn from(value: Type) -> AVFrameSideDataType {
match value {
Type::PanScan => AV_FRAME_DATA_PANSCAN,
Type::A53CC => AV_FRAME_DATA_A53_CC,
Type::Stereo3D => AV_FRAME_DATA_STEREO3D,
@ -146,7 +146,7 @@ impl Into<AVFrameSideDataType> for Type {
#[cfg(feature = "ffmpeg_4_4")]
Type::SEI_UNREGISTERED => AV_FRAME_DATA_SEI_UNREGISTERED,
#[cfg(feature = "ffmpeg_4_4")]
Type::FILM_GRAIN_PARAMS => AV_FRAME_DATA_FILM_GRAIN_PARAMS
Type::FILM_GRAIN_PARAMS => AV_FRAME_DATA_FILM_GRAIN_PARAMS,
}
}
}

View File

@ -37,9 +37,9 @@ impl TryFrom<c_int> for Level {
}
}
impl Into<c_int> for Level {
fn into(self) -> c_int {
match self {
impl From<Level> for c_int {
fn from(value: Level) -> c_int {
match value {
Level::Quiet => AV_LOG_QUIET,
Level::Panic => AV_LOG_PANIC,
Level::Fatal => AV_LOG_FATAL,

View File

@ -25,10 +25,10 @@ impl From<AVRounding> for Rounding {
}
}
impl Into<AVRounding> for Rounding {
impl From<Rounding> for AVRounding {
#[inline(always)]
fn into(self) -> AVRounding {
match self {
fn from(value: Rounding) -> AVRounding {
match value {
Rounding::Zero => AV_ROUND_ZERO,
Rounding::Infinity => AV_ROUND_INF,
Rounding::Down => AV_ROUND_DOWN,

View File

@ -26,10 +26,10 @@ impl From<AVMediaType> for Type {
}
}
impl Into<AVMediaType> for Type {
impl From<Type> for AVMediaType {
#[inline(always)]
fn into(self) -> AVMediaType {
match self {
fn from(value: Type) -> AVMediaType {
match value {
Type::Unknown => AVMEDIA_TYPE_UNKNOWN,
Type::Video => AVMEDIA_TYPE_VIDEO,
Type::Audio => AVMEDIA_TYPE_AUDIO,

View File

@ -55,9 +55,9 @@ impl From<AVOptionType> for Type {
}
}
impl Into<AVOptionType> for Type {
fn into(self) -> AVOptionType {
match self {
impl From<Type> for AVOptionType {
fn from(value: Type) -> AVOptionType {
match value {
Type::Flags => AV_OPT_TYPE_FLAGS,
Type::Int => AV_OPT_TYPE_INT,
Type::Int64 => AV_OPT_TYPE_INT64,

View File

@ -29,10 +29,10 @@ impl From<AVPictureType> for Type {
}
}
impl Into<AVPictureType> for Type {
impl From<Type> for AVPictureType {
#[inline(always)]
fn into(self) -> AVPictureType {
match self {
fn from(value: Type) -> AVPictureType {
match value {
Type::None => AV_PICTURE_TYPE_NONE,
Type::I => AV_PICTURE_TYPE_I,
Type::P => AV_PICTURE_TYPE_P,

View File

@ -67,12 +67,12 @@ impl From<AVRational> for Rational {
}
}
impl Into<AVRational> for Rational {
impl From<Rational> for AVRational {
#[inline]
fn into(self) -> AVRational {
fn from(value: Rational) -> AVRational {
AVRational {
num: self.0,
den: self.1,
num: value.0,
den: value.1,
}
}
}