software/scaling: add helpers to frame::Video

This commit is contained in:
meh
2015-09-29 01:17:32 +02:00
parent 5883148188
commit a33d97640d

View File

@ -1,5 +1,5 @@
use util::format; use util::format;
use ::{Picture, decoder, Error}; use ::{Picture, decoder, Error, frame};
use super::{Context, Flags, flag}; use super::{Context, Flags, flag};
impl<'a> Picture<'a> { impl<'a> Picture<'a> {
@ -16,6 +16,21 @@ impl<'a> Picture<'a> {
} }
} }
impl frame::Video {
pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {
Context::get(self.format(), self.width(), self.height(),
self.format(), width, height,
flags)
}
pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> {
Context::get(self.format(), self.width(), self.height(),
format, self.width(), self.height(),
flag::FAST_BILINEAR)
}
}
impl decoder::Video { impl decoder::Video {
pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> { pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {
Context::get(self.format(), self.width(), self.height(), Context::get(self.format(), self.width(), self.height(),