Exemple #1
0
/** @brief libvo Callback: Configre the Direct3D adapter.
 *  @param width    Movie source width
 *  @param height   Movie source height
 *  @param d_width  Screen (destination) width
 *  @param d_height Screen (destination) height
 *  @param options  Options bitmap
 *  @param title    Window title
 *  @param format   Movie colorspace format (using MPlayer's
 *                  defines, e.g. IMGFMT_YUY2)
 *  @return 0 on success, VO_ERROR on failure
 */
static int config(uint32_t width, uint32_t height, uint32_t d_width,
                  uint32_t d_height, uint32_t options, char *title,
                  uint32_t format)
{

    priv->src_width  = width;
    priv->src_height = height;

    /* w32_common framework call. Creates window on the screen with
     * the given coordinates.
     */
    if (!vo_w32_config(d_width, d_height, options)) {
        mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Creating onscreen window failed.\n");
        return VO_ERROR;
    }

    /* "config" may be called several times, so if this is not the first
     * call, we should destroy Direct3D adapter and surfaces before
     * calling configure_d3d, which will create them again.
     */

    destroy_d3d_surfaces();

    /* Destroy the D3D Device */
    if (priv->d3d_device)
        IDirect3DDevice9_Release(priv->d3d_device);
    priv->d3d_device = NULL;

    if (!configure_d3d())
        return VO_ERROR;

    return 0; /* Success */
}
Exemple #2
0
static int config(uint32_t width, uint32_t height,
                  uint32_t d_width, uint32_t d_height,
                  uint32_t flags, char *title, uint32_t format)
{
    image_height = height;
    image_width  = width;
    image_format = format;

    int_pause = 0;

#ifdef CONFIG_GL_WIN32
    if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags))
        return -1;
#endif
#ifdef CONFIG_GL_X11
    if (glctx.type == GLTYPE_X11) {
        XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
        if (vinfo == NULL) {
            mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] no GLX support present\n");
            return -1;
        }
        mp_msg(MSGT_VO, MSGL_V, "[matrixview] GLX chose visual with ID 0x%x\n",
               (int)vinfo->visualid);

        vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags,
                                XCreateColormap(mDisplay, mRootWin,
                                                vinfo->visual, AllocNone),
                                "matrixview", title);
    }
#endif /* CONFIG_GL_WIN32 */
    if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
        return -1;

    if (sws)
        sws_freeContext(sws);

    sws = sws_getContextFromCmdLine(image_width, image_height, image_format,
                                    matrix_cols, matrix_rows, IMGFMT_Y8);
    if (!sws) {
        mp_msg(MSGT_VO, MSGL_ERR, "[matrixview] Cannot create SwsContext context\n");
        return -1;
    }

    if (!map_image[0])
        map_image[0] = calloc(matrix_cols, matrix_rows);

    map_stride[0] = matrix_cols;

    matrixview_init(vo_dwidth, vo_dheight);
    matrixview_matrix_resize(matrix_cols, matrix_rows);

    contrast_set(eq_contrast);
    brightness_set(eq_brightness);
    matrixview_reshape(vo_dwidth, vo_dheight);
    return 0;
}
Exemple #3
0
static bool config_window_w32(struct MPGLContext *ctx, int flags)
{
    if (!vo_w32_config(ctx->vo, flags))
        return false;

    bool success = false;
    if (ctx->requested_gl_version >= MPGL_VER(3, 0))
        success = create_context_w32_gl3(ctx);
    if (!success)
        success = create_context_w32_old(ctx);
    return success;
}
Exemple #4
0
static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, const char *title)
{
  if (stereo_mode == GL_3D_QUADBUFFER)
    flags |= VOFLAG_STEREO;
#ifdef CONFIG_GL_WIN32
  if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags))
    return -1;
#endif
#ifdef CONFIG_GL_EGL_X11
  if (glctx.type == GLTYPE_EGL_X11) {
    XVisualInfo vinfo = { .visual = CopyFromParent, .depth = CopyFromParent };
    vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, flags,
            CopyFromParent, "gl", title);
  }
Exemple #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;
}
Exemple #6
0
static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, const char *title)
{
#ifdef CONFIG_GL_WIN32
  if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags))
    return -1;
#endif
#ifdef CONFIG_GL_X11
  if (glctx.type == GLTYPE_X11) {
    static int default_glx_attribs[] = {
      GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
      GLX_DOUBLEBUFFER, None
    };
    static int stereo_glx_attribs[]  = {
      GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
      GLX_DOUBLEBUFFER, GLX_STEREO, None
    };
    XVisualInfo *vinfo = NULL;
    if (stereo_mode == GL_3D_QUADBUFFER) {
      vinfo = glXChooseVisual(mDisplay, mScreen, stereo_glx_attribs);
      if (!vinfo)
        mp_msg(MSGT_VO, MSGL_ERR, "[gl] Could not find a stereo visual, "
                                  "3D will probably not work!\n");
    }
    if (!vinfo)
      vinfo = glXChooseVisual(mDisplay, mScreen, default_glx_attribs);
    if (!vinfo) {
      mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
      return -1;
    }
    mp_msg(MSGT_VO, MSGL_V, "[gl] GLX chose visual with ID 0x%x\n", (int)vinfo->visualid);

    vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags,
            XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone),
            "gl", title);
  }
#endif
#ifdef CONFIG_GL_SDL
  if (glctx.type == GLTYPE_SDL) {
    SDL_WM_SetCaption(title, NULL);
    vo_dwidth  = d_width;
    vo_dheight = d_height;
  }
#endif
  return 0;
}
static int create_window(uint32_t d_width, uint32_t d_height, uint32_t flags, const char *title)
{
#ifdef CONFIG_GL_WIN32
  if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags))
    return -1;
#endif
#ifdef CONFIG_GL_X11
  if (glctx.type == GLTYPE_X11) {
    XVisualInfo *vinfo=glXChooseVisual( mDisplay,mScreen,wsGLXAttrib );
    if (vinfo == NULL)
    {
      mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
      return -1;
    }
    mp_msg(MSGT_VO, MSGL_V, "[gl] GLX chose visual with ID 0x%x\n", (int)vinfo->visualid);

    vo_x11_create_vo_window(vinfo, vo_dx, vo_dy, d_width, d_height, flags,
            XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocNone),
            "gl", title);
  }
#endif
  return 0;
}
Exemple #8
0
static int angle_reconfig(struct MPGLContext *ctx)
{
    vo_w32_config(ctx->vo);
    return 0;
}
static int config_w32(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) {
  if (!vo_w32_config(d_width, d_height, flags))
    return -1;

  return 0;
}