diff options
author | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-28 00:01:35 +0000 |
---|---|---|
committer | ulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-11-28 00:01:35 +0000 |
commit | e3c9524d66036b0267beb23658fda920f5973c75 (patch) | |
tree | b92a6d48755ad0e591418234c0efeeb0c608453f | |
parent | 8e18e416381c546fa77eba30ce15d3dfa2e9a4f3 (diff) | |
download | mpv-e3c9524d66036b0267beb23658fda920f5973c75.tar.bz2 mpv-e3c9524d66036b0267beb23658fda920f5973c75.tar.xz |
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'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25185 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libvo/vo_macosx.h | 12 | ||||
-rw-r--r-- | libvo/vo_macosx.m | 25 |
2 files changed, 31 insertions, 6 deletions
diff --git a/libvo/vo_macosx.h b/libvo/vo_macosx.h index 04a2381e54..a4c7c8266b 100644 --- a/libvo/vo_macosx.h +++ b/libvo/vo_macosx.h @@ -12,6 +12,18 @@ #import <QuartzCore/QuartzCore.h> #import <QuickTime/QuickTime.h> +// 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 --git a/libvo/vo_macosx.m b/libvo/vo_macosx.m index 90f179fa7a..fdaa1ca41e 100644 --- a/libvo/vo_macosx.m +++ b/libvo/vo_macosx.m @@ -26,7 +26,8 @@ #include "osdep/keycodes.h" //Cocoa -NSProxy *mplayerosxProxy; +NSDistantObject *mplayerosxProxy; +id <MPlayerOSXVOProto> mplayerosxProto; MPlayerOpenGLView *mpGLView; NSAutoreleasePool *autoreleasepool; OSType pixelFormat; @@ -162,7 +163,16 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_ //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 <MPlayerOSXVOProto>)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 draw_osd(void) static void flip_page(void) { if(shared_buffer) - [mplayerosxProxy render]; + [mplayerosxProto render]; else { [mpGLView setCurrentTexture]; [mpGLView render]; @@ -232,7 +242,10 @@ static void uninit(void) { 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 @@ static int control(uint32_t request, void *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)); - 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; } |