changeset 30974:bd964ca1f6fa

Fix RGB support for corevideo: corevideo can only support ARGB and BGRA, which depending on endianness matches only one of RGB32 and BGR32. Also add RGB24 support which works independent of endianness,
author reimar
date Mon, 05 Apr 2010 13:11:06 +0000
parents 2490e6b689e6
children 72e4e8f983f9
files libvo/vo_corevideo.m
diffstat 1 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_corevideo.m	Mon Apr 05 07:22:21 2010 +0000
+++ b/libvo/vo_corevideo.m	Mon Apr 05 13:11:06 2010 +0000
@@ -104,8 +104,11 @@
 {
 	switch (image_format)
 	{
-		case IMGFMT_BGR32:
-		case IMGFMT_RGB32:
+		case IMGFMT_RGB24:
+			vo_draw_alpha_rgb24(w,h,src,srca,stride,image_data+3*(y0*image_width+x0),3*image_width);
+			break;
+		case IMGFMT_ARGB:
+		case IMGFMT_BGRA:
 			vo_draw_alpha_rgb32(w,h,src,srca,stride,image_data+4*(y0*image_width+x0),4*image_width);
 			break;
 		case IMGFMT_YUY2:
@@ -171,8 +174,11 @@
 	image_height = height;
 	switch (image_format)
 	{
-		case IMGFMT_BGR32:
-		case IMGFMT_RGB32:
+		case IMGFMT_RGB24:
+			image_depth = 24;
+			break;
+		case IMGFMT_ARGB:
+		case IMGFMT_BGRA:
 			image_depth = 32;
 			break;
 		case IMGFMT_YUY2:
@@ -300,18 +306,26 @@
 
 static int query_format(uint32_t format)
 {
+    const int supportflags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
 	image_format = format;
 
     switch(format)
 	{
 		case IMGFMT_YUY2:
 			pixelFormat = kYUVSPixelFormat;
-			return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
+			return supportflags;
+
+		case IMGFMT_RGB24:
+			pixelFormat = k24RGBPixelFormat;
+			return supportflags;
 
-		case IMGFMT_RGB32:
-		case IMGFMT_BGR32:
+		case IMGFMT_ARGB:
 			pixelFormat = k32ARGBPixelFormat;
-			return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_OSD | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN;
+			return supportflags;
+
+		case IMGFMT_BGRA:
+			pixelFormat = k32BGRAPixelFormat;
+			return supportflags;
     }
     return 0;
 }