# HG changeset patch # User reimar # Date 1346953931 0 # Node ID 08f284d173f6cedbcecd35998556bfa0242d8761 # Parent b371a630600cb5275fdc1e65cd17487d6874e3b7 Support -dr for -vo corevideo. It is recommended to be careful when using this together with shared buffer since it might result in a significant number of artefacts, depending on how the application reads the shared buffer. Patch by Xidorn Quan [quanxunzhen gmail com] diff -r b371a630600c -r 08f284d173f6 libvo/vo_corevideo.m --- a/libvo/vo_corevideo.m Wed Sep 05 17:02:41 2012 +0000 +++ b/libvo/vo_corevideo.m Thu Sep 06 17:52:11 2012 +0000 @@ -302,6 +302,7 @@ static uint32_t draw_image(mp_image_t *mpi) { + if (!(mpi->flags & MP_IMGFLAG_DIRECT)) memcpy_pic(image_data, mpi->planes[0], image_width*image_bytes, image_height, image_stride, mpi->stride[0]); return 0; @@ -337,6 +338,20 @@ return 0; } +static int get_image(mp_image_t *mpi) +{ + if (!(mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH)) || + (mpi->type != MP_IMGTYPE_TEMP && mpi->type != MP_IMGTYPE_STATIC)) + return VO_FALSE; + + // mpi should not be planar format here + mpi->planes[0] = image_data; + mpi->stride[0] = image_stride; + mpi->flags |= MP_IMGFLAG_DIRECT; + mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK; + return VO_TRUE; +} + static void uninit(void) { SetSystemUIMode( kUIModeNormal, 0); @@ -436,6 +451,7 @@ case VOCTRL_RESUME: return VO_TRUE; case VOCTRL_QUERY_FORMAT: return query_format(*(uint32_t*)data); + case VOCTRL_GET_IMAGE: return get_image(data); case VOCTRL_ONTOP: vo_ontop = !vo_ontop; if(!shared_buffer){ [mpGLView ontop]; } else { [mplayerosxProto ontop]; } return VO_TRUE; case VOCTRL_ROOTWIN: vo_rootwin = !vo_rootwin; [mpGLView rootwin]; return VO_TRUE; case VOCTRL_FULLSCREEN: vo_fs = !vo_fs; if(!shared_buffer){ [mpGLView fullscreen: NO]; } else { [mplayerosxProto toggleFullscreen]; } return VO_TRUE;