From a8a98ee6d12e41d47d03ddf27ad402b30fd2544b Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 5 Apr 2010 07:15:22 +0000 Subject: Implement VOCTRL_DRAW_IMAGE instead of the deprecated draw_frame, avoiding an extra memcpy in case of stride mismatch. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31014 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_corevideo.m | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'libvo/vo_corevideo.m') diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index 6a62a08ef6..1e16366225 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -287,17 +287,12 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) 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 @@ static int control(uint32_t request, void *data, ...) { 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)); -- cgit v1.2.3 From c0b8b92d99b1425944048f949e54b83aec68ea69 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 5 Apr 2010 07:22:21 +0000 Subject: Enable OSD also for BGR32, the code is the same as for RGB32. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31015 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_corevideo.m | 1 + 1 file changed, 1 insertion(+) (limited to 'libvo/vo_corevideo.m') diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index 1e16366225..49f472c630 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -104,6 +104,7 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigne { switch (image_format) { + case IMGFMT_BGR32: case IMGFMT_RGB32: vo_draw_alpha_rgb32(w,h,src,srca,stride,image_data+4*(y0*image_width+x0),4*image_width); break; -- cgit v1.2.3 From a55acacbdadd513f00bcf2985256dde68c379885 Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 5 Apr 2010 13:11:06 +0000 Subject: 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, git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31016 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_corevideo.m | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'libvo/vo_corevideo.m') diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index 49f472c630..94bd1964b1 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -104,8 +104,11 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigne { 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 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ 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 uint32_t draw_image(mp_image_t *mpi) 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_RGB32: - case IMGFMT_BGR32: + case IMGFMT_RGB24: + pixelFormat = k24RGBPixelFormat; + return supportflags; + + 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; } -- cgit v1.2.3