changeset 23676:f3cb35ec74c3

bugfix intel mac vo_quartz, PlanarPixmapInfoYUV420 structure requires big-endian value. author Taihei Monma tmkk@mac.com
author nplourde
date Fri, 29 Jun 2007 21:57:31 +0000
parents c056ed2819e8
children ede2719f604f
files libvo/vo_quartz.c
diffstat 1 files changed, 19 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- 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;
 		}