From 0fa8f6e6500ba42625e8136c8da5b36fce12627e Mon Sep 17 00:00:00 2001 From: Torsten Jager Date: Wed, 9 Apr 2014 16:50:00 +0200 Subject: Handle "no vo soft render space": enable vo_opengl2. Also, do proper blackfill to avoid dark green edges. --- src/video_out/video_out_opengl2.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_opengl2.c b/src/video_out/video_out_opengl2.c index 03ae3befe..dffee858a 100644 --- a/src/video_out/video_out_opengl2.c +++ b/src/video_out/video_out_opengl2.c @@ -1,7 +1,7 @@ /* * kate: space-indent on; indent-width 2; mixedindent off; indent-mode cstyle; remove-trailing-space on; - * Copyright (C) 20012 the xine project - * Copyright (C) 20012 Christophe Thommeret + * Copyright (C) 2012-2014 the xine project + * Copyright (C) 2012 Christophe Thommeret * * This file is part of xine, a free video player. * @@ -772,11 +772,30 @@ static void opengl2_update_frame_format( vo_driver_t *this_gen, vo_frame_t *fram frame->vo_frame.base[0] = av_mallocz (frame->vo_frame.pitches[0] * height); frame->vo_frame.base[1] = av_malloc (frame->vo_frame.pitches[1] * ((height+1)/2)); frame->vo_frame.base[2] = av_malloc (frame->vo_frame.pitches[2] * ((height+1)/2)); + if (!frame->vo_frame.base[0] || !frame->vo_frame.base[1] || !frame->vo_frame.base[2]) { + av_freep (&frame->vo_frame.base[0]); + av_freep (&frame->vo_frame.base[1]); + av_freep (&frame->vo_frame.base[2]); + frame->width = 0; + frame->vo_frame.width = 0; /* tell vo_get_frame () to retry later */ + return; + } memset (frame->vo_frame.base[1], 128, frame->vo_frame.pitches[1] * ((height+1)/2)); memset (frame->vo_frame.base[2], 128, frame->vo_frame.pitches[2] * ((height+1)/2)); } else if (format == XINE_IMGFMT_YUY2){ frame->vo_frame.pitches[0] = ((width + 15) & ~15) << 1; - frame->vo_frame.base[0] = av_mallocz (frame->vo_frame.pitches[0] * height); + frame->vo_frame.base[0] = av_malloc (frame->vo_frame.pitches[0] * height); + if (frame->vo_frame.base[0]) { + const union {uint8_t bytes[4]; uint32_t word;} black = {{0, 128, 0, 128}}; + uint32_t *q = (uint32_t *)frame->vo_frame.base[0]; + int i; + for (i = frame->vo_frame.pitches[0] * height / 4; i > 0; i--) + *q++ = black.word; + } else { + frame->width = 0; + frame->vo_frame.width = 0; /* tell vo_get_frame () to retry later */ + return; + } } frame->width = width; -- cgit v1.2.3