Migrate crates to Rust edition 2021 (#24)
* Migrate ffmpeg-sys to Edition 2021 * Migrate ffmpeg to Edition 2021 * Remove now-redundant imports * Reorder imports after edition migration
This commit is contained in:
parent
f601a4bb69
commit
7a8643f2cc
@ -2,6 +2,7 @@
|
|||||||
name = "ffmpeg-the-third"
|
name = "ffmpeg-the-third"
|
||||||
version = "1.3.0+ffmpeg-6.1"
|
version = "1.3.0+ffmpeg-6.1"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
authors = ["meh. <meh@schizofreni.co>", "Zhiming Wang <i@zhimingwang.org>"]
|
authors = ["meh. <meh@schizofreni.co>", "Zhiming Wang <i@zhimingwang.org>"]
|
||||||
license = "WTFPL"
|
license = "WTFPL"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
extern crate ffmpeg_the_third as ffmpeg;
|
extern crate ffmpeg_the_third as ffmpeg;
|
||||||
|
|
||||||
use ffmpeg::format::{input, Pixel};
|
use crate::ffmpeg::format::{input, Pixel};
|
||||||
use ffmpeg::media::Type;
|
use crate::ffmpeg::media::Type;
|
||||||
use ffmpeg::software::scaling::{context::Context, flag::Flags};
|
use crate::ffmpeg::software::scaling::{context::Context, flag::Flags};
|
||||||
use ffmpeg::util::frame::video::Video;
|
use crate::ffmpeg::util::frame::video::Video;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
|
@ -2,7 +2,7 @@ extern crate ffmpeg_the_third as ffmpeg;
|
|||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
use ffmpeg::{codec, encoder, format, log, media, Rational};
|
use crate::ffmpeg::{codec, encoder, format, log, media, Rational};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let input_file = env::args().nth(1).expect("missing input file");
|
let input_file = env::args().nth(1).expect("missing input file");
|
||||||
|
@ -3,8 +3,8 @@ extern crate ffmpeg_the_third as ffmpeg;
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use ffmpeg::{codec, filter, format, frame, media};
|
use crate::ffmpeg::{codec, filter, format, frame, media};
|
||||||
use ffmpeg::{rescale, Rescale};
|
use crate::ffmpeg::{rescale, Rescale};
|
||||||
|
|
||||||
fn filter(
|
fn filter(
|
||||||
spec: &str,
|
spec: &str,
|
||||||
|
@ -21,7 +21,7 @@ use std::collections::HashMap;
|
|||||||
use std::env;
|
use std::env;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|
||||||
use ffmpeg::{
|
use crate::ffmpeg::{
|
||||||
codec, decoder, encoder, format, frame, log, media, picture, Dictionary, Packet, Rational,
|
codec, decoder, encoder, format, frame, log, media, picture, Dictionary, Packet, Rational,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ name = "ffmpeg-sys-the-third"
|
|||||||
version = "1.2.0+ffmpeg-6.1"
|
version = "1.2.0+ffmpeg-6.1"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
links = "ffmpeg"
|
links = "ffmpeg"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
authors = [
|
authors = [
|
||||||
"meh. <meh@schizofreni.co>",
|
"meh. <meh@schizofreni.co>",
|
||||||
|
@ -115,7 +115,7 @@ impl ParseCallbacks for Callbacks {
|
|||||||
|
|
||||||
// https://github.com/rust-lang/rust-bindgen/issues/687#issuecomment-388277405
|
// https://github.com/rust-lang/rust-bindgen/issues/687#issuecomment-388277405
|
||||||
fn will_parse_macro(&self, name: &str) -> MacroParsingBehavior {
|
fn will_parse_macro(&self, name: &str) -> MacroParsingBehavior {
|
||||||
use MacroParsingBehavior::*;
|
use crate::MacroParsingBehavior::*;
|
||||||
|
|
||||||
match name {
|
match name {
|
||||||
"FP_INFINITE" => Ignore,
|
"FP_INFINITE" => Ignore,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use AVPixelFormat;
|
use crate::AVPixelFormat;
|
||||||
use AVPixelFormat::*;
|
use crate::AVPixelFormat::*;
|
||||||
|
|
||||||
#[cfg(target_endian = "little")]
|
#[cfg(target_endian = "little")]
|
||||||
pub const AV_PIX_FMT_RGB32: AVPixelFormat = AV_PIX_FMT_BGRA;
|
pub const AV_PIX_FMT_RGB32: AVPixelFormat = AV_PIX_FMT_BGRA;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use libc::{c_double, c_int};
|
use libc::{c_double, c_int};
|
||||||
use AVRational;
|
use crate::AVRational;
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub unsafe fn av_make_q(num: c_int, den: c_int) -> AVRational {
|
pub unsafe fn av_make_q(num: c_int, den: c_int) -> AVRational {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use {AVRational, AV_TIME_BASE};
|
use crate::{AVRational, AV_TIME_BASE};
|
||||||
|
|
||||||
pub const AV_NOPTS_VALUE: i64 = 0x8000000000000000u64 as i64;
|
pub const AV_NOPTS_VALUE: i64 = 0x8000000000000000u64 as i64;
|
||||||
pub const AV_TIME_BASE_Q: AVRational = AVRational {
|
pub const AV_TIME_BASE_Q: AVRational = AVRational {
|
||||||
|
@ -13,4 +13,4 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
|||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod avutil;
|
mod avutil;
|
||||||
pub use avutil::*;
|
pub use crate::avutil::*;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use super::codec::Codec;
|
use super::codec::Codec;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {format, ChannelLayout};
|
use crate::{format, ChannelLayout};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||||
pub struct Audio {
|
pub struct Audio {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use ffi::AVAudioServiceType::*;
|
use crate::ffi::AVAudioServiceType::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_uint;
|
use libc::c_uint;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -2,8 +2,8 @@ use std::ffi::CStr;
|
|||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use super::{Audio, Capabilities, Id, Profile, Video};
|
use super::{Audio, Capabilities, Id, Profile, Video};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {media, Error};
|
use crate::{media, Error};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||||
pub struct Codec {
|
pub struct Codec {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -5,10 +5,10 @@ use std::rc::Rc;
|
|||||||
use super::decoder::Decoder;
|
use super::decoder::Decoder;
|
||||||
use super::encoder::Encoder;
|
use super::encoder::Encoder;
|
||||||
use super::{threading, Compliance, Debug, Flags, Id, Parameters};
|
use super::{threading, Compliance, Debug, Flags, Id, Parameters};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::media;
|
||||||
|
use crate::{Codec, Error};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use media;
|
|
||||||
use {Codec, Error};
|
|
||||||
|
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
ptr: *mut AVCodecContext,
|
ptr: *mut AVCodecContext,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
use super::Opened;
|
use super::Opened;
|
||||||
use codec::Context;
|
use crate::codec::Context;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use frame;
|
use crate::frame;
|
||||||
use util::format;
|
use crate::util::format;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use {packet, Error};
|
use crate::{packet, Error};
|
||||||
use {AudioService, ChannelLayout};
|
use crate::{AudioService, ChannelLayout};
|
||||||
|
|
||||||
pub struct Audio(pub Opened);
|
pub struct Audio(pub Opened);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -2,9 +2,9 @@ use std::ops::{Deref, DerefMut};
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::{Audio, Check, Conceal, Opened, Subtitle, Video};
|
use super::{Audio, Check, Conceal, Opened, Subtitle, Video};
|
||||||
use codec::{traits, Context};
|
use crate::codec::{traits, Context};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {Dictionary, Discard, Error, Rational};
|
use crate::{Dictionary, Discard, Error, Rational};
|
||||||
|
|
||||||
pub struct Decoder(pub Context);
|
pub struct Decoder(pub Context);
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ pub use self::opened::Opened;
|
|||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
|
||||||
use codec::Context;
|
use crate::codec::Context;
|
||||||
use codec::Id;
|
use crate::codec::Id;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use Codec;
|
use crate::Codec;
|
||||||
|
|
||||||
pub fn new() -> Decoder {
|
pub fn new() -> Decoder {
|
||||||
Context::new().decoder()
|
Context::new().decoder()
|
||||||
|
@ -2,9 +2,9 @@ use std::ops::{Deref, DerefMut};
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::{Audio, Decoder, Subtitle, Video};
|
use super::{Audio, Decoder, Subtitle, Video};
|
||||||
use codec::{Context, Profile};
|
use crate::codec::{Context, Profile};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {media, packet, Error, Frame, Rational};
|
use crate::{media, packet, Error, Frame, Rational};
|
||||||
|
|
||||||
pub struct Opened(pub Decoder);
|
pub struct Opened(pub Decoder);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
use super::Opened;
|
use super::Opened;
|
||||||
use codec::Context;
|
use crate::codec::Context;
|
||||||
use {packet, Error};
|
use crate::{packet, Error};
|
||||||
|
|
||||||
pub struct Subtitle(pub Opened);
|
pub struct Subtitle(pub Opened);
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ impl Subtitle {
|
|||||||
pub fn decode<P: packet::Ref>(
|
pub fn decode<P: packet::Ref>(
|
||||||
&mut self,
|
&mut self,
|
||||||
packet: &P,
|
packet: &P,
|
||||||
out: &mut ::Subtitle,
|
out: &mut crate::Subtitle,
|
||||||
) -> Result<bool, Error> {
|
) -> Result<bool, Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut got: c_int = 0;
|
let mut got: c_int = 0;
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
use super::{slice, Opened};
|
use super::{slice, Opened};
|
||||||
use codec::Context;
|
use crate::codec::Context;
|
||||||
use color;
|
use crate::color;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use frame;
|
use crate::frame;
|
||||||
use util::chroma;
|
use crate::util::chroma;
|
||||||
use util::format;
|
use crate::util::format;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use {packet, Error};
|
use crate::{packet, Error};
|
||||||
use {FieldOrder, Rational};
|
use crate::{FieldOrder, Rational};
|
||||||
|
|
||||||
pub struct Video(pub Opened);
|
pub struct Video(pub Opened);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use ffi::AVDiscard::*;
|
use crate::ffi::AVDiscard::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
use super::Encoder as Super;
|
use super::Encoder as Super;
|
||||||
use codec::{traits, Context};
|
use crate::codec::{traits, Context};
|
||||||
use util::format;
|
use crate::util::format;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use {frame, packet};
|
use crate::{frame, packet};
|
||||||
use {ChannelLayout, Dictionary, Error};
|
use crate::{ChannelLayout, Dictionary, Error};
|
||||||
|
|
||||||
pub struct Audio(pub Super);
|
pub struct Audio(pub Super);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
use super::{audio, subtitle, video};
|
use super::{audio, subtitle, video};
|
||||||
use codec::Context;
|
use crate::codec::Context;
|
||||||
use {media, packet, Error, Frame, Rational};
|
use crate::{media, packet, Error, Frame, Rational};
|
||||||
|
|
||||||
pub struct Encoder(pub Context);
|
pub struct Encoder(pub Context);
|
||||||
|
|
||||||
|
@ -26,10 +26,10 @@ pub use self::decision::Decision;
|
|||||||
|
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
|
||||||
use codec::Context;
|
use crate::codec::Context;
|
||||||
use codec::Id;
|
use crate::codec::Id;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use Codec;
|
use crate::Codec;
|
||||||
|
|
||||||
pub fn new() -> Encoder {
|
pub fn new() -> Encoder {
|
||||||
Context::new().encoder()
|
Context::new().encoder()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
use super::Encoder as Super;
|
use super::Encoder as Super;
|
||||||
use codec::{traits, Context};
|
use crate::codec::{traits, Context};
|
||||||
use {Dictionary, Error};
|
use crate::{Dictionary, Error};
|
||||||
|
|
||||||
pub struct Subtitle(pub Super);
|
pub struct Subtitle(pub Super);
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ impl AsMut<Context> for Subtitle {
|
|||||||
pub struct Encoder(pub Subtitle);
|
pub struct Encoder(pub Subtitle);
|
||||||
|
|
||||||
impl Encoder {
|
impl Encoder {
|
||||||
pub fn encode(&mut self, subtitle: &::Subtitle, out: &mut [u8]) -> Result<bool, Error> {
|
pub fn encode(&mut self, subtitle: &crate::Subtitle, out: &mut [u8]) -> Result<bool, Error> {
|
||||||
unsafe {
|
unsafe {
|
||||||
match avcodec_encode_subtitle(
|
match avcodec_encode_subtitle(
|
||||||
self.0.as_mut_ptr(),
|
self.0.as_mut_ptr(),
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::{c_float, c_int};
|
use libc::{c_float, c_int};
|
||||||
|
|
||||||
use super::Encoder as Super;
|
use super::Encoder as Super;
|
||||||
use super::{Comparison, Decision};
|
use super::{Comparison, Decision};
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use super::{MotionEstimation, Prediction};
|
use super::{MotionEstimation, Prediction};
|
||||||
use codec::{traits, Context};
|
use crate::codec::{traits, Context};
|
||||||
use {color, format, Dictionary, Error, Rational};
|
use crate::{color, format, Dictionary, Error, Rational};
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use {frame, packet};
|
use crate::{frame, packet};
|
||||||
|
|
||||||
pub struct Video(pub Super);
|
pub struct Video(pub Super);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use ffi::AVFieldOrder::*;
|
use crate::ffi::AVFieldOrder::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_uint;
|
use libc::c_uint;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::AVCodecID::*;
|
use crate::ffi::AVCodecID::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::util::media;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use util::media;
|
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
|
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
|
||||||
|
@ -51,7 +51,7 @@ pub mod traits;
|
|||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub fn version() -> u32 {
|
pub fn version() -> u32 {
|
||||||
unsafe { avcodec_version() }
|
unsafe { avcodec_version() }
|
||||||
|
@ -2,7 +2,7 @@ use std::mem;
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::Ref;
|
use super::Ref;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
pub struct Borrow<'a> {
|
pub struct Borrow<'a> {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -3,9 +3,9 @@ use std::mem;
|
|||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use super::{Borrow, Flags, Mut, Ref, SideData};
|
use super::{Borrow, Flags, Mut, Ref, SideData};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::{format, Error, Rational};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use {format, Error, Rational};
|
|
||||||
|
|
||||||
pub struct Packet(AVPacket);
|
pub struct Packet(AVPacket);
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@ use std::marker::PhantomData;
|
|||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use super::Packet;
|
use super::Packet;
|
||||||
use ffi::AVPacketSideDataType::*;
|
use crate::ffi::AVPacketSideDataType::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub trait Ref {
|
pub trait Ref {
|
||||||
fn as_ptr(&self) -> *const AVPacket;
|
fn as_ptr(&self) -> *const AVPacket;
|
||||||
|
@ -2,8 +2,8 @@ use std::any::Any;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use super::{Context, Id};
|
use super::{Context, Id};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use media;
|
use crate::media;
|
||||||
|
|
||||||
pub struct Parameters {
|
pub struct Parameters {
|
||||||
ptr: *mut AVCodecParameters,
|
ptr: *mut AVCodecParameters,
|
||||||
|
@ -2,10 +2,10 @@ use std::marker::PhantomData;
|
|||||||
use std::mem;
|
use std::mem;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use format;
|
use crate::format;
|
||||||
|
use crate::Error;
|
||||||
use libc::{c_int, size_t};
|
use libc::{c_int, size_t};
|
||||||
use Error;
|
|
||||||
|
|
||||||
pub struct Picture<'a> {
|
pub struct Picture<'a> {
|
||||||
ptr: *mut AVPicture,
|
ptr: *mut AVPicture,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::Id;
|
use super::Id;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -10,8 +10,8 @@ pub use self::rect_mut::{AssMut, BitmapMut, RectMut, TextMut};
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use ffi::AVSubtitleType::*;
|
use crate::ffi::AVSubtitleType::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::{c_uint, size_t};
|
use libc::{c_uint, size_t};
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -3,9 +3,9 @@ use std::marker::PhantomData;
|
|||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use super::{Flags, Type};
|
use super::{Flags, Type};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use {format, Picture};
|
use crate::{format, Picture};
|
||||||
|
|
||||||
pub enum Rect<'a> {
|
pub enum Rect<'a> {
|
||||||
None(*const AVSubtitleRect),
|
None(*const AVSubtitleRect),
|
||||||
|
@ -2,7 +2,7 @@ use std::ffi::CString;
|
|||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use super::{Ass, Bitmap, Flags, Text, Type};
|
use super::{Ass, Bitmap, Flags, Text, Type};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
pub enum RectMut<'a> {
|
pub enum RectMut<'a> {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{decoder, encoder};
|
use super::{decoder, encoder};
|
||||||
use codec::{Audio, Id, Video};
|
use crate::codec::{Audio, Id, Video};
|
||||||
use Codec;
|
use crate::Codec;
|
||||||
|
|
||||||
pub trait Decoder {
|
pub trait Decoder {
|
||||||
fn decoder(self) -> Option<Codec>;
|
fn decoder(self) -> Option<Codec>;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use super::codec::Codec;
|
use super::codec::Codec;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {format, Rational};
|
use crate::{format, Rational};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||||
pub struct Video {
|
pub struct Video {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use device;
|
use crate::device;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use format::context::common::Context;
|
use crate::format::context::common::Context;
|
||||||
|
use crate::Error;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use Error;
|
|
||||||
|
|
||||||
impl Context {
|
impl Context {
|
||||||
pub fn devices(&self) -> Result<DeviceIter, Error> {
|
pub fn devices(&self) -> Result<DeviceIter, Error> {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use format;
|
use crate::format;
|
||||||
use Format;
|
use crate::Format;
|
||||||
|
|
||||||
pub struct AudioIter(*mut AVInputFormat);
|
pub struct AudioIter(*mut AVInputFormat);
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use std::ffi::CStr;
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub struct Info<'a> {
|
pub struct Info<'a> {
|
||||||
ptr: *mut AVDeviceInfo,
|
ptr: *mut AVDeviceInfo,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use format;
|
use crate::format;
|
||||||
use Format;
|
use crate::Format;
|
||||||
|
|
||||||
pub struct AudioIter(*mut AVOutputFormat);
|
pub struct AudioIter(*mut AVOutputFormat);
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use super::{Sink, Source};
|
use super::{Sink, Source};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::{format, option, ChannelLayout};
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
use {format, option, ChannelLayout};
|
|
||||||
|
|
||||||
pub struct Context<'a> {
|
pub struct Context<'a> {
|
||||||
ptr: *mut AVFilterContext,
|
ptr: *mut AVFilterContext,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::Context;
|
use super::Context;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::{Error, Frame};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use {Error, Frame};
|
|
||||||
|
|
||||||
pub struct Sink<'a> {
|
pub struct Sink<'a> {
|
||||||
ctx: &'a mut Context<'a>,
|
ctx: &'a mut Context<'a>,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::Context;
|
use super::Context;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {Error, Frame};
|
use crate::{Error, Frame};
|
||||||
|
|
||||||
pub struct Source<'a> {
|
pub struct Source<'a> {
|
||||||
ctx: &'a mut Context<'a>,
|
ctx: &'a mut Context<'a>,
|
||||||
|
@ -3,7 +3,7 @@ use std::marker::PhantomData;
|
|||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use super::{Flags, Pad};
|
use super::{Flags, Pad};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
ptr: *mut AVFilter,
|
ptr: *mut AVFilter,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -3,9 +3,9 @@ use std::ptr;
|
|||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use super::{Context, Filter};
|
use super::{Context, Filter};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::Error;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use Error;
|
|
||||||
|
|
||||||
pub struct Graph {
|
pub struct Graph {
|
||||||
ptr: *mut AVFilterGraph,
|
ptr: *mut AVFilterGraph,
|
||||||
|
@ -16,9 +16,9 @@ pub use self::graph::Graph;
|
|||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use Error;
|
use crate::Error;
|
||||||
|
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
pub fn register_all() {
|
pub fn register_all() {
|
||||||
|
@ -2,8 +2,8 @@ use std::ffi::CStr;
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use media;
|
use crate::media;
|
||||||
|
|
||||||
pub struct Pad<'a> {
|
pub struct Pad<'a> {
|
||||||
ptr: *const AVFilterPad,
|
ptr: *const AVFilterPad,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {DictionaryRef, Rational};
|
use crate::{DictionaryRef, Rational};
|
||||||
|
|
||||||
use format::context::common::Context;
|
use crate::format::context::common::Context;
|
||||||
|
|
||||||
// WARNING: index refers to the offset in the chapters array (starting from 0)
|
// WARNING: index refers to the offset in the chapters array (starting from 0)
|
||||||
// it is not necessarly equal to the id (which may start at 1)
|
// it is not necessarly equal to the id (which may start at 1)
|
||||||
|
@ -2,9 +2,9 @@ use std::mem;
|
|||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use super::Chapter;
|
use super::Chapter;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use format::context::common::Context;
|
use crate::format::context::common::Context;
|
||||||
use {Dictionary, DictionaryMut, Rational};
|
use crate::{Dictionary, DictionaryMut, Rational};
|
||||||
|
|
||||||
// WARNING: index refers to the offset in the chapters array (starting from 0)
|
// WARNING: index refers to the offset in the chapters array (starting from 0)
|
||||||
// it is not necessarly equal to the id (which may start at 1)
|
// it is not necessarly equal to the id (which may start at 1)
|
||||||
|
@ -4,9 +4,9 @@ use std::ptr;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use super::destructor::{self, Destructor};
|
use super::destructor::{self, Destructor};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::{media, Chapter, ChapterMut, DictionaryRef, Stream, StreamMut};
|
||||||
use libc::{c_int, c_uint};
|
use libc::{c_int, c_uint};
|
||||||
use {media, Chapter, ChapterMut, DictionaryRef, Stream, StreamMut};
|
|
||||||
|
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
ptr: *mut AVFormatContext,
|
ptr: *mut AVFormatContext,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@ use std::ops::{Deref, DerefMut};
|
|||||||
|
|
||||||
use super::common::Context;
|
use super::common::Context;
|
||||||
use super::destructor;
|
use super::destructor;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use util::range::Range;
|
use crate::util::range::Range;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use Codec;
|
use crate::Codec;
|
||||||
use {format, Error, Packet, Stream};
|
use crate::{format, Error, Packet, Stream};
|
||||||
|
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
ptr: *mut AVFormatContext,
|
ptr: *mut AVFormatContext,
|
||||||
|
@ -5,9 +5,9 @@ use std::ptr;
|
|||||||
|
|
||||||
use super::common::Context;
|
use super::common::Context;
|
||||||
use super::destructor;
|
use super::destructor;
|
||||||
use codec::traits;
|
use crate::codec::traits;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {format, ChapterMut, Dictionary, Error, Rational, StreamMut};
|
use crate::{format, ChapterMut, Dictionary, Error, Rational, StreamMut};
|
||||||
|
|
||||||
pub struct Output {
|
pub struct Output {
|
||||||
ptr: *mut AVFormatContext,
|
ptr: *mut AVFormatContext,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
ptr: *mut AVInputFormat,
|
ptr: *mut AVInputFormat,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::{Format, Input, Output};
|
use super::{Format, Input, Output};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub struct Iter {
|
pub struct Iter {
|
||||||
input: *mut AVInputFormat,
|
input: *mut AVInputFormat,
|
||||||
|
@ -5,8 +5,8 @@ use std::ptr;
|
|||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use super::Flags;
|
use super::Flags;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {codec, media};
|
use crate::{codec, media};
|
||||||
|
|
||||||
pub struct Output {
|
pub struct Output {
|
||||||
ptr: *mut AVOutputFormat,
|
ptr: *mut AVOutputFormat,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
pub use util::format::{pixel, Pixel};
|
pub use crate::util::format::{pixel, Pixel};
|
||||||
pub use util::format::{sample, Sample};
|
pub use crate::util::format::{sample, Sample};
|
||||||
use util::interrupt;
|
use crate::util::interrupt;
|
||||||
|
|
||||||
pub mod stream;
|
pub mod stream;
|
||||||
|
|
||||||
@ -22,8 +22,8 @@ use std::path::Path;
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use {Dictionary, Error, Format};
|
use crate::{Dictionary, Error, Format};
|
||||||
|
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
pub fn register_all() {
|
pub fn register_all() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub fn init() {
|
pub fn init() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use super::Disposition;
|
use super::Disposition;
|
||||||
use codec::{self, packet};
|
use crate::codec::{self, packet};
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use format::context::common::Context;
|
use crate::format::context::common::Context;
|
||||||
|
use crate::{DictionaryRef, Discard, Rational};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use {DictionaryRef, Discard, Rational};
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Stream<'a> {
|
pub struct Stream<'a> {
|
||||||
|
@ -2,9 +2,9 @@ use std::mem;
|
|||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use super::Stream;
|
use super::Stream;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use format::context::common::Context;
|
use crate::format::context::common::Context;
|
||||||
use {codec, Dictionary, Rational};
|
use crate::{codec, Dictionary, Rational};
|
||||||
|
|
||||||
pub struct StreamMut<'a> {
|
pub struct StreamMut<'a> {
|
||||||
context: &'a mut Context,
|
context: &'a mut Context,
|
||||||
|
60
src/lib.rs
60
src/lib.rs
@ -14,56 +14,56 @@ extern crate libc;
|
|||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
|
||||||
pub use sys as ffi;
|
pub use crate::sys as ffi;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub use util::channel_layout::{self, ChannelLayout};
|
pub use crate::util::channel_layout::{self, ChannelLayout};
|
||||||
pub use util::chroma;
|
pub use crate::util::chroma;
|
||||||
pub use util::color;
|
pub use crate::util::color;
|
||||||
pub use util::dictionary;
|
pub use crate::util::dictionary;
|
||||||
pub use util::dictionary::Mut as DictionaryMut;
|
pub use crate::util::dictionary::Mut as DictionaryMut;
|
||||||
pub use util::dictionary::Owned as Dictionary;
|
pub use crate::util::dictionary::Owned as Dictionary;
|
||||||
pub use util::dictionary::Ref as DictionaryRef;
|
pub use crate::util::dictionary::Ref as DictionaryRef;
|
||||||
pub use util::error::{self, Error};
|
pub use crate::util::error::{self, Error};
|
||||||
pub use util::frame::{self, Frame};
|
pub use crate::util::frame::{self, Frame};
|
||||||
pub use util::log;
|
pub use crate::util::log;
|
||||||
pub use util::mathematics::{self, rescale, Rescale, Rounding};
|
pub use crate::util::mathematics::{self, rescale, Rescale, Rounding};
|
||||||
pub use util::media;
|
pub use crate::util::media;
|
||||||
pub use util::option;
|
pub use crate::util::option;
|
||||||
pub use util::picture;
|
pub use crate::util::picture;
|
||||||
pub use util::rational::{self, Rational};
|
pub use crate::util::rational::{self, Rational};
|
||||||
pub use util::time;
|
pub use crate::util::time;
|
||||||
|
|
||||||
#[cfg(feature = "format")]
|
#[cfg(feature = "format")]
|
||||||
pub mod format;
|
pub mod format;
|
||||||
#[cfg(feature = "format")]
|
#[cfg(feature = "format")]
|
||||||
pub use format::chapter::{Chapter, ChapterMut};
|
pub use crate::format::chapter::{Chapter, ChapterMut};
|
||||||
#[cfg(feature = "format")]
|
#[cfg(feature = "format")]
|
||||||
pub use format::format::Format;
|
pub use crate::format::format::Format;
|
||||||
#[cfg(feature = "format")]
|
#[cfg(feature = "format")]
|
||||||
pub use format::stream::{Stream, StreamMut};
|
pub use crate::format::stream::{Stream, StreamMut};
|
||||||
|
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub mod codec;
|
pub mod codec;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::audio_service::AudioService;
|
pub use crate::codec::audio_service::AudioService;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::codec::Codec;
|
pub use crate::codec::codec::Codec;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::discard::Discard;
|
pub use crate::codec::discard::Discard;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::field_order::FieldOrder;
|
pub use crate::codec::field_order::FieldOrder;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::packet::{self, Packet};
|
pub use crate::codec::packet::{self, Packet};
|
||||||
#[cfg(all(feature = "codec", not(feature = "ffmpeg_5_0")))]
|
#[cfg(all(feature = "codec", not(feature = "ffmpeg_5_0")))]
|
||||||
pub use codec::picture::Picture;
|
pub use crate::codec::picture::Picture;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::subtitle::{self, Subtitle};
|
pub use crate::codec::subtitle::{self, Subtitle};
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::threading;
|
pub use crate::codec::threading;
|
||||||
#[cfg(feature = "codec")]
|
#[cfg(feature = "codec")]
|
||||||
pub use codec::{decoder, encoder};
|
pub use crate::codec::{decoder, encoder};
|
||||||
|
|
||||||
#[cfg(feature = "device")]
|
#[cfg(feature = "device")]
|
||||||
pub mod device;
|
pub mod device;
|
||||||
@ -71,7 +71,7 @@ pub mod device;
|
|||||||
#[cfg(feature = "filter")]
|
#[cfg(feature = "filter")]
|
||||||
pub mod filter;
|
pub mod filter;
|
||||||
#[cfg(feature = "filter")]
|
#[cfg(feature = "filter")]
|
||||||
pub use filter::Filter;
|
pub use crate::filter::Filter;
|
||||||
|
|
||||||
pub mod software;
|
pub mod software;
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@ pub mod scaling;
|
|||||||
#[cfg(feature = "software-scaling")]
|
#[cfg(feature = "software-scaling")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn scaler(
|
pub fn scaler(
|
||||||
format: ::format::Pixel,
|
format: crate::format::Pixel,
|
||||||
flags: scaling::Flags,
|
flags: scaling::Flags,
|
||||||
(in_width, in_height): (u32, u32),
|
(in_width, in_height): (u32, u32),
|
||||||
(out_width, out_height): (u32, u32),
|
(out_width, out_height): (u32, u32),
|
||||||
) -> Result<scaling::Context, ::Error> {
|
) -> Result<scaling::Context, crate::Error> {
|
||||||
scaling::Context::get(
|
scaling::Context::get(
|
||||||
format, in_width, in_height, format, out_width, out_height, flags,
|
format, in_width, in_height, format, out_width, out_height, flags,
|
||||||
)
|
)
|
||||||
@ -18,9 +18,9 @@ pub fn scaler(
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn converter(
|
pub fn converter(
|
||||||
(width, height): (u32, u32),
|
(width, height): (u32, u32),
|
||||||
input: ::format::Pixel,
|
input: crate::format::Pixel,
|
||||||
output: ::format::Pixel,
|
output: crate::format::Pixel,
|
||||||
) -> Result<scaling::Context, ::Error> {
|
) -> Result<scaling::Context, crate::Error> {
|
||||||
scaling::Context::get(
|
scaling::Context::get(
|
||||||
input,
|
input,
|
||||||
width,
|
width,
|
||||||
@ -38,9 +38,9 @@ pub mod resampling;
|
|||||||
#[cfg(feature = "software-resampling")]
|
#[cfg(feature = "software-resampling")]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn resampler(
|
pub fn resampler(
|
||||||
(in_format, in_layout, in_rate): (::format::Sample, ::ChannelLayout, u32),
|
(in_format, in_layout, in_rate): (crate::format::Sample, crate::ChannelLayout, u32),
|
||||||
(out_format, out_layout, out_rate): (::format::Sample, ::ChannelLayout, u32),
|
(out_format, out_layout, out_rate): (crate::format::Sample, crate::ChannelLayout, u32),
|
||||||
) -> Result<resampling::Context, ::Error> {
|
) -> Result<resampling::Context, crate::Error> {
|
||||||
resampling::Context::get(
|
resampling::Context::get(
|
||||||
in_format, in_layout, in_rate, out_format, out_layout, out_rate,
|
in_format, in_layout, in_rate, out_format, out_layout, out_rate,
|
||||||
)
|
)
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::Delay;
|
use super::Delay;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::util::format;
|
||||||
|
use crate::Dictionary;
|
||||||
|
use crate::{frame, ChannelLayout, Error};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::ffi::c_void;
|
use std::ffi::c_void;
|
||||||
use util::format;
|
|
||||||
use Dictionary;
|
|
||||||
use {frame, ChannelLayout, Error};
|
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Copy, Clone)]
|
#[derive(Eq, PartialEq, Copy, Clone)]
|
||||||
pub struct Definition {
|
pub struct Definition {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::Context;
|
use super::Context;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
|
||||||
pub struct Delay {
|
pub struct Delay {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use ffi::SwrDitherType::*;
|
use crate::ffi::SwrDitherType::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::sys::SwrEngine::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sys::SwrEngine::*;
|
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::Context;
|
use super::Context;
|
||||||
use util::format;
|
use crate::util::format;
|
||||||
use {decoder, frame, ChannelLayout, Error};
|
use crate::{decoder, frame, ChannelLayout, Error};
|
||||||
|
|
||||||
impl frame::Audio {
|
impl frame::Audio {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use ffi::SwrFilterType::*;
|
use crate::ffi::SwrFilterType::*;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -21,7 +21,7 @@ mod extensions;
|
|||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub fn version() -> u32 {
|
pub fn version() -> u32 {
|
||||||
unsafe { swresample_version() }
|
unsafe { swresample_version() }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
#[cfg(feature = "serialize")]
|
#[cfg(feature = "serialize")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::Flags;
|
use super::Flags;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
use crate::util::format;
|
||||||
|
use crate::{frame, Error};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use util::format;
|
|
||||||
use {frame, Error};
|
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
||||||
pub struct Definition {
|
pub struct Definition {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use super::{Context, Flags};
|
use super::{Context, Flags};
|
||||||
use util::format;
|
use crate::util::format;
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
use Picture;
|
use crate::Picture;
|
||||||
use {decoder, frame, Error};
|
use crate::{decoder, frame, Error};
|
||||||
|
|
||||||
#[cfg(not(feature = "ffmpeg_5_0"))]
|
#[cfg(not(feature = "ffmpeg_5_0"))]
|
||||||
impl<'a> Picture<'a> {
|
impl<'a> Picture<'a> {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::Vector;
|
use super::Vector;
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
ptr: *mut SwsFilter,
|
ptr: *mut SwsFilter,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
|
@ -20,7 +20,7 @@ mod extensions;
|
|||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::str::from_utf8_unchecked;
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
|
|
||||||
pub fn version() -> u32 {
|
pub fn version() -> u32 {
|
||||||
unsafe { swscale_version() }
|
unsafe { swscale_version() }
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use util::format;
|
use crate::util::format;
|
||||||
|
|
||||||
pub fn input(format: format::Pixel) -> bool {
|
pub fn input(format: format::Pixel) -> bool {
|
||||||
unsafe { sws_isSupportedInput(format.into()) != 0 }
|
unsafe { sws_isSupportedInput(format.into()) != 0 }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
use ffi::*;
|
use crate::ffi::*;
|
||||||
use libc::{c_double, c_int};
|
use libc::{c_double, c_int};
|
||||||
|
|
||||||
pub struct Vector<'a> {
|
pub struct Vector<'a> {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user