summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2013-05-29 23:21:14 +0200
committerMarton Balint <cus@passwd.hu>2013-06-01 12:50:46 +0200
commit30d724bdfde53ebe1cc7e714ba65e45f7ed38baa (patch)
tree11a0745e2d8177b128dc5a674074c4d198160787 /ffplay.c
parent87917a328320ce77992ed4d87d8825c7216f6f32 (diff)
ffplay: detect when the created overlay buffers are not valid for the wanted overlay height
Fixes cases when the picture height was bigger than the maximum supported overlay height... Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ffplay.c b/ffplay.c
index 125b7c27ee..03ee51e9ff 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1504,6 +1504,7 @@ display:
static void alloc_picture(VideoState *is)
{
VideoPicture *vp;
+ int64_t bufferdiff;
vp = &is->pictq[is->pictq_windex];
@@ -1515,7 +1516,8 @@ static void alloc_picture(VideoState *is)
vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height,
SDL_YV12_OVERLAY,
screen);
- if (!vp->bmp || vp->bmp->pitches[0] < vp->width) {
+ bufferdiff = vp->bmp ? FFMAX(vp->bmp->pixels[0], vp->bmp->pixels[1]) - FFMIN(vp->bmp->pixels[0], vp->bmp->pixels[1]) : 0;
+ if (!vp->bmp || vp->bmp->pitches[0] < vp->width || bufferdiff < vp->height * vp->bmp->pitches[0]) {
/* SDL allocates a buffer smaller than requested if the video
* overlay hardware is unable to support the requested size. */
fprintf(stderr, "Error: the video system does not support an image\n"