codec/encoder/video: add colorspace and color_range accessors

This commit is contained in:
Ivan Molodetskikh 2017-06-14 12:47:36 +03:00 committed by meh
parent b14dd01126
commit 9e933fa4fb

View File

@ -6,7 +6,7 @@ use ffi::*;
use super::Encoder as Super; use super::Encoder as Super;
use super::{MotionEstimation, Prediction, Comparison, Decision}; use super::{MotionEstimation, Prediction, Comparison, Decision};
use ::{packet, Error, Rational, Dictionary, frame, format}; use ::{color, packet, Error, Rational, Dictionary, frame, format};
use codec::{traits, Context}; use codec::{traits, Context};
pub struct Video(pub Super); pub struct Video(pub Super);
@ -289,7 +289,7 @@ impl Video {
(*self.as_mut_ptr()).me_range = value as c_int; (*self.as_mut_ptr()).me_range = value as c_int;
} }
} }
#[inline] #[inline]
#[cfg(feature = "ff_api_quant_bias")] #[cfg(feature = "ff_api_quant_bias")]
pub fn set_intra_quant_bias(&mut self, value: Option<usize>) { pub fn set_intra_quant_bias(&mut self, value: Option<usize>) {
@ -364,6 +364,34 @@ impl Video {
(*self.as_mut_ptr()).global_quality = value as c_int; (*self.as_mut_ptr()).global_quality = value as c_int;
} }
} }
#[inline]
pub fn set_colorspace(&mut self, value: color::Space) {
unsafe {
(*self.as_mut_ptr()).colorspace = value.into();
}
}
#[inline]
pub fn colorspace(&self) -> color::Space {
unsafe {
(*self.as_ptr()).colorspace.into()
}
}
#[inline]
pub fn set_color_range(&mut self, value: color::Range) {
unsafe {
(*self.as_mut_ptr()).color_range = value.into();
}
}
#[inline]
pub fn color_range(&self) -> color::Range {
unsafe {
(*self.as_ptr()).color_range.into()
}
}
} }
impl Deref for Video { impl Deref for Video {