Exemple #1
0
/**
 * Destroys the OpenGL context.
 */
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);
    vlc_gl_Destroy (sys->gl);
    vout_display_DeleteWindow (vd, sys->window);
    free (sys);
}
Exemple #2
0
/**
 * Allocates a surface and an OpenGL context for video output.
 */
static int Open (vlc_object_t *obj)
{
    vout_display_t *vd = (vout_display_t *)obj;
    vout_display_sys_t *sys = malloc (sizeof (*sys));
    if (unlikely(sys == NULL))
        return VLC_ENOMEM;

    sys->gl = NULL;
    sys->pool = NULL;

    sys->window = MakeWindow (vd);
    if (sys->window == NULL)
        goto error;

    sys->gl = vlc_gl_Create (sys->window, API, "$" MODULE_VARNAME);
    if (sys->gl == NULL)
        goto error;

    if (vlc_gl_MakeCurrent (sys->gl))
        goto error;

    /* Initialize video display */
    sys->vgl = vout_display_opengl_New (&vd->fmt, NULL, sys->gl);
    if (!sys->vgl)
        goto error;

    vd->sys = sys;
    vd->info.has_pictures_invalid = false;
    vd->info.has_event_thread = false;
    vd->pool = Pool;
    vd->prepare = PictureRender;
    vd->display = PictureDisplay;
    vd->control = Control;
    vd->manage = NULL;
    return VLC_SUCCESS;

error:
    if (sys->gl != NULL)
        vlc_gl_Destroy (sys->gl);
    if (sys->window != NULL)
        vout_display_DeleteWindow (vd, sys->window);
    free (sys);
    return VLC_EGENERIC;
}
Exemple #3
0
/**
 * It destroys an OpenGL vout display.
 */
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)
        vout_display_opengl_Delete(sys->vgl);

    if (sys->gl)
        vlc_gl_Destroy(sys->gl);

    if (sys->hGLDC && sys->hGLRC)
        wglMakeCurrent(NULL, NULL);
    if (sys->hGLRC)
        wglDeleteContext(sys->hGLRC);
    if (sys->hGLDC)
        ReleaseDC(sys->hvideownd, sys->hGLDC);
    DestroyGPUAffinityDC(vd);

    CommonClean(vd);

    free(sys);
}