From: Petri H. <phi...@us...> - 2012-06-15 09:06:06
|
# HG changeset patch # User Petri Hintukainen <phi...@us...> # Date 1339748332 -10800 # Node ID 5da1bfebd95e5bd9b226525c03bc739b7bd92d2e # Branch default # Parent 7ba8ab5c2128ad3884cbfc1b453f4c33f1c3f3cb Check allocated Xv iamge size. Adjust frame size if allocated frame is smaller than requested. Based on patch from http://bugs.xine-project.org/show_bug.cgi?id=108 diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -100,6 +100,7 @@ unsigned int xv_pitches[3]; unsigned int xv_offsets[3]; + int req_width, req_height; } xv_frame_t; @@ -360,8 +361,8 @@ width = (width + 7) & ~0x7; } - if ((frame->width != width) - || (frame->height != height) + if ((frame->req_width != width) + || (frame->req_height != height) || (frame->format != format)) { /* printf ("video_out_xcbxv: updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */ @@ -390,13 +391,21 @@ frame->vo_frame.base[2] = frame->image + frame->xv_offsets[1]; } - frame->width = width; - frame->height = height; + /* allocated frame size may not match requested size */ + frame->req_width = width; + frame->req_height = height; + frame->width = frame->xv_width; + frame->height = frame->xv_height; frame->format = format; pthread_mutex_unlock(&this->main_mutex); } + if (frame->vo_frame.width > frame->width) + frame->vo_frame.width = frame->width; + if (frame->vo_frame.height > frame->height) + frame->vo_frame.height = frame->height; + frame->ratio = ratio; } --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -103,6 +103,7 @@ XvImage *image; XShmSegmentInfo shminfo; + int req_width, req_height; } xv_frame_t; @@ -444,8 +445,8 @@ width = (width + 7) & ~0x7; } - if ((frame->width != width) - || (frame->height != height) + if ((frame->req_width != width) + || (frame->req_height != height) || (frame->format != format)) { /* printf ("video_out_xv: updating frame to %d x %d (ratio=%d, format=%08x)\n",width,height,ratio_code,format); */ @@ -476,13 +477,21 @@ frame->vo_frame.base[2] = frame->image->data + frame->image->offsets[1]; } - frame->width = width; - frame->height = height; + /* allocated frame size may not match requested size */ + frame->req_width = width; + frame->req_height = height; + frame->width = frame->image->width; + frame->height = frame->image->height; frame->format = format; UNLOCK_DISPLAY(this); } + if (frame->vo_frame.width > frame->width) + frame->vo_frame.width = frame->width; + if (frame->vo_frame.height > frame->height) + frame->vo_frame.height = frame->height; + frame->ratio = ratio; } |