From a33d97640d85fe0606a4c205cd92932e38447ba2 Mon Sep 17 00:00:00 2001 From: meh Date: Tue, 29 Sep 2015 01:17:32 +0200 Subject: [PATCH] software/scaling: add helpers to frame::Video --- src/software/scaling/extensions.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/software/scaling/extensions.rs b/src/software/scaling/extensions.rs index 36e5495..24cacb5 100644 --- a/src/software/scaling/extensions.rs +++ b/src/software/scaling/extensions.rs @@ -1,5 +1,5 @@ use util::format; -use ::{Picture, decoder, Error}; +use ::{Picture, decoder, Error, frame}; use super::{Context, Flags, flag}; 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::get(self.format(), self.width(), self.height(), + self.format(), width, height, + flags) + } + + pub fn converter(&self, format: format::Pixel) -> Result { + Context::get(self.format(), self.width(), self.height(), + format, self.width(), self.height(), + flag::FAST_BILINEAR) + } +} + + impl decoder::Video { pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result { Context::get(self.format(), self.width(), self.height(),