* Copyright (C) 2001-2013 VLC authors and VideoLAN
* $Id$
*
- * Authors: Derk-Jan Hartman <hartman at videolan dot org>
- * Eric Petit <titer@m0k.org>
- * Benjamin Pracht <bigben at videolan dot org>
- * Damien Fouilleul <damienf at videolan dot org>
- * Pierre d'Herbemont <pdherbemont at videolan dot org>
+ * Authors: Pierre d'Herbemont <pdherbemont at videolan dot org>
* Felix Paul Kühne <fkuehne at videolan dot org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
* Rémi Denis-Courmont
- * Juho Vähä-Herttua <juhovh at iki dot fi>
* Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
+ * Eric Petit <titer@m0k.org>
+ *
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
/**
* Forward declarations
*/
-static int Open (vlc_object_t *);
-static void Close (vlc_object_t *);
+static int Open(vlc_object_t *);
+static void Close(vlc_object_t *);
static picture_pool_t* PicturePool(vout_display_t *vd, unsigned requested_count);
static void PictureRender(vout_display_t* vd, picture_t *pic, subpicture_t *subpicture);
* Module declaration
*/
vlc_module_begin ()
- set_shortname ("iOS vout")
- set_description (N_("iOS OpenGL video output"))
- set_category (CAT_VIDEO)
- set_subcategory (SUBCAT_VIDEO_VOUT)
- set_capability ("vout display", 300)
- set_callbacks (Open, Close)
-
- add_shortcut ("vout_ios2")
+ set_shortname("iOS vout")
+ set_description(N_("iOS OpenGL video output"))
+ set_category(CAT_VIDEO)
+ set_subcategory(SUBCAT_VIDEO_VOUT)
+ set_capability("vout display", 300)
+ set_callbacks(Open, Close)
+
+ add_shortcut("vout_ios2")
vlc_module_end ()
-@interface VLCOpenGLES2VideoView : UIView
-{
+@interface VLCOpenGLES2VideoView : UIView {
vout_display_t *_voutDisplay;
EAGLContext *_eaglContext;
GLuint _renderBuffer;
- (void)createBuffers;
- (void)destroyBuffers;
- (void)resetBuffers;
-
@end
-
struct vout_display_sys_t
{
VLCOpenGLES2VideoView *glESView;
vout_display_opengl_t *vgl;
picture_pool_t *picturePool;
- picture_t *current;
bool has_first_frame;
vout_display_place_t place;
};
-
static void *OurGetProcAddress(vlc_gl_t *gl, const char *name)
{
VLC_UNUSED(gl);
{
vout_display_sys_t *sys = vd->sys;
- switch (query)
- {
+ switch (query) {
case VOUT_DISPLAY_CHANGE_FULLSCREEN:
case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
case VOUT_DISPLAY_HIDE_MOUSE:
{
vout_display_sys_t *sys = vd->sys;
sys->has_first_frame = true;
- if ([sys->glESView isAppActive])
+ if (likely([sys->glESView isAppActive]))
vout_display_opengl_Display(sys->vgl, &vd->source);
picture_Release(pic);
static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
{
-
vout_display_sys_t *sys = vd->sys;
- if ([sys->glESView isAppActive])
+ if (likely([sys->glESView isAppActive]))
vout_display_opengl_Prepare(sys->vgl, pic, subpicture);
}
static int OpenglESClean(vlc_gl_t *gl)
{
vout_display_sys_t *sys = (vout_display_sys_t *)gl->sys;
- [sys->glESView resetBuffers];
+ if (likely([sys->glESView isAppActive]))
+ [sys->glESView resetBuffers];
return 0;
}
static void OpenglESSwap(vlc_gl_t *gl)
{
vout_display_sys_t *sys = (vout_display_sys_t *)gl->sys;
- if ([sys->glESView isAppActive])
+ if (likely([sys->glESView isAppActive]))
[[sys->glESView eaglContext] presentRenderbuffer:GL_RENDERBUFFER];
}
- (void)dealloc
{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
[_eaglContext release];
[super dealloc];
}
-/* we don't get the correct scale factor if we don't overwrite this method */
-- (void)drawRect:(CGRect) rect
+- (void)didMoveToWindow
{
- [super drawRect:rect];
+ self.contentScaleFactor = self.window.screen.scale;
+ _bufferNeedReset = YES;
}
- (void)createBuffers
- (void)resetBuffers
{
if (_bufferNeedReset) {
- NSLog(@"actually resetting buffers");
[self destroyBuffers];
[self createBuffers];
_bufferNeedReset = NO;
- (void)layoutSubviews
{
- NSLog(@"layoutSubviews");
/* this method is called as soon as we are resized.
* so set a variable to re-create our buffers on the next clean event */
_bufferNeedReset = YES;