| 1 | use super::{Context, Flags}; |
| 2 | use util::format; |
| 3 | #[cfg (not(feature = "ffmpeg_5_0" ))] |
| 4 | use Picture; |
| 5 | use {decoder, frame, Error}; |
| 6 | |
| 7 | #[cfg (not(feature = "ffmpeg_5_0" ))] |
| 8 | impl<'a> Picture<'a> { |
| 9 | #[inline ] |
| 10 | pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> { |
| 11 | Context::get( |
| 12 | self.format(), |
| 13 | self.width(), |
| 14 | self.height(), |
| 15 | self.format(), |
| 16 | width, |
| 17 | height, |
| 18 | flags, |
| 19 | ) |
| 20 | } |
| 21 | |
| 22 | #[inline ] |
| 23 | pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> { |
| 24 | Context::get( |
| 25 | self.format(), |
| 26 | self.width(), |
| 27 | self.height(), |
| 28 | format, |
| 29 | self.width(), |
| 30 | self.height(), |
| 31 | Flags::FAST_BILINEAR, |
| 32 | ) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | impl frame::Video { |
| 37 | #[inline ] |
| 38 | pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> { |
| 39 | Context::get( |
| 40 | self.format(), |
| 41 | self.width(), |
| 42 | self.height(), |
| 43 | self.format(), |
| 44 | width, |
| 45 | height, |
| 46 | flags, |
| 47 | ) |
| 48 | } |
| 49 | |
| 50 | #[inline ] |
| 51 | pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> { |
| 52 | Context::get( |
| 53 | self.format(), |
| 54 | self.width(), |
| 55 | self.height(), |
| 56 | format, |
| 57 | self.width(), |
| 58 | self.height(), |
| 59 | Flags::FAST_BILINEAR, |
| 60 | ) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | impl decoder::Video { |
| 65 | #[inline ] |
| 66 | pub fn scaler(&self, width: u32, height: u32, flags: Flags) -> Result<Context, Error> { |
| 67 | Context::get( |
| 68 | self.format(), |
| 69 | self.width(), |
| 70 | self.height(), |
| 71 | self.format(), |
| 72 | width, |
| 73 | height, |
| 74 | flags, |
| 75 | ) |
| 76 | } |
| 77 | |
| 78 | #[inline ] |
| 79 | pub fn converter(&self, format: format::Pixel) -> Result<Context, Error> { |
| 80 | Context::get( |
| 81 | self.format(), |
| 82 | self.width(), |
| 83 | self.height(), |
| 84 | format, |
| 85 | self.width(), |
| 86 | self.height(), |
| 87 | Flags::FAST_BILINEAR, |
| 88 | ) |
| 89 | } |
| 90 | } |
| 91 | |