# HG changeset patch # User ulion # Date 1196208095 0 # Node ID cf3b6015735d43d67dc8b2fdfef02fb15f9f05ae # Parent 512f2958dc1bce7bcaf0e3909e4ccdcab27a8ae8 Set protocol for the vo proxy used in shared-buffer mode. NOTE: You have to update your mplayerosx to svn r148 or newer to work with it. This change will speed up vo proxy and fix all these warnings: vo_macosx.m: In function 'config': vo_macosx.m:165: warning: 'NSProxy' may not respond to '-startWithWidth:withHeight:withBytes:withAspect:' vo_macosx.m:165: warning: (Messages without a matching method signature vo_macosx.m:165: warning: will be assumed to return 'id' and accept vo_macosx.m:165: warning: '...' as arguments.) vo_macosx.m: In function 'flip_page': vo_macosx.m:183: warning: 'NSProxy' may not respond to '-render' vo_macosx.m: In function 'uninit': vo_macosx.m:235: warning: 'NSProxy' may not respond to '-stop' vo_macosx.m: In function 'control': vo_macosx.m:334: warning: 'NSProxy' may not respond to '-ontop' vo_macosx.m:336: warning: 'NSProxy' may not respond to '-toggleFullscreen' diff -r 512f2958dc1b -r cf3b6015735d libvo/vo_macosx.h --- a/libvo/vo_macosx.h Tue Nov 27 21:31:47 2007 +0000 +++ b/libvo/vo_macosx.h Wed Nov 28 00:01:35 2007 +0000 @@ -12,6 +12,18 @@ #import #import +// MPlayer OS X VO Protocol +@protocol MPlayerOSXVOProto +- (int) startWithWidth: (bycopy int)width + withHeight: (bycopy int)height + withBytes: (bycopy int)bytes + withAspect: (bycopy int)aspect; +- (void) stop; +- (void) render; +- (void) toggleFullscreen; +- (void) ontop; +@end + @interface MPlayerOpenGLView : NSOpenGLView { //Cocoa diff -r 512f2958dc1b -r cf3b6015735d libvo/vo_macosx.m --- a/libvo/vo_macosx.m Tue Nov 27 21:31:47 2007 +0000 +++ b/libvo/vo_macosx.m Wed Nov 28 00:01:35 2007 +0000 @@ -26,7 +26,8 @@ #include "osdep/keycodes.h" //Cocoa -NSProxy *mplayerosxProxy; +NSDistantObject *mplayerosxProxy; +id mplayerosxProto; MPlayerOpenGLView *mpGLView; NSAutoreleasePool *autoreleasepool; OSType pixelFormat; @@ -162,7 +163,16 @@ //connnect to mplayerosx mplayerosxProxy=[NSConnection rootProxyForConnectionWithRegisteredName:@"mplayerosx" host:nil]; - [mplayerosxProxy startWithWidth: image_width withHeight: image_height withBytes: image_bytes withAspect:(int)(movie_aspect*100)]; + if ([mplayerosxProxy conformsToProtocol:@protocol(MPlayerOSXVOProto)]) { + [mplayerosxProxy setProtocolForProxy:@protocol(MPlayerOSXVOProto)]; + mplayerosxProto = (id )mplayerosxProxy; + [mplayerosxProto startWithWidth: image_width withHeight: image_height withBytes: image_bytes withAspect:(int)(movie_aspect*100)]; + } + else { + [mplayerosxProxy release]; + mplayerosxProxy = nil; + mplayerosxProto = nil; + } } return 0; } @@ -180,7 +190,7 @@ static void flip_page(void) { if(shared_buffer) - [mplayerosxProxy render]; + [mplayerosxProto render]; else { [mpGLView setCurrentTexture]; [mpGLView render]; @@ -232,7 +242,10 @@ { if(shared_buffer) { - [mplayerosxProxy stop]; + [mplayerosxProto stop]; + mplayerosxProto = nil; + [mplayerosxProxy release]; + mplayerosxProxy = nil; if (shmdt(image_data) == -1) mp_msg(MSGT_VO, MSGL_FATAL, "uninit: shmdt failed\n"); @@ -331,9 +344,9 @@ case VOCTRL_PAUSE: return (int_pause=1); case VOCTRL_RESUME: return (int_pause=0); case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); - case VOCTRL_ONTOP: vo_ontop = (!(vo_ontop)); if(!shared_buffer){ [mpGLView ontop]; } else { [mplayerosxProxy ontop]; } return VO_TRUE; + 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 { [mplayerosxProxy toggleFullscreen]; } return VO_TRUE; + case VOCTRL_FULLSCREEN: vo_fs = (!(vo_fs)); if(!shared_buffer){ [mpGLView fullscreen: NO]; } else { [mplayerosxProto toggleFullscreen]; } return VO_TRUE; case VOCTRL_GET_PANSCAN: return VO_TRUE; case VOCTRL_SET_PANSCAN: [mpGLView panscan]; return VO_TRUE; }