# HG changeset patch # User nplourde # Date 1183154251 0 # Node ID f3cb35ec74c3a53aaf37cee32f5a391ee3c00e74 # Parent c056ed2819e8c169c958a16c6247569ca5802b8a bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com diff -r c056ed2819e8 -r f3cb35ec74c3 libvo/vo_quartz.c --- a/libvo/vo_quartz.c Fri Jun 29 21:21:57 2007 +0000 +++ b/libvo/vo_quartz.c Fri Jun 29 21:57:31 2007 +0000 @@ -31,6 +31,7 @@ #include "mp_msg.h" #include "m_option.h" #include "mp_fifo.h" +#include "mpbswap.h" #include "input/input.h" #include "input/mouse.h" @@ -203,7 +204,7 @@ case IMGFMT_YV12: case IMGFMT_IYUV: case IMGFMT_I420: - vo_draw_alpha_yv12(w,h,src,srca,stride, ((char*)P) + P->componentInfoY.offset + x0 + y0 * imgRect.right, imgRect.right); + vo_draw_alpha_yv12(w,h,src,srca,stride, ((char*)P) + be2me_32(P->componentInfoY.offset) + x0 + y0 * imgRect.right, imgRect.right); break; case IMGFMT_UYVY: vo_draw_alpha_uyvy(w,h,src,srca,stride,((char*)P) + (x0 + y0 * imgRect.right) * 2,imgRect.right*2); @@ -812,12 +813,12 @@ case IMGFMT_YV12: case IMGFMT_IYUV: case IMGFMT_I420: - P->componentInfoY.offset = sizeof(PlanarPixmapInfoYUV420); - P->componentInfoCb.offset = P->componentInfoY.offset + image_size / 2; - P->componentInfoCr.offset = P->componentInfoCb.offset + image_size / 4; - P->componentInfoY.rowBytes = imgRect.right; - P->componentInfoCb.rowBytes = imgRect.right / 2; - P->componentInfoCr.rowBytes = imgRect.right / 2; + P->componentInfoY.offset = be2me_32(sizeof(PlanarPixmapInfoYUV420)); + P->componentInfoCb.offset = be2me_32(be2me_32(P->componentInfoY.offset) + image_size / 2); + P->componentInfoCr.offset = be2me_32(be2me_32(P->componentInfoCb.offset) + image_size / 4); + P->componentInfoY.rowBytes = be2me_32(imgRect.right); + P->componentInfoCb.rowBytes = be2me_32(imgRect.right / 2); + P->componentInfoCr.rowBytes = be2me_32(imgRect.right / 2); image_buffer_size = image_size + sizeof(PlanarPixmapInfoYUV420); break; case IMGFMT_UYVY: @@ -998,19 +999,19 @@ { case IMGFMT_YV12: case IMGFMT_I420: - memcpy_pic(((char*)P) + P->componentInfoY.offset + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); + memcpy_pic(((char*)P) + be2me_32(P->componentInfoY.offset) + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); x=x/2;y=y/2;w=w/2;h=h/2; - memcpy_pic(((char*)P) + P->componentInfoCb.offset + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); - memcpy_pic(((char*)P) + P->componentInfoCr.offset + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); + memcpy_pic(((char*)P) + be2me_32(P->componentInfoCb.offset) + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); + memcpy_pic(((char*)P) + be2me_32(P->componentInfoCr.offset) + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); return 0; case IMGFMT_IYUV: - memcpy_pic(((char*)P) + P->componentInfoY.offset + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); + memcpy_pic(((char*)P) + be2me_32(P->componentInfoY.offset) + x + imgRect.right * y, src[0], w, h, imgRect.right, stride[0]); x=x/2;y=y/2;w=w/2;h=h/2; - memcpy_pic(((char*)P) + P->componentInfoCr.offset + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); - memcpy_pic(((char*)P) + P->componentInfoCb.offset + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); + memcpy_pic(((char*)P) + be2me_32(P->componentInfoCr.offset) + x + imgRect.right / 2 * y, src[1], w, h, imgRect.right / 2, stride[1]); + memcpy_pic(((char*)P) + be2me_32(P->componentInfoCb.offset) + x + imgRect.right / 2 * y, src[2], w, h, imgRect.right / 2, stride[2]); return 0; } return -1; @@ -1164,23 +1165,23 @@ return VO_FALSE; } - mpi->planes[0]=((char*)P) + P->componentInfoY.offset; + mpi->planes[0]=((char*)P) + be2me_32(P->componentInfoY.offset); mpi->stride[0]=imgRect.right; mpi->width=imgRect.right; if(mpi->flags&MP_IMGFLAG_SWAPPED) { // I420 - mpi->planes[1]=((char*)P) + P->componentInfoCb.offset; - mpi->planes[2]=((char*)P) + P->componentInfoCr.offset; + mpi->planes[1]=((char*)P) + be2me_32(P->componentInfoCb.offset); + mpi->planes[2]=((char*)P) + be2me_32(P->componentInfoCr.offset); mpi->stride[1]=imgRect.right/2; mpi->stride[2]=imgRect.right/2; } else { // YV12 - mpi->planes[1]=((char*)P) + P->componentInfoCr.offset; - mpi->planes[2]=((char*)P) + P->componentInfoCb.offset; + mpi->planes[1]=((char*)P) + be2me_32(P->componentInfoCr.offset); + mpi->planes[2]=((char*)P) + be2me_32(P->componentInfoCb.offset); mpi->stride[1]=imgRect.right/2; mpi->stride[2]=imgRect.right/2; }