summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_opengl2.c25
1 files changed, 22 insertions, 3 deletions
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 <hftom@free.fr>
+ * Copyright (C) 2012-2014 the xine project
+ * Copyright (C) 2012 Christophe Thommeret <hftom@free.fr>
*
* 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;