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 ()
struct vout_display_sys_t
{
vout_display_opengl_t vgl;
vout_display_opengl_t *vgl;
vout_window_t *window;
vlc_gl_t *gl;
......@@ -137,7 +137,8 @@ static int Open (vlc_object_t *obj)
goto error;
/* 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;
vd->sys = sys;
......@@ -167,7 +168,7 @@ static void Close (vlc_object_t *obj)
vout_display_t *vd = (vout_display_t *)obj;
vout_display_sys_t *sys = vd->sys;
vout_display_opengl_Clean (&sys->vgl);
vout_display_opengl_Delete (sys->vgl);
vlc_gl_Destroy (sys->gl);
vout_display_DeleteWindow (vd, sys->window);
free (sys);
......@@ -181,7 +182,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned count)
vout_display_sys_t *sys = vd->sys;
if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl);
sys->pool = vout_display_opengl_GetPool (sys->vgl);
(void) count;
return sys->pool;
}
......@@ -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_opengl_Prepare (&sys->vgl, pic);
vout_display_opengl_Prepare (sys->vgl, pic);
(void)subpicture;
}
......@@ -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_opengl_Display (&sys->vgl, &vd->source);
vout_display_opengl_Display (sys->vgl, &vd->source);
picture_Release (pic);
(void)subpicture;
}
......
......@@ -94,7 +94,7 @@ struct vout_display_sys_t
UIView * container;
vlc_gl_t gl;
vout_display_opengl_t vgl;
vout_display_opengl_t *vgl;
picture_pool_t *pool;
picture_t *current;
......@@ -151,7 +151,8 @@ static int Open(vlc_object_t *this)
sys->gl.getProcAddress = NULL;
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;
goto error;
......@@ -197,7 +198,7 @@ void Close(vlc_object_t *this)
[sys->glView release];
if (sys->gl.sys != NULL)
vout_display_opengl_Clean(&sys->vgl);
vout_display_opengl_Delete(sys->vgl);
free (sys);
}
......@@ -212,7 +213,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned requested_count)
VLC_UNUSED(requested_count);
if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl);
sys->pool = vout_display_opengl_GetPool (sys->vgl);
assert(sys->pool);
return sys->pool;
}
......@@ -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_opengl_Prepare( &sys->vgl, pic );
vout_display_opengl_Prepare( sys->vgl, pic );
(void)subpicture;
}
static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
{
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);
sys->has_first_frame = true;
(void)subpicture;
......
......@@ -100,7 +100,7 @@ struct vout_display_sys_t
vout_window_t *embed;
vlc_gl_t gl;
vout_display_opengl_t vgl;
vout_display_opengl_t *vgl;
picture_pool_t *pool;
picture_t *current;
......@@ -190,7 +190,8 @@ static int Open(vlc_object_t *this)
sys->gl.getProcAddress = NULL;
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;
goto error;
......@@ -240,7 +241,7 @@ void Close(vlc_object_t *this)
[sys->glView release];
if (sys->gl.sys != NULL)
vout_display_opengl_Clean(&sys->vgl);
vout_display_opengl_Delete(sys->vgl);
if (sys->embed)
vout_display_DeleteWindow(vd, sys->embed);
......@@ -257,7 +258,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned requested_count)
VLC_UNUSED(requested_count);
if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl);
sys->pool = vout_display_opengl_GetPool (sys->vgl);
assert(sys->pool);
return sys->pool;
}
......@@ -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_opengl_Prepare( &sys->vgl, pic );
vout_display_opengl_Prepare( sys->vgl, pic );
(void)subpicture;
}
......@@ -275,7 +276,7 @@ static void PictureDisplay(vout_display_t *vd, picture_t *pic, subpicture_t *sub
{
vout_display_sys_t *sys = vd->sys;
[sys->glView setVoutFlushing:YES];
vout_display_opengl_Display(&sys->vgl, &vd->fmt );
vout_display_opengl_Display(sys->vgl, &vd->fmt );
[sys->glView setVoutFlushing:NO];
picture_Release (pic);
sys->has_first_frame = true;
......@@ -489,7 +490,7 @@ static void OpenglSwap(vlc_gl_t *gl)
if (hasFirstFrame) {
// This will lock gl.
vout_display_opengl_Display( &vd->sys->vgl, &vd->source );
vout_display_opengl_Display( vd->sys->vgl, &vd->source );
}
else
glClear(GL_COLOR_BUFFER_BIT);
......
......@@ -152,7 +152,7 @@ struct vout_display_sys_t
HDC hGLDC;
HGLRC hGLRC;
vlc_gl_t gl;
vout_display_opengl_t vgl;
vout_display_opengl_t *vgl;
#endif
#ifdef MODULE_NAME_IS_direct2d
......
......@@ -116,7 +116,8 @@ static int Open(vlc_object_t *object)
sys->gl.sys = vd;
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;
vout_display_info_t info = vd->info;
......@@ -150,8 +151,8 @@ static void Close(vlc_object_t *object)
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
if (sys->vgl.gl)
vout_display_opengl_Clean(&sys->vgl);
if (sys->vgl)
vout_display_opengl_Delete(sys->vgl);
if (sys->hGLDC && sys->hGLRC)
wglMakeCurrent(NULL, NULL);
......@@ -172,7 +173,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
VLC_UNUSED(count);
if (!sys->pool)
sys->pool = vout_display_opengl_GetPool(&sys->vgl);
sys->pool = vout_display_opengl_GetPool(sys->vgl);
return sys->pool;
}
......@@ -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_opengl_Prepare(&sys->vgl, picture);
vout_display_opengl_Prepare(sys->vgl, picture);
VLC_UNUSED(subpicture);
}
......@@ -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_opengl_Display(&sys->vgl, &vd->source);
vout_display_opengl_Display(sys->vgl, &vd->source);
picture_Release(picture);
VLC_UNUSED(subpicture);
......
......@@ -103,6 +103,21 @@
# define VLCGL_TYPE VLCGL_RGB_TYPE
#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)
{
/* Return the smallest larger or equal power of 2 */
......@@ -110,10 +125,13 @@ static inline int GetAlignedSize(unsigned size)
return ((align >> 1) == size) ? size : align;
}
int vout_display_opengl_Init(vout_display_opengl_t *vgl,
video_format_t *fmt,
vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
vlc_gl_t *gl)
{
vout_display_opengl_t *vgl = malloc(sizeof(*vgl));
if (!vgl)
return NULL;
vgl->gl = gl;
/* Find the chroma we will use and update fmt */
......@@ -216,10 +234,10 @@ int vout_display_opengl_Init(vout_display_opengl_t *vgl,
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)) {
......@@ -235,6 +253,7 @@ void vout_display_opengl_Clean(vout_display_opengl_t *vgl)
for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++)
free(vgl->buffer[i]);
}
free(vgl);
}
int vout_display_opengl_ResetTextures(vout_display_opengl_t *vgl)
......
......@@ -57,24 +57,10 @@
# endif
#endif
typedef struct {
vlc_gl_t *gl;
typedef struct vout_display_opengl_t vout_display_opengl_t;
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;
} 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);
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 vout_display_opengl_ResetTextures(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
GLXContext ctx;
vlc_gl_t gl;
vout_display_opengl_t vgl;
vout_display_opengl_t *vgl;
picture_pool_t *pool; /* picture pool */
};
......@@ -366,7 +366,8 @@ static int Open (vlc_object_t *obj)
sys->gl.getProcAddress = GetProcAddress;
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;
goto error;
......@@ -414,7 +415,7 @@ static void Close (vlc_object_t *obj)
Display *dpy = sys->display;
if (sys->gl.sys != NULL)
vout_display_opengl_Clean (&sys->vgl);
vout_display_opengl_Delete (sys->vgl);
if (sys->ctx != NULL)
{
......@@ -460,7 +461,7 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
(void)requested_count;
if (!sys->pool)
sys->pool = vout_display_opengl_GetPool (&sys->vgl);
sys->pool = vout_display_opengl_GetPool (sys->vgl);
return sys->pool;
}
......@@ -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_opengl_Prepare (&sys->vgl, pic);
vout_display_opengl_Prepare (sys->vgl, pic);
(void)subpicture;
}
......@@ -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_opengl_Display (&sys->vgl, &vd->source);
vout_display_opengl_Display (sys->vgl, &vd->source);
picture_Release (pic);
(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