[MPlayer-cvslog] r25185 - in trunk/libvo: vo_macosx.h vo_macosx.m

ulion subversion at mplayerhq.hu
Wed Nov 28 01:01:37 CET 2007


Author: ulion
Date: Wed Nov 28 01:01:35 2007
New Revision: 25185

Log:
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'


Modified:
   trunk/libvo/vo_macosx.h
   trunk/libvo/vo_macosx.m

Modified: trunk/libvo/vo_macosx.h
==============================================================================
--- trunk/libvo/vo_macosx.h	(original)
+++ trunk/libvo/vo_macosx.h	Wed Nov 28 01:01:35 2007
@@ -12,6 +12,18 @@
 #import <QuartzCore/QuartzCore.h>
 #import <QuickTime/QuickTime.h>
 
+// MPlayer OS X VO Protocol
+ at 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;
+ at end
+
 @interface MPlayerOpenGLView : NSOpenGLView
 {
 	//Cocoa

Modified: trunk/libvo/vo_macosx.m
==============================================================================
--- trunk/libvo/vo_macosx.m	(original)
+++ trunk/libvo/vo_macosx.m	Wed Nov 28 01:01:35 2007
@@ -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
 		
 		//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, voi
 		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;
 	}



More information about the MPlayer-cvslog mailing list