From 9e933fa4fb3cb2d6c5ffcfa4abb6e740f1c4c6e9 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 14 Jun 2017 12:47:36 +0300 Subject: [PATCH] codec/encoder/video: add colorspace and color_range accessors --- src/codec/encoder/video.rs | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/codec/encoder/video.rs b/src/codec/encoder/video.rs index a41d55e..596b8a6 100644 --- a/src/codec/encoder/video.rs +++ b/src/codec/encoder/video.rs @@ -6,7 +6,7 @@ use ffi::*; use super::Encoder as Super; 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}; pub struct Video(pub Super); @@ -289,7 +289,7 @@ impl Video { (*self.as_mut_ptr()).me_range = value as c_int; } } - + #[inline] #[cfg(feature = "ff_api_quant_bias")] pub fn set_intra_quant_bias(&mut self, value: Option) { @@ -364,6 +364,34 @@ impl Video { (*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 {