[vlc-commits] vout: android: don't allocate a picture to get the pitch of the first plane
Steve Lhomme
git at videolan.org
Mon Aug 5 07:47:45 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jul 31 11:36:55 2019 +0200| [d6fd5bc57ca1da6bb68eca7afac85abb61039e7a] | committer: Steve Lhomme
vout: android: don't allocate a picture to get the pitch of the first plane
We can get it from the chroma description.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d6fd5bc57ca1da6bb68eca7afac85abb61039e7a
---
modules/video_output/android/display.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 798aaeef9a..edf335a8c7 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -417,14 +417,15 @@ static int AndroidWindow_Setup(vout_display_sys_t *sys,
p_window->i_pic_count = i_pic_count;
if (!p_window->b_opaque) {
- int align_pixels;
- picture_t *p_pic = PictureAlloc(sys, &p_window->fmt, false);
-
- // For RGB (32 or 16) we need to align on 8 or 4 pixels, 16 pixels for YUV
- align_pixels = (16 / p_pic->p[0].i_pixel_pitch) - 1;
- p_window->fmt.i_height = p_pic->format.i_height;
- p_window->fmt.i_width = (p_pic->format.i_width + align_pixels) & ~align_pixels;
- picture_Release(p_pic);
+ const vlc_chroma_description_t *p_dsc =
+ vlc_fourcc_GetChromaDescription( p_window->fmt.i_chroma );
+ if (p_dsc)
+ {
+ assert(p_dsc->pixel_size != 0);
+ // For RGB (32 or 16) we need to align on 8 or 4 pixels, 16 pixels for YUV
+ unsigned align_pixels = (16 / p_dsc->pixel_size) - 1;
+ p_window->fmt.i_width = (p_window->fmt.i_width + align_pixels) & ~align_pixels;
+ }
if (AndroidWindow_SetupANW(sys, p_window) != 0)
return -1;
More information about the vlc-commits
mailing list