Exemplo n.º 1
0
Arquivo: w32.c Projeto: kraziegent/mpv
static int w32_init(struct MPGLContext *ctx, int flags)
{
    if (!vo_w32_init(ctx->vo))
        goto fail;

    struct w32_context *w32_ctx = ctx->priv;

    w32_ctx->flags = flags;
    vo_w32_run_on_thread(ctx->vo, create_ctx, ctx);

    if (!w32_ctx->context)
        goto fail;

    if (!ctx->gl->SwapInterval)
        MP_VERBOSE(ctx->vo, "WGL_EXT_swap_control missing.");
    w32_ctx->real_wglSwapInterval = ctx->gl->SwapInterval;
    ctx->gl->SwapInterval = w32_swap_interval;
    w32_ctx->current_swapinterval = -1;

    current_w32_context = w32_ctx;
    wglMakeCurrent(w32_ctx->hdc, w32_ctx->context);
    return 0;

fail:
    w32_uninit(ctx);
    return -1;
}
Exemplo n.º 2
0
Arquivo: w32.c Projeto: madokama/mpv
static void w32_uninit(MPGLContext *ctx)
{
    struct w32_context *w32_ctx = ctx->priv;
    if (w32_ctx->context)
        wglMakeCurrent(w32_ctx->hdc, 0);
    vo_w32_run_on_thread(ctx->vo, destroy_gl, ctx);

    DwmEnableMMCSS(FALSE);
    vo_w32_uninit(ctx->vo);
}
Exemplo n.º 3
0
static void releaseGlContext_w32(MPGLContext *ctx)
{
    struct w32_context *w32_ctx = ctx->priv;
    if (w32_ctx->context)
        wglMakeCurrent(w32_ctx->hdc, 0);
    vo_w32_run_on_thread(ctx->vo, destroy_gl, ctx);

    w32_ctx->dwmflush = NULL;
    if (w32_ctx->dwmapi_dll)
        FreeLibrary(w32_ctx->dwmapi_dll);
    w32_ctx->dwmapi_dll = NULL;
}
Exemplo n.º 4
0
Arquivo: w32.c Projeto: kraziegent/mpv
static void w32_uninit(MPGLContext *ctx)
{
    struct w32_context *w32_ctx = ctx->priv;
    if (w32_ctx->context)
        wglMakeCurrent(w32_ctx->hdc, 0);
    vo_w32_run_on_thread(ctx->vo, destroy_gl, ctx);

    if (w32_ctx->dwmapi_dll)
        FreeLibrary(w32_ctx->dwmapi_dll);
    w32_ctx->dwmapi_dll = NULL;
    vo_w32_uninit(ctx->vo);
}
Exemplo n.º 5
0
static bool config_window_w32(struct MPGLContext *ctx, int flags)
{
    struct w32_context *w32_ctx = ctx->priv;
    if (!vo_w32_config(ctx->vo, flags))
        return false;

    if (w32_ctx->context) // reuse existing context
        return true;

    w32_ctx->flags = flags;
    vo_w32_run_on_thread(ctx->vo, create_ctx, ctx);

    if (w32_ctx->context)
        wglMakeCurrent(w32_ctx->hdc, w32_ctx->context);
    return !!w32_ctx->context;
}