[MPlayer-cvslog] CVS: main/libvo vo_macosx.m, 1.14, 1.15 vo_macosx.h, 1.4, 1.5

Nicolas Plourde CVS syncmail at mplayerhq.hu
Wed Jun 15 16:48:37 CEST 2005


CVS change done by Nicolas Plourde CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv14978

Modified Files:
	vo_macosx.m vo_macosx.h 
Log Message:
do not realloc window while playing playlist

Index: vo_macosx.m
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_macosx.m,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- vo_macosx.m	5 Jun 2005 20:21:34 -0000	1.14
+++ vo_macosx.m	15 Jun 2005 14:48:33 -0000	1.15
@@ -134,21 +134,11 @@
 	movie_aspect = (float)d_width/(float)d_height;
 	old_movie_aspect = movie_aspect;
 	
-	//init OpenGL View
-	mpGLView = [[MPlayerOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, d_width, d_height) pixelFormat:[MPlayerOpenGLView defaultPixelFormat]];
-	[mpGLView initView];
-	
 	vo_fs = flags & VOFLAG_FULLSCREEN;
-	
-	if(vo_rootwin)
-		[mpGLView rootwin];	
-
-	if(vo_fs)
-		[mpGLView fullscreen: NO];
-	
-	if(vo_ontop)
-		[mpGLView ontop];
-	
+		
+	//config OpenGL View
+	[mpGLView config];
+		
 	return 0;
 }
 
@@ -255,7 +245,11 @@
 
 	NSApplicationLoad();
 	autoreleasepool = [[NSAutoreleasePool alloc] init];
-		
+	
+	mpGLView = [[MPlayerOpenGLView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0) pixelFormat:[MPlayerOpenGLView defaultPixelFormat]];
+	[mpGLView autorelease];
+	[mpGLView preinit];
+	
     return 0;
 }
 
@@ -279,30 +273,43 @@
 // NSOpenGLView Subclass
 //////////////////////////////////////////////////////////////////////////
 @implementation MPlayerOpenGLView
-- (void) initView
+- (id) preinit
 {
-	long swapInterval = 1;
-	NSRect frame = [self frame];
-	CVReturn error = kCVReturnSuccess;
-	
 	//init menu
 	[self initMenu];
 	
-	//create OpenGL Context
-	glContext = [[NSOpenGLContext alloc] initWithFormat:[NSOpenGLView defaultPixelFormat] shareContext:nil];	
-	
-	
 	//create window
-	window = [[NSWindow alloc]	initWithContentRect:NSMakeRect(0, 0, frame.size.width, frame.size.height) 
+	window = [[NSWindow alloc]	initWithContentRect:NSMakeRect(0, 0, 0, 0) 
 								styleMask:NSTitledWindowMask|NSTexturedBackgroundWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask
 								backing:NSBackingStoreBuffered defer:NO];
 
-	[window setDelegate:self];
-	[window setContentView:self];
-	[window setInitialFirstResponder:self];
+	[window autorelease];
+	[window setDelegate:mpGLView];
+	[window setContentView:mpGLView];
+	[window setInitialFirstResponder:mpGLView];
 	[window setAcceptsMouseMovedEvents:YES];
     [window setTitle:@"MPlayer - The Movie Player"];
-	[window center];	
+	
+	isFullscreen = 0;
+}
+
+- (id) config
+{
+	uint32_t d_width;
+	uint32_t d_height;
+	
+	long swapInterval = 1;
+	
+	NSRect frame;
+	CVReturn error = kCVReturnSuccess;
+	
+	aspect((int *)&d_width, (int *)&d_height,A_NOZOOM);
+	frame = NSMakeRect(0, 0, d_width, d_height);
+	[window setContentSize: frame.size];
+	
+	//create OpenGL Context
+	glContext = [[NSOpenGLContext alloc] initWithFormat:[NSOpenGLView defaultPixelFormat] shareContext:nil];	
+	[glContext autorelease];
 	
 	[self setOpenGLContext:glContext];
 	[glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
@@ -321,10 +328,18 @@
 	if(error != kCVReturnSuccess)
 		mp_msg(MSGT_VO, MSGL_ERR,"Failed to create OpenGL texture(%d)\n", error);
 	
-	//show window
-	[window makeKeyAndOrderFront:self];
+	if(vo_rootwin)
+		[mpGLView rootwin];	
+
+	if(vo_fs)
+		[mpGLView fullscreen: NO];
 	
-	isFullscreen = 0;
+	if(vo_ontop)
+		[mpGLView ontop];
+		
+	//show window
+	[window center];
+	[window makeKeyAndOrderFront:mpGLView];
 }
 
 /*

Index: vo_macosx.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_macosx.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- vo_macosx.h	2 Jun 2005 14:10:52 -0000	1.4
+++ vo_macosx.h	15 Jun 2005 14:48:33 -0000	1.5
@@ -49,7 +49,8 @@
 - (BOOL) resignFirstResponder;
 
 //window & rendering
-- (void) initView;
+- (id) preinit;
+- (id) config;
 - (void) prepareOpenGL;
 - (void) render;
 - (void) reshape;




More information about the MPlayer-cvslog mailing list