From: Kostya Shishkov Date: Tue, 28 Apr 2026 17:09:27 +0000 (+0200) Subject: videoplayer: handle down-scaling with SDL properly too X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=HEAD;p=nihav-player.git videoplayer: handle down-scaling with SDL properly too --- diff --git a/videoplayer/src/main.rs b/videoplayer/src/main.rs index eac789f..ffc54ab 100644 --- a/videoplayer/src/main.rs +++ b/videoplayer/src/main.rs @@ -325,8 +325,8 @@ pub struct DispQueue<'a> { } impl<'a> DispQueue<'a> { - fn new(texture_creator: &'a TextureCreator, width: usize, height: usize, len: usize) -> Self { - let pool = SDLPool::new(texture_creator, width, height, len); + fn new(texture_creator: &'a TextureCreator, width: usize, height: usize, orig_w: usize, orig_h: usize, len: usize) -> Self { + let pool = SDLPool::new(texture_creator, orig_w, orig_h, len); let mut empty_tex = texture_creator.create_texture_streaming(PixelFormatEnum::RGB24, width as u32, height as u32).expect("failed to create RGB texture"); empty_tex.with_lock(None, |buffer: &mut [u8], _pitch: usize| { @@ -995,7 +995,7 @@ impl Player { window.show(); let mut canvas = window.into_canvas().build().expect("should be able to build canvas"); let texture_creator = canvas.texture_creator(); - let mut disp_q = DispQueue::new(&texture_creator, width, height, if self.has_video { FRAME_QUEUE_LEN } else { 0 }); + let mut disp_q = DispQueue::new(&texture_creator, width, height, dec_w, dec_h, if self.has_video { FRAME_QUEUE_LEN } else { 0 }); if !self.has_video { canvas.clear(); canvas.copy(disp_q.get_last_texture(), None, None).expect("blit failure");