mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
chore: make stuff build again
This commit is contained in:
+23
-2
@@ -5,10 +5,31 @@ rust:
|
||||
- beta
|
||||
- nightly
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- rust: nightly
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- build-essential
|
||||
- yasm
|
||||
|
||||
script:
|
||||
- travis_wait cargo test --verbose --features build
|
||||
dist: bionic
|
||||
|
||||
cache: cargo
|
||||
|
||||
before_install:
|
||||
- rm -rf "$TRAVIS_HOME/.cargo/registry/src"
|
||||
# Without rustfmt, bindgen puts everything on one line and any warnings dump so many logs they break Travis
|
||||
# See https://github.com/rust-lang/rust-bindgen/issues/1600
|
||||
- rustup component add rustfmt
|
||||
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; fi
|
||||
- if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew install yasm; fi
|
||||
|
||||
script: |
|
||||
travis_wait cargo build --verbose --features "build"
|
||||
|
||||
+6
-6
@@ -11,7 +11,7 @@ repository = "https://github.com/meh/rust-ffmpeg"
|
||||
keywords = ["audio", "video"]
|
||||
|
||||
[features]
|
||||
default = ["codec", "device", "filter", "format", "resampling", "software-resampling", "software-scaling"]
|
||||
default = ["codec", "device", "filter", "format", "resampling", "software-scaling"]
|
||||
|
||||
static = ["ffmpeg-sys/static"]
|
||||
build = ["static", "ffmpeg-sys/build"]
|
||||
@@ -81,19 +81,19 @@ codec = ["ffmpeg-sys/avcodec"]
|
||||
device = ["ffmpeg-sys/avdevice", "format"]
|
||||
filter = ["ffmpeg-sys/avfilter"]
|
||||
format = ["ffmpeg-sys/avformat", "codec"]
|
||||
resampling = ["ffmpeg-sys/avresample"]
|
||||
resampling = ["ffmpeg-sys/swresample"]
|
||||
postprocessing = ["ffmpeg-sys/postproc"]
|
||||
software-resampling = ["ffmpeg-sys/swresample"]
|
||||
software-scaling = ["ffmpeg-sys/swscale", "codec"]
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
||||
bitflags = "0.9"
|
||||
bitflags = "1.0"
|
||||
|
||||
[dependencies.image]
|
||||
version = "0.12"
|
||||
version = "0.23"
|
||||
optional = true
|
||||
|
||||
[dependencies.ffmpeg-sys]
|
||||
version = "3.3"
|
||||
version = "4.2"
|
||||
default-features = false
|
||||
path = "../ffmpeg-sys"
|
||||
|
||||
@@ -40,7 +40,7 @@ fn filter(
|
||||
if let Some(codec) = encoder.codec() {
|
||||
if !codec
|
||||
.capabilities()
|
||||
.contains(ffmpeg::codec::capabilities::VARIABLE_FRAME_SIZE)
|
||||
.contains(ffmpeg::codec::capabilities::Capabilities::VARIABLE_FRAME_SIZE)
|
||||
{
|
||||
filter
|
||||
.get("out")
|
||||
@@ -66,16 +66,18 @@ fn transcoder<P: AsRef<Path>>(
|
||||
path: &P,
|
||||
filter_spec: &str,
|
||||
) -> Result<Transcoder, ffmpeg::Error> {
|
||||
let input = ictx.streams()
|
||||
let input = ictx
|
||||
.streams()
|
||||
.best(media::Type::Audio)
|
||||
.expect("could not find best audio stream");
|
||||
let mut decoder = input.codec().decoder().audio()?;
|
||||
let codec = ffmpeg::encoder::find(octx.format().codec(path, media::Type::Audio))
|
||||
.expect("failed to find encoder")
|
||||
.audio()?;
|
||||
let global = octx.format()
|
||||
let global = octx
|
||||
.format()
|
||||
.flags()
|
||||
.contains(ffmpeg::format::flag::GLOBAL_HEADER);
|
||||
.contains(ffmpeg::format::flag::Flags::GLOBAL_HEADER);
|
||||
|
||||
decoder.set_parameters(input.parameters())?;
|
||||
|
||||
@@ -85,10 +87,10 @@ fn transcoder<P: AsRef<Path>>(
|
||||
let channel_layout = codec
|
||||
.channel_layouts()
|
||||
.map(|cls| cls.best(decoder.channel_layout().channels()))
|
||||
.unwrap_or(ffmpeg::channel_layout::STEREO);
|
||||
.unwrap_or(ffmpeg::channel_layout::ChannelLayout::STEREO);
|
||||
|
||||
if global {
|
||||
encoder.set_flags(ffmpeg::codec::flag::GLOBAL_HEADER);
|
||||
encoder.set_flags(ffmpeg::codec::flag::Flags::GLOBAL_HEADER);
|
||||
}
|
||||
|
||||
encoder.set_rate(decoder.rate() as i32);
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ impl ChannelLayoutIter {
|
||||
}
|
||||
|
||||
pub fn best(self, max: i32) -> ChannelLayout {
|
||||
self.fold(::channel_layout::MONO, |acc, cur| {
|
||||
self.fold(::channel_layout::ChannelLayout::MONO, |acc, cur| {
|
||||
if cur.channels() > acc.channels() && cur.channels() <= max {
|
||||
cur
|
||||
} else {
|
||||
|
||||
@@ -8,7 +8,6 @@ bitflags! {
|
||||
const TRUNCATED = AV_CODEC_CAP_TRUNCATED;
|
||||
const DELAY = AV_CODEC_CAP_DELAY;
|
||||
const SMALL_LAST_FRAME = AV_CODEC_CAP_SMALL_LAST_FRAME;
|
||||
const HWACCEL_VDPAU = AV_CODEC_CAP_HWACCEL_VDPAU;
|
||||
const SUBFRAMES = AV_CODEC_CAP_SUBFRAMES;
|
||||
const EXPERIMENTAL = AV_CODEC_CAP_EXPERIMENTAL;
|
||||
const CHANNEL_CONF = AV_CODEC_CAP_CHANNEL_CONF;
|
||||
|
||||
@@ -11,13 +11,13 @@ use {Codec, Error};
|
||||
|
||||
pub struct Context {
|
||||
ptr: *mut AVCodecContext,
|
||||
owner: Option<Rc<Drop>>,
|
||||
owner: Option<Rc<dyn Drop>>,
|
||||
}
|
||||
|
||||
unsafe impl Send for Context {}
|
||||
|
||||
impl Context {
|
||||
pub unsafe fn wrap(ptr: *mut AVCodecContext, owner: Option<Rc<Drop>>) -> Self {
|
||||
pub unsafe fn wrap(ptr: *mut AVCodecContext, owner: Option<Rc<dyn Drop>>) -> Self {
|
||||
Context {
|
||||
ptr: ptr,
|
||||
owner: owner,
|
||||
|
||||
+3
-4
@@ -8,16 +8,15 @@ bitflags! {
|
||||
const BITSTREAM = FF_DEBUG_BITSTREAM;
|
||||
const MB_TYPE = FF_DEBUG_MB_TYPE;
|
||||
const QP = FF_DEBUG_QP;
|
||||
const MV = FF_DEBUG_MV;
|
||||
const DCT_COEFF = FF_DEBUG_DCT_COEFF;
|
||||
const SKIP = FF_DEBUG_SKIP;
|
||||
const STARTCODE = FF_DEBUG_STARTCODE;
|
||||
const PTS = FF_DEBUG_PTS;
|
||||
const ER = FF_DEBUG_ER;
|
||||
const MMCO = FF_DEBUG_MMCO;
|
||||
const BUGS = FF_DEBUG_BUGS;
|
||||
const VIS_QP = FF_DEBUG_VIS_QP;
|
||||
const VIS_MB_TYPE = FF_DEBUG_VIS_MB_TYPE;
|
||||
// TODO They are under #if in avcodec.h
|
||||
// const VIS_QP = FF_DEBUG_VIS_QP;
|
||||
// const VIS_MB_TYPE = FF_DEBUG_VIS_MB_TYPE;
|
||||
const BUFFERS = FF_DEBUG_BUFFERS;
|
||||
const THREADS = FF_DEBUG_THREADS;
|
||||
const NOMC = FF_DEBUG_NOMC;
|
||||
|
||||
@@ -193,6 +193,12 @@ impl Deref for Encoder {
|
||||
}
|
||||
}
|
||||
|
||||
impl DerefMut for Encoder {
|
||||
fn deref_mut(&mut self) -> &mut <Self as Deref>::Target {
|
||||
&mut self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<Context> for Encoder {
|
||||
fn as_ref(&self) -> &Context {
|
||||
self
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::ops::{Deref, DerefMut};
|
||||
|
||||
use super::{audio, subtitle, video};
|
||||
use codec::Context;
|
||||
use libc::{c_int, int64_t};
|
||||
use libc::c_int;
|
||||
use {media, Error, Rational};
|
||||
|
||||
pub struct Encoder(pub Context);
|
||||
@@ -58,13 +58,13 @@ impl Encoder {
|
||||
|
||||
pub fn set_bit_rate(&mut self, value: usize) {
|
||||
unsafe {
|
||||
(*self.as_mut_ptr()).bit_rate = value as int64_t;
|
||||
(*self.as_mut_ptr()).bit_rate = value as i64;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_max_bit_rate(&mut self, value: usize) {
|
||||
unsafe {
|
||||
(*self.as_mut_ptr()).rc_max_rate = value as int64_t;
|
||||
(*self.as_mut_ptr()).rc_max_rate = value as i64;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+52
-13
@@ -95,6 +95,7 @@ pub enum Id {
|
||||
MMVIDEO,
|
||||
ZMBV,
|
||||
AVS,
|
||||
AVS2,
|
||||
SMACKVIDEO,
|
||||
NUV,
|
||||
KMVC,
|
||||
@@ -231,7 +232,7 @@ pub enum Id {
|
||||
YLC,
|
||||
|
||||
// various PCM "codecs"
|
||||
PCM_S16LE,
|
||||
// PCM_S16LE,
|
||||
PCM_S16BE,
|
||||
PCM_U16LE,
|
||||
PCM_U16BE,
|
||||
@@ -298,7 +299,6 @@ pub enum Id {
|
||||
ADPCM_G722,
|
||||
ADPCM_IMA_APC,
|
||||
ADPCM_VIMA,
|
||||
VIMA,
|
||||
|
||||
ADPCM_AFC,
|
||||
ADPCM_IMA_OKI,
|
||||
@@ -397,6 +397,7 @@ pub enum Id {
|
||||
PAF_AUDIO,
|
||||
ON2AVC,
|
||||
DSS_SP,
|
||||
CODEC2,
|
||||
|
||||
FFWAVESYNTH,
|
||||
SONIC,
|
||||
@@ -414,7 +415,7 @@ pub enum Id {
|
||||
DST,
|
||||
|
||||
// subtitle codecs
|
||||
DVD_SUBTITLE,
|
||||
// DVD_SUBTITLE,
|
||||
DVB_SUBTITLE,
|
||||
TEXT,
|
||||
XSUB,
|
||||
@@ -441,8 +442,6 @@ pub enum Id {
|
||||
HDMV_TEXT_SUBTITLE,
|
||||
|
||||
// other specific kind of codecs (generally used for attachments)
|
||||
TTF,
|
||||
|
||||
SCTE_35,
|
||||
BINTEXT,
|
||||
XBIN,
|
||||
@@ -481,6 +480,19 @@ pub enum Id {
|
||||
FITS,
|
||||
GREMLIN_DPCM,
|
||||
DOLBY_E,
|
||||
APTX,
|
||||
APTX_HD,
|
||||
SBC,
|
||||
|
||||
IMM4,
|
||||
PROSUMER,
|
||||
MWSC,
|
||||
WCMV,
|
||||
RASC,
|
||||
PCM_VIDC,
|
||||
ATRAC9,
|
||||
|
||||
TTML,
|
||||
}
|
||||
|
||||
impl Id {
|
||||
@@ -495,6 +507,7 @@ impl Id {
|
||||
|
||||
impl From<AVCodecID> for Id {
|
||||
fn from(value: AVCodecID) -> Self {
|
||||
#[allow(unreachable_patterns)]
|
||||
match value {
|
||||
AV_CODEC_ID_NONE => Id::None,
|
||||
|
||||
@@ -583,6 +596,7 @@ impl From<AVCodecID> for Id {
|
||||
AV_CODEC_ID_MMVIDEO => Id::MMVIDEO,
|
||||
AV_CODEC_ID_ZMBV => Id::ZMBV,
|
||||
AV_CODEC_ID_AVS => Id::AVS,
|
||||
AV_CODEC_ID_AVS2 => Id::AVS2,
|
||||
AV_CODEC_ID_SMACKVIDEO => Id::SMACKVIDEO,
|
||||
AV_CODEC_ID_NUV => Id::NUV,
|
||||
AV_CODEC_ID_KMVC => Id::KMVC,
|
||||
@@ -717,7 +731,7 @@ impl From<AVCodecID> for Id {
|
||||
AV_CODEC_ID_YLC => Id::YLC,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
AV_CODEC_ID_PCM_S16LE => Id::PCM_S16LE,
|
||||
// AV_CODEC_ID_PCM_S16LE => Id::PCM_S16LE,
|
||||
AV_CODEC_ID_PCM_S16BE => Id::PCM_S16BE,
|
||||
AV_CODEC_ID_PCM_U16LE => Id::PCM_U16LE,
|
||||
AV_CODEC_ID_PCM_U16BE => Id::PCM_U16BE,
|
||||
@@ -752,6 +766,9 @@ impl From<AVCodecID> for Id {
|
||||
AV_CODEC_ID_PCM_S64LE => Id::PCM_S64LE,
|
||||
AV_CODEC_ID_PCM_S64BE => Id::PCM_S64BE,
|
||||
|
||||
AV_CODEC_ID_PCM_VIDC => Id::PCM_VIDC,
|
||||
AV_CODEC_ID_ATRAC9 => Id::ATRAC9,
|
||||
|
||||
/* various ADPCM codecs */
|
||||
AV_CODEC_ID_ADPCM_IMA_QT => Id::ADPCM_IMA_QT,
|
||||
AV_CODEC_ID_ADPCM_IMA_WAV => Id::ADPCM_IMA_WAV,
|
||||
@@ -882,6 +899,7 @@ impl From<AVCodecID> for Id {
|
||||
AV_CODEC_ID_PAF_AUDIO => Id::PAF_AUDIO,
|
||||
AV_CODEC_ID_ON2AVC => Id::ON2AVC,
|
||||
AV_CODEC_ID_DSS_SP => Id::DSS_SP,
|
||||
AV_CODEC_ID_CODEC2 => Id::CODEC2,
|
||||
|
||||
AV_CODEC_ID_FFWAVESYNTH => Id::FFWAVESYNTH,
|
||||
AV_CODEC_ID_SONIC => Id::SONIC,
|
||||
@@ -899,7 +917,7 @@ impl From<AVCodecID> for Id {
|
||||
AV_CODEC_ID_DST => Id::DST,
|
||||
|
||||
/* subtitle codecs */
|
||||
AV_CODEC_ID_DVD_SUBTITLE => Id::DVD_SUBTITLE,
|
||||
// AV_CODEC_ID_DVD_SUBTITLE => Id::DVD_SUBTITLE,
|
||||
AV_CODEC_ID_DVB_SUBTITLE => Id::DVB_SUBTITLE,
|
||||
AV_CODEC_ID_TEXT => Id::TEXT,
|
||||
AV_CODEC_ID_XSUB => Id::XSUB,
|
||||
@@ -926,7 +944,6 @@ impl From<AVCodecID> for Id {
|
||||
AV_CODEC_ID_HDMV_TEXT_SUBTITLE => Id::HDMV_TEXT_SUBTITLE,
|
||||
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
AV_CODEC_ID_TTF => Id::TTF,
|
||||
|
||||
AV_CODEC_ID_SCTE_35 => Id::SCTE_35,
|
||||
AV_CODEC_ID_BINTEXT => Id::BINTEXT,
|
||||
@@ -965,6 +982,18 @@ impl From<AVCodecID> for Id {
|
||||
AV_CODEC_ID_FITS => Id::FITS,
|
||||
AV_CODEC_ID_GREMLIN_DPCM => Id::GREMLIN_DPCM,
|
||||
AV_CODEC_ID_DOLBY_E => Id::DOLBY_E,
|
||||
AV_CODEC_ID_APTX => Id::APTX,
|
||||
AV_CODEC_ID_APTX_HD => Id::APTX_HD,
|
||||
AV_CODEC_ID_SBC => Id::SBC,
|
||||
|
||||
AV_CODEC_ID_IMM4 => Id::IMM4,
|
||||
AV_CODEC_ID_PROSUMER => Id::PROSUMER,
|
||||
AV_CODEC_ID_MWSC => Id::MWSC,
|
||||
AV_CODEC_ID_WCMV => Id::WCMV,
|
||||
AV_CODEC_ID_RASC => Id::RASC,
|
||||
AV_CODEC_ID_TTML => Id::TTML,
|
||||
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1059,6 +1088,7 @@ impl Into<AVCodecID> for Id {
|
||||
Id::MMVIDEO => AV_CODEC_ID_MMVIDEO,
|
||||
Id::ZMBV => AV_CODEC_ID_ZMBV,
|
||||
Id::AVS => AV_CODEC_ID_AVS,
|
||||
Id::AVS2 => AV_CODEC_ID_AVS2,
|
||||
Id::SMACKVIDEO => AV_CODEC_ID_SMACKVIDEO,
|
||||
Id::NUV => AV_CODEC_ID_NUV,
|
||||
Id::KMVC => AV_CODEC_ID_KMVC,
|
||||
@@ -1195,7 +1225,6 @@ impl Into<AVCodecID> for Id {
|
||||
Id::YLC => AV_CODEC_ID_YLC,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
Id::PCM_S16LE => AV_CODEC_ID_PCM_S16LE,
|
||||
Id::PCM_S16BE => AV_CODEC_ID_PCM_S16BE,
|
||||
Id::PCM_U16LE => AV_CODEC_ID_PCM_U16LE,
|
||||
Id::PCM_U16BE => AV_CODEC_ID_PCM_U16BE,
|
||||
@@ -1262,7 +1291,6 @@ impl Into<AVCodecID> for Id {
|
||||
Id::ADPCM_G722 => AV_CODEC_ID_ADPCM_G722,
|
||||
Id::ADPCM_IMA_APC => AV_CODEC_ID_ADPCM_IMA_APC,
|
||||
Id::ADPCM_VIMA => AV_CODEC_ID_ADPCM_VIMA,
|
||||
Id::VIMA => AV_CODEC_ID_VIMA,
|
||||
|
||||
Id::ADPCM_AFC => AV_CODEC_ID_ADPCM_AFC,
|
||||
Id::ADPCM_IMA_OKI => AV_CODEC_ID_ADPCM_IMA_OKI,
|
||||
@@ -1361,6 +1389,7 @@ impl Into<AVCodecID> for Id {
|
||||
Id::PAF_AUDIO => AV_CODEC_ID_PAF_AUDIO,
|
||||
Id::ON2AVC => AV_CODEC_ID_ON2AVC,
|
||||
Id::DSS_SP => AV_CODEC_ID_DSS_SP,
|
||||
Id::CODEC2 => AV_CODEC_ID_CODEC2,
|
||||
|
||||
Id::FFWAVESYNTH => AV_CODEC_ID_FFWAVESYNTH,
|
||||
Id::SONIC => AV_CODEC_ID_SONIC,
|
||||
@@ -1378,8 +1407,8 @@ impl Into<AVCodecID> for Id {
|
||||
Id::DST => AV_CODEC_ID_DST,
|
||||
|
||||
/* subtitle codecs */
|
||||
Id::DVD_SUBTITLE => AV_CODEC_ID_DVD_SUBTITLE,
|
||||
Id::DVB_SUBTITLE => AV_CODEC_ID_DVB_SUBTITLE,
|
||||
|
||||
Id::TEXT => AV_CODEC_ID_TEXT,
|
||||
Id::XSUB => AV_CODEC_ID_XSUB,
|
||||
Id::SSA => AV_CODEC_ID_SSA,
|
||||
@@ -1405,8 +1434,6 @@ impl Into<AVCodecID> for Id {
|
||||
Id::HDMV_TEXT_SUBTITLE => AV_CODEC_ID_HDMV_TEXT_SUBTITLE,
|
||||
|
||||
/* other specific kind of codecs (generally used for attachments) */
|
||||
Id::TTF => AV_CODEC_ID_TTF,
|
||||
|
||||
Id::SCTE_35 => AV_CODEC_ID_SCTE_35,
|
||||
Id::BINTEXT => AV_CODEC_ID_BINTEXT,
|
||||
Id::XBIN => AV_CODEC_ID_XBIN,
|
||||
@@ -1445,6 +1472,18 @@ impl Into<AVCodecID> for Id {
|
||||
Id::FITS => AV_CODEC_ID_FITS,
|
||||
Id::GREMLIN_DPCM => AV_CODEC_ID_GREMLIN_DPCM,
|
||||
Id::DOLBY_E => AV_CODEC_ID_DOLBY_E,
|
||||
Id::APTX => AV_CODEC_ID_APTX,
|
||||
Id::APTX_HD => AV_CODEC_ID_APTX_HD,
|
||||
Id::SBC => AV_CODEC_ID_SBC,
|
||||
|
||||
Id::IMM4 => AV_CODEC_ID_IMM4,
|
||||
Id::PROSUMER => AV_CODEC_ID_PROSUMER,
|
||||
Id::MWSC => AV_CODEC_ID_MWSC,
|
||||
Id::WCMV => AV_CODEC_ID_WCMV,
|
||||
Id::RASC => AV_CODEC_ID_RASC,
|
||||
Id::PCM_VIDC => AV_CODEC_ID_PCM_VIDC,
|
||||
Id::ATRAC9 => AV_CODEC_ID_ATRAC9,
|
||||
Id::TTML => AV_CODEC_ID_TTML,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::slice;
|
||||
|
||||
use super::{flag, Borrow, Flags, Mut, Ref, SideData};
|
||||
use super::{Borrow, Flags, Mut, Ref, SideData};
|
||||
use ffi::*;
|
||||
use libc::c_int;
|
||||
use {format, Error, Rational};
|
||||
@@ -99,12 +99,12 @@ impl Packet {
|
||||
|
||||
#[inline]
|
||||
pub fn is_key(&self) -> bool {
|
||||
self.flags().contains(flag::KEY)
|
||||
self.flags().contains(Flags::KEY)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn is_corrupt(&self) -> bool {
|
||||
self.flags().contains(flag::CORRUPT)
|
||||
self.flags().contains(Flags::CORRUPT)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
@@ -33,10 +33,16 @@ pub enum Type {
|
||||
|
||||
ContentLightLevel,
|
||||
A53CC,
|
||||
|
||||
EncryptionInitInfo,
|
||||
EncryptionInfo,
|
||||
|
||||
AFD,
|
||||
}
|
||||
|
||||
impl From<AVPacketSideDataType> for Type {
|
||||
fn from(value: AVPacketSideDataType) -> Self {
|
||||
#[allow(unreachable_patterns)]
|
||||
match value {
|
||||
AV_PKT_DATA_PALETTE => Type::Palette,
|
||||
AV_PKT_DATA_NEW_EXTRADATA => Type::NewExtraData,
|
||||
@@ -64,6 +70,11 @@ impl From<AVPacketSideDataType> for Type {
|
||||
|
||||
AV_PKT_DATA_CONTENT_LIGHT_LEVEL => Type::ContentLightLevel,
|
||||
AV_PKT_DATA_A53_CC => Type::A53CC,
|
||||
AV_PKT_DATA_ENCRYPTION_INIT_INFO => Type::EncryptionInitInfo,
|
||||
AV_PKT_DATA_ENCRYPTION_INFO => Type::EncryptionInfo,
|
||||
AV_PKT_DATA_AFD => Type::AFD,
|
||||
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,6 +108,9 @@ impl Into<AVPacketSideDataType> for Type {
|
||||
|
||||
Type::ContentLightLevel => AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
|
||||
Type::A53CC => AV_PKT_DATA_A53_CC,
|
||||
Type::EncryptionInitInfo => AV_PKT_DATA_ENCRYPTION_INIT_INFO,
|
||||
Type::EncryptionInfo => AV_PKT_DATA_ENCRYPTION_INFO,
|
||||
Type::AFD => AV_PKT_DATA_AFD,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ use media;
|
||||
|
||||
pub struct Parameters {
|
||||
ptr: *mut AVCodecParameters,
|
||||
owner: Option<Rc<Drop>>,
|
||||
owner: Option<Rc<dyn Drop>>,
|
||||
}
|
||||
|
||||
unsafe impl Send for Parameters {}
|
||||
|
||||
impl Parameters {
|
||||
pub unsafe fn wrap(ptr: *mut AVCodecParameters, owner: Option<Rc<Drop>>) -> Self {
|
||||
pub unsafe fn wrap(ptr: *mut AVCodecParameters, owner: Option<Rc<dyn Drop>>) -> Self {
|
||||
Parameters {
|
||||
ptr: ptr,
|
||||
owner: owner,
|
||||
|
||||
@@ -12,7 +12,7 @@ use std::mem;
|
||||
|
||||
use ffi::AVSubtitleType::*;
|
||||
use ffi::*;
|
||||
use libc::{c_uint, size_t, uint32_t};
|
||||
use libc::{c_uint, size_t};
|
||||
|
||||
#[derive(Eq, PartialEq, Clone, Copy, Debug)]
|
||||
pub enum Type {
|
||||
@@ -77,7 +77,7 @@ impl Subtitle {
|
||||
}
|
||||
|
||||
pub fn set_start(&mut self, value: u32) {
|
||||
self.0.start_display_time = value as uint32_t;
|
||||
self.0.start_display_time = value as u32;
|
||||
}
|
||||
|
||||
pub fn end(&self) -> u32 {
|
||||
@@ -85,7 +85,7 @@ impl Subtitle {
|
||||
}
|
||||
|
||||
pub fn set_end(&mut self, value: u32) {
|
||||
self.0.end_display_time = value as uint32_t;
|
||||
self.0.end_display_time = value as u32;
|
||||
}
|
||||
|
||||
pub fn rects(&self) -> RectIter {
|
||||
@@ -147,9 +147,9 @@ impl<'a> Iterator for RectIter<'a> {
|
||||
None
|
||||
} else {
|
||||
self.cur += 1;
|
||||
Some(Rect::wrap(*(*self.ptr)
|
||||
.rects
|
||||
.offset((self.cur - 1) as isize)))
|
||||
Some(Rect::wrap(
|
||||
*(*self.ptr).rects.offset((self.cur - 1) as isize),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,9 +191,9 @@ impl<'a> Iterator for RectMutIter<'a> {
|
||||
None
|
||||
} else {
|
||||
self.cur += 1;
|
||||
Some(RectMut::wrap(*(*self.ptr)
|
||||
.rects
|
||||
.offset((self.cur - 1) as isize)))
|
||||
Some(RectMut::wrap(
|
||||
*(*self.ptr).rects.offset((self.cur - 1) as isize),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ use super::{Flags, Pad};
|
||||
use ffi::*;
|
||||
|
||||
pub struct Filter {
|
||||
ptr: *mut AVFilter,
|
||||
ptr: *const AVFilter,
|
||||
}
|
||||
|
||||
impl Filter {
|
||||
pub unsafe fn wrap(ptr: *mut AVFilter) -> Self {
|
||||
pub unsafe fn wrap(ptr: *const AVFilter) -> Self {
|
||||
Filter { ptr: ptr }
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ impl Filter {
|
||||
}
|
||||
|
||||
pub unsafe fn as_mut_ptr(&mut self) -> *mut AVFilter {
|
||||
self.ptr
|
||||
self.ptr as *mut _
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ bitflags! {
|
||||
const NO_FILE = AVFMT_NOFILE;
|
||||
const NEED_NUMBER = AVFMT_NEEDNUMBER;
|
||||
const SHOW_IDS = AVFMT_SHOW_IDS;
|
||||
const RAW_PICTURE = AVFMT_RAWPICTURE;
|
||||
const GLOBAL_HEADER = AVFMT_GLOBALHEADER;
|
||||
const NO_TIMESTAMPS = AVFMT_NOTIMESTAMPS;
|
||||
const GENERIC_INDEX = AVFMT_GENERIC_INDEX;
|
||||
|
||||
+3
-3
@@ -28,14 +28,14 @@ pub fn converter(
|
||||
output,
|
||||
width,
|
||||
height,
|
||||
scaling::flag::FAST_BILINEAR,
|
||||
scaling::flag::Flags::FAST_BILINEAR,
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(feature = "software-resampling")]
|
||||
#[cfg(feature = "resampling")]
|
||||
pub mod resampling;
|
||||
|
||||
#[cfg(feature = "software-resampling")]
|
||||
#[cfg(feature = "resampling")]
|
||||
#[inline]
|
||||
pub fn resampler(
|
||||
(in_format, in_layout, in_rate): (::format::Sample, ::ChannelLayout, u32),
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::ptr;
|
||||
|
||||
use super::Delay;
|
||||
use ffi::*;
|
||||
use libc::{c_int, int64_t};
|
||||
use libc::c_int;
|
||||
use util::format;
|
||||
use {frame, ChannelLayout, Error};
|
||||
|
||||
@@ -47,10 +47,10 @@ impl Context {
|
||||
unsafe {
|
||||
let ptr = swr_alloc_set_opts(
|
||||
ptr::null_mut(),
|
||||
dst_channel_layout.bits() as int64_t,
|
||||
dst_channel_layout.bits() as i64,
|
||||
dst_format.into(),
|
||||
dst_rate as c_int,
|
||||
src_channel_layout.bits() as int64_t,
|
||||
src_channel_layout.bits() as i64,
|
||||
src_format.into(),
|
||||
src_rate as c_int,
|
||||
0,
|
||||
|
||||
@@ -128,7 +128,8 @@ impl Context {
|
||||
}
|
||||
|
||||
pub fn run(&mut self, input: &frame::Video, output: &mut frame::Video) -> Result<(), Error> {
|
||||
if input.format() != self.input.format || input.width() != self.input.width
|
||||
if input.format() != self.input.format
|
||||
|| input.width() != self.input.width
|
||||
|| input.height() != self.input.height
|
||||
{
|
||||
return Err(Error::InputChanged);
|
||||
@@ -140,7 +141,8 @@ impl Context {
|
||||
}
|
||||
}
|
||||
|
||||
if output.format() != self.output.format || output.width() != self.output.width
|
||||
if output.format() != self.output.format
|
||||
|| output.width() != self.output.width
|
||||
|| output.height() != self.output.height
|
||||
{
|
||||
return Err(Error::OutputChanged);
|
||||
@@ -153,7 +155,7 @@ impl Context {
|
||||
(*input.as_ptr()).linesize.as_ptr() as *const _,
|
||||
0,
|
||||
self.output.height as c_int,
|
||||
(*output.as_mut_ptr()).data.as_ptr() as *const *const _,
|
||||
(*output.as_mut_ptr()).data.as_ptr() as *const *mut _,
|
||||
(*output.as_mut_ptr()).linesize.as_ptr() as *mut _,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::{flag, Context, Flags};
|
||||
use super::{Context, Flags};
|
||||
use util::format;
|
||||
use {decoder, frame, Error, Picture};
|
||||
|
||||
@@ -25,7 +25,7 @@ impl<'a> Picture<'a> {
|
||||
format,
|
||||
self.width(),
|
||||
self.height(),
|
||||
flag::FAST_BILINEAR,
|
||||
Flags::FAST_BILINEAR,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ impl frame::Video {
|
||||
format,
|
||||
self.width(),
|
||||
self.height(),
|
||||
flag::FAST_BILINEAR,
|
||||
Flags::FAST_BILINEAR,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ impl decoder::Video {
|
||||
format,
|
||||
self.width(),
|
||||
self.height(),
|
||||
flag::FAST_BILINEAR,
|
||||
Flags::FAST_BILINEAR,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user