playa_ffmpeg/software/scaling/
extensions.rs1use super::{Context, Flags};
2use crate::{Error, decoder, frame, util::format};
3#[cfg(not(feature = "ffmpeg_5_0"))]
4use Picture;
5
6#[cfg(not(feature = "ffmpeg_5_0"))]
7impl<'a> Picture<'a> {
8 #[inline]
9 pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {
10 Context::get(self.format(), self.width(), self.height(), self.format(), width, height, flags)
11 }
12
13 #[inline]
14 pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> {
15 Context::get(self.format(), self.width(), self.height(), format, self.width(), self.height(), Flags::FAST_BILINEAR)
16 }
17}
18
19impl frame::Video {
20 #[inline]
21 pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {
22 Context::get(self.format(), self.width(), self.height(), self.format(), width, height, flags)
23 }
24
25 #[inline]
26 pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> {
27 Context::get(self.format(), self.width(), self.height(), format, self.width(), self.height(), Flags::FAST_BILINEAR)
28 }
29}
30
31impl decoder::Video {
32 #[inline]
33 pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> {
34 Context::get(self.format(), self.width(), self.height(), self.format(), width, height, flags)
35 }
36
37 #[inline]
38 pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> {
39 Context::get(self.format(), self.width(), self.height(), format, self.width(), self.height(), Flags::FAST_BILINEAR)
40 }
41}