changeset 30972:886527159cae

Implement VOCTRL_DRAW_IMAGE instead of the deprecated draw_frame, avoiding an extra memcpy in case of stride mismatch.
author reimar
date Mon, 05 Apr 2010 07:15:22 +0000
parents 9d024ceb45e3
children 2490e6b689e6
files libvo/vo_corevideo.m
diffstat 1 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_corevideo.m	Sun Apr 04 19:56:26 2010 +0000
+++ b/libvo/vo_corevideo.m	Mon Apr 05 07:15:22 2010 +0000
@@ -287,17 +287,12 @@
 
 static int draw_frame(uint8_t *src[])
 {
-	switch (image_format)
-	{
-		case IMGFMT_BGR32:
-		case IMGFMT_RGB32:
-			fast_memcpy(image_data, src[0], image_width*image_height*image_bytes);
-			break;
+	return 0;
+}
 
-		case IMGFMT_YUY2:
-			memcpy_pic(image_data, src[0], image_width * 2, image_height, image_width * 2, image_width * 2);
-			break;
-	}
+static uint32_t draw_image(mp_image_t *mpi)
+{
+	memcpy_pic(image_data, mpi->planes[0], image_width*image_bytes, image_height, image_width*image_bytes, mpi->stride[0]);
 
 	return 0;
 }
@@ -405,6 +400,7 @@
 {
 	switch (request)
 	{
+		case VOCTRL_DRAW_IMAGE: return draw_image(data);
 		case VOCTRL_PAUSE: return int_pause = 1;
 		case VOCTRL_RESUME: return int_pause = 0;
 		case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data));