Commit 88780e11 authored by Laurent Aimar's avatar Laurent Aimar

Made vout_display_opengl_t private.

parent 90ed2da4
...@@ -82,7 +82,7 @@ vlc_module_end () ...@@ -82,7 +82,7 @@ vlc_module_end ()
struct vout_display_sys_t struct vout_display_sys_t
{ {
vout_display_opengl_t vgl; vout_display_opengl_t *vgl;
vout_window_t *window; vout_window_t *window;
vlc_gl_t *gl; vlc_gl_t *gl;
...@@ -137,7 +137,8 @@ static int Open (vlc_object_t *obj) ...@@ -137,7 +137,8 @@ static int Open (vlc_object_t *obj)
goto error; goto error;
/* Initialize video display */ /* Initialize video display */
if (vout_display_opengl_Init (&sys->vgl, &vd->fmt, sys->gl)) sys->vgl = vout_display_opengl_New (&vd->fmt, sys->gl);
if (!sys->vgl)
goto error; goto error;
vd->sys = sys; vd->sys = sys;
...@@ -167,7 +168,7 @@ static void Close (vlc_object_t *obj) ...@@ -167,7 +168,7 @@ static void Close (vlc_object_t *obj)
vout_display_t *vd = (vout_display_t *)obj; vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Clean (&sys->vgl); vout_display_opengl_Delete (sys->vgl);
vlc_gl_Destroy (sys->gl); vlc_gl_Destroy (sys->gl);
vout_display_DeleteWindow (vd, sys->window); vout_display_DeleteWindow (vd, sys->window);
free (sys); free (sys);
...@@ -181,7 +182,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned count) ...@@ -181,7 +182,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned count)
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
if (!sys->pool) if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl); sys->pool = vout_display_opengl_GetPool (sys->vgl);
(void) count; (void) count;
return sys->pool; return sys->pool;
} }
...@@ -190,7 +191,7 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub ...@@ -190,7 +191,7 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Prepare (&sys->vgl, pic); vout_display_opengl_Prepare (sys->vgl, pic);
(void)subpicture; (void)subpicture;
} }
...@@ -198,7 +199,7 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *su ...@@ -198,7 +199,7 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *su
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Display (&sys->vgl, &vd->source); vout_display_opengl_Display (sys->vgl, &vd->source);
picture_Release (pic); picture_Release (pic);
(void)subpicture; (void)subpicture;
} }
......
...@@ -94,7 +94,7 @@ struct vout_display_sys_t ...@@ -94,7 +94,7 @@ struct vout_display_sys_t
UIView * container; UIView * container;
vlc_gl_t gl; vlc_gl_t gl;
vout_display_opengl_t vgl; vout_display_opengl_t *vgl;
picture_pool_t *pool; picture_pool_t *pool;
picture_t *current; picture_t *current;
...@@ -151,7 +151,8 @@ static int Open(vlc_object_t *this) ...@@ -151,7 +151,8 @@ static int Open(vlc_object_t *this)
sys->gl.getProcAddress = NULL; sys->gl.getProcAddress = NULL;
sys->gl.sys = sys; sys->gl.sys = sys;
if (vout_display_opengl_Init(&sys->vgl, &vd->fmt, &sys->gl)) sys->vgl = vout_display_opengl_New(&vd->fmt, &sys->gl);
if (!sys->vgl)
{ {
sys->gl.sys = NULL; sys->gl.sys = NULL;
goto error; goto error;
...@@ -197,7 +198,7 @@ void Close(vlc_object_t *this) ...@@ -197,7 +198,7 @@ void Close(vlc_object_t *this)
[sys->glView release]; [sys->glView release];
if (sys->gl.sys != NULL) if (sys->gl.sys != NULL)
vout_display_opengl_Clean(&sys->vgl); vout_display_opengl_Delete(sys->vgl);
free (sys); free (sys);
} }
...@@ -212,7 +213,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned requested_count) ...@@ -212,7 +213,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned requested_count)
VLC_UNUSED(requested_count); VLC_UNUSED(requested_count);
if (!sys->pool) if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl); sys->pool = vout_display_opengl_GetPool (sys->vgl);
assert(sys->pool); assert(sys->pool);
return sys->pool; return sys->pool;
} }
...@@ -221,14 +222,14 @@ static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subp ...@@ -221,14 +222,14 @@ static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subp
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Prepare( &sys->vgl, pic ); vout_display_opengl_Prepare( sys->vgl, pic );
(void)subpicture; (void)subpicture;
} }
static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture) static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Display(&sys->vgl, &vd->fmt ); vout_display_opengl_Display(sys->vgl, &vd->fmt );
picture_Release (pic); picture_Release (pic);
sys->has_first_frame = true; sys->has_first_frame = true;
(void)subpicture; (void)subpicture;
......
...@@ -100,7 +100,7 @@ struct vout_display_sys_t ...@@ -100,7 +100,7 @@ struct vout_display_sys_t
vout_window_t *embed; vout_window_t *embed;
vlc_gl_t gl; vlc_gl_t gl;
vout_display_opengl_t vgl; vout_display_opengl_t *vgl;
picture_pool_t *pool; picture_pool_t *pool;
picture_t *current; picture_t *current;
...@@ -190,7 +190,8 @@ static int Open(vlc_object_t *this) ...@@ -190,7 +190,8 @@ static int Open(vlc_object_t *this)
sys->gl.getProcAddress = NULL; sys->gl.getProcAddress = NULL;
sys->gl.sys = sys; sys->gl.sys = sys;
if (vout_display_opengl_Init(&sys->vgl, &vd->fmt, &sys->gl)) sys->vgl = vout_display_opengl_New(&vd->fmt, &sys->gl);
if (!sys->vgl)
{ {
sys->gl.sys = NULL; sys->gl.sys = NULL;
goto error; goto error;
...@@ -240,7 +241,7 @@ void Close(vlc_object_t *this) ...@@ -240,7 +241,7 @@ void Close(vlc_object_t *this)
[sys->glView release]; [sys->glView release];
if (sys->gl.sys != NULL) if (sys->gl.sys != NULL)
vout_display_opengl_Clean(&sys->vgl); vout_display_opengl_Delete(sys->vgl);
if (sys->embed) if (sys->embed)
vout_display_DeleteWindow(vd, sys->embed); vout_display_DeleteWindow(vd, sys->embed);
...@@ -257,7 +258,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned requested_count) ...@@ -257,7 +258,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned requested_count)
VLC_UNUSED(requested_count); VLC_UNUSED(requested_count);
if (!sys->pool) if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl); sys->pool = vout_display_opengl_GetPool (sys->vgl);
assert(sys->pool); assert(sys->pool);
return sys->pool; return sys->pool;
} }
...@@ -267,7 +268,7 @@ static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subp ...@@ -267,7 +268,7 @@ static void PictureRender(vout_display_t *vd, picture_t *pic, subpicture_t *subp
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Prepare( &sys->vgl, pic ); vout_display_opengl_Prepare( sys->vgl, pic );
(void)subpicture; (void)subpicture;
} }
...@@ -275,7 +276,7 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub ...@@ -275,7 +276,7 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
[sys->glView setVoutFlushing:YES]; [sys->glView setVoutFlushing:YES];
vout_display_opengl_Display(&sys->vgl, &vd->fmt ); vout_display_opengl_Display(sys->vgl, &vd->fmt );
[sys->glView setVoutFlushing:NO]; [sys->glView setVoutFlushing:NO];
picture_Release (pic); picture_Release (pic);
sys->has_first_frame = true; sys->has_first_frame = true;
...@@ -489,7 +490,7 @@ static void OpenglSwap(vlc_gl_t *gl) ...@@ -489,7 +490,7 @@ static void OpenglSwap(vlc_gl_t *gl)
if (hasFirstFrame) { if (hasFirstFrame) {
// This will lock gl. // This will lock gl.
vout_display_opengl_Display( &vd->sys->vgl, &vd->source ); vout_display_opengl_Display( vd->sys->vgl, &vd->source );
} }
else else
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
......
...@@ -152,7 +152,7 @@ struct vout_display_sys_t ...@@ -152,7 +152,7 @@ struct vout_display_sys_t
HDC hGLDC; HDC hGLDC;
HGLRC hGLRC; HGLRC hGLRC;
vlc_gl_t gl; vlc_gl_t gl;
vout_display_opengl_t vgl; vout_display_opengl_t *vgl;
#endif #endif
#ifdef MODULE_NAME_IS_direct2d #ifdef MODULE_NAME_IS_direct2d
......
...@@ -116,7 +116,8 @@ static int Open(vlc_object_t *object) ...@@ -116,7 +116,8 @@ static int Open(vlc_object_t *object)
sys->gl.sys = vd; sys->gl.sys = vd;
video_format_t fmt = vd->fmt; video_format_t fmt = vd->fmt;
if (vout_display_opengl_Init(&sys->vgl, &fmt, &sys->gl)) sys->vgl = vout_display_opengl_New(&fmt, &sys->gl);
if (!sys->vgl)
goto error; goto error;
vout_display_info_t info = vd->info; vout_display_info_t info = vd->info;
...@@ -150,8 +151,8 @@ static void Close(vlc_object_t *object) ...@@ -150,8 +151,8 @@ static void Close(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object; vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
if (sys->vgl.gl) if (sys->vgl)
vout_display_opengl_Clean(&sys->vgl); vout_display_opengl_Delete(sys->vgl);
if (sys->hGLDC && sys->hGLRC) if (sys->hGLDC && sys->hGLRC)
wglMakeCurrent(NULL, NULL); wglMakeCurrent(NULL, NULL);
...@@ -172,7 +173,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count) ...@@ -172,7 +173,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
VLC_UNUSED(count); VLC_UNUSED(count);
if (!sys->pool) if (!sys->pool)
sys->pool = vout_display_opengl_GetPool(&sys->vgl); sys->pool = vout_display_opengl_GetPool(sys->vgl);
return sys->pool; return sys->pool;
} }
...@@ -180,7 +181,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic ...@@ -180,7 +181,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Prepare(&sys->vgl, picture); vout_display_opengl_Prepare(sys->vgl, picture);
VLC_UNUSED(subpicture); VLC_UNUSED(subpicture);
} }
...@@ -188,7 +189,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic ...@@ -188,7 +189,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Display(&sys->vgl, &vd->source); vout_display_opengl_Display(sys->vgl, &vd->source);
picture_Release(picture); picture_Release(picture);
VLC_UNUSED(subpicture); VLC_UNUSED(subpicture);
......
...@@ -103,6 +103,21 @@ ...@@ -103,6 +103,21 @@
# define VLCGL_TYPE VLCGL_RGB_TYPE # define VLCGL_TYPE VLCGL_RGB_TYPE
#endif #endif
struct vout_display_opengl_t {
vlc_gl_t *gl;
video_format_t fmt;
int tex_pixel_size;
int tex_width;
int tex_height;
GLuint texture[VLCGL_TEXTURE_COUNT];
uint8_t *buffer[VLCGL_TEXTURE_COUNT];
picture_pool_t *pool;
};
static inline int GetAlignedSize(unsigned size) static inline int GetAlignedSize(unsigned size)
{ {
/* Return the smallest larger or equal power of 2 */ /* Return the smallest larger or equal power of 2 */
...@@ -110,10 +125,13 @@ static inline int GetAlignedSize(unsigned size) ...@@ -110,10 +125,13 @@ static inline int GetAlignedSize(unsigned size)
return ((align >> 1) == size) ? size : align; return ((align >> 1) == size) ? size : align;
} }
int vout_display_opengl_Init(vout_display_opengl_t *vgl, vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
video_format_t *fmt, vlc_gl_t *gl)
vlc_gl_t *gl)
{ {
vout_display_opengl_t *vgl = malloc(sizeof(*vgl));
if (!vgl)
return NULL;
vgl->gl = gl; vgl->gl = gl;
/* Find the chroma we will use and update fmt */ /* Find the chroma we will use and update fmt */
...@@ -216,10 +234,10 @@ int vout_display_opengl_Init(vout_display_opengl_t *vgl, ...@@ -216,10 +234,10 @@ int vout_display_opengl_Init(vout_display_opengl_t *vgl,
vlc_gl_Unlock(vgl->gl); vlc_gl_Unlock(vgl->gl);
} }
return VLC_SUCCESS; return vgl;
} }
void vout_display_opengl_Clean(vout_display_opengl_t *vgl) void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
{ {
/* */ /* */
if (!vlc_gl_Lock(vgl->gl)) { if (!vlc_gl_Lock(vgl->gl)) {
...@@ -235,6 +253,7 @@ void vout_display_opengl_Clean(vout_display_opengl_t *vgl) ...@@ -235,6 +253,7 @@ void vout_display_opengl_Clean(vout_display_opengl_t *vgl)
for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++) for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++)
free(vgl->buffer[i]); free(vgl->buffer[i]);
} }
free(vgl);
} }
int vout_display_opengl_ResetTextures(vout_display_opengl_t *vgl) int vout_display_opengl_ResetTextures(vout_display_opengl_t *vgl)
......
...@@ -57,24 +57,10 @@ ...@@ -57,24 +57,10 @@
# endif # endif
#endif #endif
typedef struct { typedef struct vout_display_opengl_t vout_display_opengl_t;
vlc_gl_t *gl;
video_format_t fmt; vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, vlc_gl_t *gl);
void vout_display_opengl_Delete(vout_display_opengl_t *vgl);
int tex_pixel_size;
int tex_width;
int tex_height;
GLuint texture[VLCGL_TEXTURE_COUNT];
uint8_t *buffer[VLCGL_TEXTURE_COUNT];
picture_pool_t *pool;
} vout_display_opengl_t;
int vout_display_opengl_Init(vout_display_opengl_t *vgl,
video_format_t *fmt, vlc_gl_t *gl);
void vout_display_opengl_Clean(vout_display_opengl_t *vgl);
int vout_display_opengl_ResetTextures(vout_display_opengl_t *vgl); int vout_display_opengl_ResetTextures(vout_display_opengl_t *vgl);
picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl); picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl);
......
...@@ -71,7 +71,7 @@ struct vout_display_sys_t ...@@ -71,7 +71,7 @@ struct vout_display_sys_t
GLXContext ctx; GLXContext ctx;
vlc_gl_t gl; vlc_gl_t gl;
vout_display_opengl_t vgl; vout_display_opengl_t *vgl;
picture_pool_t *pool; /* picture pool */ picture_pool_t *pool; /* picture pool */
}; };
...@@ -366,7 +366,8 @@ static int Open (vlc_object_t *obj) ...@@ -366,7 +366,8 @@ static int Open (vlc_object_t *obj)
sys->gl.getProcAddress = GetProcAddress; sys->gl.getProcAddress = GetProcAddress;
sys->gl.sys = sys; sys->gl.sys = sys;
if (vout_display_opengl_Init (&sys->vgl, &vd->fmt, &sys->gl)) sys->vgl = vout_display_opengl_New (&vd->fmt, &sys->gl);
if (!sys->vgl)
{ {
sys->gl.sys = NULL; sys->gl.sys = NULL;
goto error; goto error;
...@@ -414,7 +415,7 @@ static void Close (vlc_object_t *obj) ...@@ -414,7 +415,7 @@ static void Close (vlc_object_t *obj)
Display *dpy = sys->display; Display *dpy = sys->display;
if (sys->gl.sys != NULL) if (sys->gl.sys != NULL)
vout_display_opengl_Clean (&sys->vgl); vout_display_opengl_Delete (sys->vgl);
if (sys->ctx != NULL) if (sys->ctx != NULL)
{ {
...@@ -460,7 +461,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count) ...@@ -460,7 +461,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
(void)requested_count; (void)requested_count;
if (!sys->pool) if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl); sys->pool = vout_display_opengl_GetPool (sys->vgl);
return sys->pool; return sys->pool;
} }
...@@ -468,7 +469,7 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub ...@@ -468,7 +469,7 @@ static void PictureRender (vout_display_t *vd, picture_t *pic, subpicture_t *sub
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Prepare (&sys->vgl, pic); vout_display_opengl_Prepare (sys->vgl, pic);
(void)subpicture; (void)subpicture;
} }
...@@ -476,7 +477,7 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *su ...@@ -476,7 +477,7 @@ static void PictureDisplay (vout_display_t *vd, picture_t *pic, subpicture_t *su
{ {
vout_display_sys_t *sys = vd->sys; vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Display (&sys->vgl, &vd->source); vout_display_opengl_Display (sys->vgl, &vd->source);
picture_Release (pic); picture_Release (pic);
(void)subpicture; (void)subpicture;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment