}
- (void)setVoutDisplay:(vout_display_t *)vd;
@end
-
+
struct vout_display_sys_t
{
vout_opengl_t gl;
vout_display_opengl_t vgl;
-
+
picture_pool_t *pool;
picture_t *current;
bool has_first_frame;
vd->sys = sys;
sys->pool = NULL;
sys->gl.sys = NULL;
-
+
/* Get the drawable object */
id container = var_CreateGetAddress(vd, "drawable-nsobject");
if (!container)
/* Get our main view*/
nsPool = [[NSAutoreleasePool alloc] init];
-
+
[VLCOpenGLVideoView performSelectorOnMainThread:@selector(getNewView:) withObject:[NSValue valueWithPointer:&sys->glView] waitUntilDone:YES];
if (!sys->glView)
goto error;
sys->gl.unlock = OpenglUnlock;
sys->gl.swap = OpenglSwap;
sys->gl.sys = sys;
-
+
if (vout_display_opengl_Init(&sys->vgl, &vd->fmt, &sys->gl))
{
sys->gl.sys = NULL;
/* */
vout_display_info_t info = vd->info;
info.has_pictures_invalid = false;
-
+
/* Setup vout_display_t once everything is fine */
vd->info = info;
-
+
vd->pool = Pool;
vd->prepare = PictureRender;
vd->display = PictureDisplay;
/* release on main thread as explained in Open() */
[(id)sys->container performSelectorOnMainThread:@selector(release) withObject:nil waitUntilDone:NO];
[sys->glView performSelectorOnMainThread:@selector(removeFromSuperview) withObject:nil waitUntilDone:NO];
-
+
[sys->glView release];
if (sys->gl.sys != NULL)
{
vout_display_sys_t *sys = vd->sys;
-
+
vout_display_opengl_Prepare( &sys->vgl, pic );
}
static int Control (vout_display_t *vd, int query, va_list ap)
{
vout_display_sys_t *sys = vd->sys;
-
+
switch (query)
{
- case VOUT_DISPLAY_CHANGE_FULLSCREEN:
+ case VOUT_DISPLAY_CHANGE_FULLSCREEN:
case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
}
case VOUT_DISPLAY_HIDE_MOUSE:
return VLC_SUCCESS;
-
+
case VOUT_DISPLAY_GET_OPENGL:
{
vout_opengl_t **gl = va_arg (ap, vout_opengl_t **);
*gl = &sys->gl;
return VLC_SUCCESS;
}
-
+
case VOUT_DISPLAY_RESET_PICTURES:
assert (0);
default:
msg_Err (vd, "Unknown request in Mac OS X vout display");
return VLC_EGENERIC;
}
- printf("query %d\n", query);
}
/*****************************************************************************
[context makeCurrentContext];
return 0;
}
- return 1;
+ return 1;
}
static void OpenglUnlock(vout_opengl_t *gl)
NSOpenGLPFAWindow,
0
};
-
+
NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
-
+
if (!fmt)
return nil;
else {
glClear(GL_COLOR_BUFFER_BIT);
}
-
- }
+
+ }
}
/**
- (void)reshape
{
VLCAssertMainThread();
-
+
NSRect bounds = [self bounds];
CGFloat height = bounds.size.height;
if (vd) {
CGFloat videoHeight = vd->source.i_visible_height;
CGFloat videoWidth = vd->source.i_visible_width;
-
+
GLint sarNum = vd->source.i_sar_num;
GLint sarDen = vd->source.i_sar_den;
-
+
if (height * videoWidth * sarNum < width * videoHeight * sarDen)
{
x = (height * videoWidth * sarNum) / (videoHeight * sarDen);
{
x = width;
y = (width * videoHeight * sarDen) / (videoWidth * sarNum);
- }
+ }
}
}
-
+
[self lockgl];
glClearColor(0, 0, 0, 1);
glViewport((width - x) / 2, (height - y) / 2, x, y);