codec/decoder: adapt accessors to new state transitions
This commit is contained in:
parent
ee6004d05e
commit
891b87f25d
@ -68,18 +68,6 @@ impl Context {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn bit_rate(&self) -> usize {
|
|
||||||
unsafe {
|
|
||||||
(*self.as_ptr()).bit_rate as usize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn delay(&self) -> usize {
|
|
||||||
unsafe {
|
|
||||||
(*self.as_ptr()).delay as usize
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn compliance(&mut self, value: Compliance) {
|
pub fn compliance(&mut self, value: Compliance) {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.as_mut_ptr()).strict_std_compliance = value.into();
|
(*self.as_mut_ptr()).strict_std_compliance = value.into();
|
||||||
|
@ -24,7 +24,7 @@ use std::ops::{Deref, DerefMut};
|
|||||||
|
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
use super::{Id, Context};
|
use super::{Id, Context};
|
||||||
use ::{Codec, Error, Dictionary};
|
use ::{Codec, Error, Discard, Dictionary};
|
||||||
|
|
||||||
pub struct Decoder(pub Context);
|
pub struct Decoder(pub Context);
|
||||||
|
|
||||||
@ -83,6 +83,36 @@ impl Decoder {
|
|||||||
Err(Error::DecoderNotFound)
|
Err(Error::DecoderNotFound)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn conceal(&mut self, value: Conceal) {
|
||||||
|
unsafe {
|
||||||
|
(*self.as_mut_ptr()).error_concealment = value.bits();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn check(&mut self, value: Check) {
|
||||||
|
unsafe {
|
||||||
|
(*self.as_mut_ptr()).err_recognition = value.bits();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn skip_loop_filter(&mut self, value: Discard) {
|
||||||
|
unsafe {
|
||||||
|
(*self.as_mut_ptr()).skip_loop_filter = value.into();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn skip_idct(&mut self, value: Discard) {
|
||||||
|
unsafe {
|
||||||
|
(*self.as_mut_ptr()).skip_idct = value.into();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn skip_frame(&mut self, value: Discard) {
|
||||||
|
unsafe {
|
||||||
|
(*self.as_mut_ptr()).skip_frame = value.into();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Deref for Decoder {
|
impl Deref for Decoder {
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
use std::slice::from_raw_parts;
|
|
||||||
|
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
use super::{Conceal, Check, Video, Audio, Subtitle, Decoder};
|
use super::{Video, Audio, Subtitle, Decoder};
|
||||||
use ::codec::Profile;
|
use ::codec::Profile;
|
||||||
use ::{Error, Discard, Rational};
|
use ::{Error, Rational};
|
||||||
use ::media;
|
use ::media;
|
||||||
|
|
||||||
pub struct Opened(pub Decoder);
|
pub struct Opened(pub Decoder);
|
||||||
@ -37,15 +36,15 @@ impl Opened {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn conceal(&mut self, value: Conceal) {
|
pub fn bit_rate(&self) -> usize {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.as_mut_ptr()).error_concealment = value.bits();
|
(*self.as_ptr()).bit_rate as usize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check(&mut self, value: Check) {
|
pub fn delay(&self) -> usize {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.as_mut_ptr()).err_recognition = value.bits();
|
(*self.as_ptr()).delay as usize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,30 +54,6 @@ impl Opened {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn skip_loop_filter(&mut self, value: Discard) {
|
|
||||||
unsafe {
|
|
||||||
(*self.as_mut_ptr()).skip_loop_filter = value.into();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn skip_idct(&mut self, value: Discard) {
|
|
||||||
unsafe {
|
|
||||||
(*self.as_mut_ptr()).skip_idct = value.into();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn skip_frame(&mut self, value: Discard) {
|
|
||||||
unsafe {
|
|
||||||
(*self.as_mut_ptr()).skip_frame = value.into();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn subtitle_header(&self) -> &[u8] {
|
|
||||||
unsafe {
|
|
||||||
from_raw_parts((*self.as_ptr()).subtitle_header, (*self.as_ptr()).subtitle_header_size as usize)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn frame_rate(&self) -> Option<Rational> {
|
pub fn frame_rate(&self) -> Option<Rational> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let value = (*self.as_ptr()).framerate;
|
let value = (*self.as_ptr()).framerate;
|
||||||
@ -91,12 +66,6 @@ impl Opened {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn time_base(&self) -> Rational {
|
|
||||||
unsafe {
|
|
||||||
Rational::from((*self.as_ptr()).time_base)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Opened {
|
impl Drop for Opened {
|
||||||
|
@ -42,12 +42,6 @@ impl Video {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_format(&mut self, value: format::Pixel) {
|
|
||||||
unsafe {
|
|
||||||
(*self.as_mut_ptr()).pix_fmt = value.into();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn has_b_frames(&self) -> bool {
|
pub fn has_b_frames(&self) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.as_ptr()).has_b_frames != 0
|
(*self.as_ptr()).has_b_frames != 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user