Ejemplo n.º 1
0
static int preinit(const char *vo_subdevice)
{
	uint32_t ver;
  const char *devname=vo_subdevice?vo_subdevice:"/dev/mga_vid";
	sws_rgb2rgb_init(get_sws_cpuflags());

	f = open(devname,O_RDWR);
	if(f == -1)
	{
		perror("open");
		mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldntOpen,devname);
		return -1;
	}

	// check whether the mga_vid driver has the same
	// version as we expect

	ioctl(f,MGA_VID_GET_VERSION,&ver);
	if(MGA_VID_VERSION != ver)
	{
		mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_MGA_mgavidVersionMismatch, ver, MGA_VID_VERSION);
		return -1;
	}

#ifdef VO_XMGA
  if (!vo_init()) {
    close(f);
    return -1;
  }
#endif

  return 0;
}
Ejemplo n.º 2
0
static int preinit(const char *arg)
{
    if (arg)
    {
        mp_msg(MSGT_VO, MSGL_ERR, "vo_x11: Unknown subdevice: %s\n", arg);
        return ENOSYS;
    }

    if (!vo_init())
        return -1;              // Can't open X11
    return 0;
}
Ejemplo n.º 3
0
Archivo: vo_x11.c Proyecto: kax4/mpv
static int preinit(struct vo *vo, const char *arg)
{
    struct priv *p = vo->priv;
    p->vo = vo;

    if (arg) {
        mp_msg(MSGT_VO, MSGL_ERR, "vo_x11: Unknown subdevice: %s\n", arg);
        return ENOSYS;
    }

    p->osd_backup = talloc_steal(p, mp_draw_sub_backup_new());

    if (!vo_init(vo))
        return -1;              // Can't open X11
    return 0;
}
Ejemplo n.º 4
0
/**
 * Initialize framebuffer
 */
static int preinit(const char *arg)
{
    opt_t subopts[] = {
        {"fb_overlay_only", OPT_ARG_BOOL, &fb_overlay_only, NULL},
        {"dbl_buffer", OPT_ARG_BOOL, &dbl_buffer, NULL},
        {NULL}
    };

    if (subopt_parse(arg, subopts) != 0) {
        mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] unknown suboptions: %s\n", arg);
        return -1;
    }

    dev_fd = open("/dev/fb0", O_RDWR);

    if (dev_fd == -1) {
        mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb0\n");
        return -1;
    }

    ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo_p0);
    close(dev_fd);

    dev_fd = open("/dev/fb1", O_RDWR);

    if (dev_fd == -1) {
        mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error /dev/fb1\n");
        return -1;
    }

    ioctl(dev_fd, FBIOGET_VSCREENINFO, &sinfo);
    ioctl(dev_fd, OMAPFB_QUERY_PLANE, &pinfo);
    ioctl(dev_fd, OMAPFB_QUERY_MEM, &minfo);

    if (!fb_overlay_only && !vo_init())
    {
        mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Could not open X, overlay only...\n");        
        fb_overlay_only = 1;
    }

    return 0;
}
Ejemplo n.º 5
0
static int preinit(const char *arg)
{
    if (arg)
    {
        mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Unknown subdevice: %s\n", arg);
        return ENOSYS;
    }

    if (!vo_init())
        return -1;              // Can't open X11

    if (dga_depths_init == 0)
    {                           // FIXME!?
        int i;

        vo_dga_XServer_mode = vd_ValidateMode(vo_depthonscreen);

        if (vo_dga_XServer_mode == 0)
        {
#ifndef HAVE_DGA2
            mp_msg(MSGT_VO, MSGL_ERR,
                   "vo_dga: Your X-Server is not running in a ");
            mp_msg(MSGT_VO, MSGL_ERR,
                   "resolution supported by DGA driver!\n");
#endif
        }                       //else{
        //  mp_msg(MSGT_VO, MSGL_V, "vo_dga: X running at: %s\n", 
        //            vd_GetModeString(vo_dga_XServer_mode));
        //}                                

#ifdef HAVE_DGA2
        vo_modelines = XDGAQueryModes(mDisplay, mScreen, &vo_modecount);
        if (vo_modelines)
        {
            for (i = 0; i < vo_modecount; i++)
            {
                mp_msg(MSGT_VO, MSGL_V,
                       "vo_dga: (%03d) depth=%d, bpp=%d, r=%08lx, g=%08lx, b=%08lx, %d x %d\n",
                       i, vo_modelines[i].depth,
                       vo_modelines[i].bitsPerPixel,
                       vo_modelines[i].redMask, vo_modelines[i].greenMask,
                       vo_modelines[i].blueMask,
                       vo_modelines[i].viewportWidth,
                       vo_modelines[i].viewportHeight);
                vd_EnableMode(vo_modelines[i].depth,
                              vo_modelines[i].bitsPerPixel,
                              vo_modelines[i].redMask,
                              vo_modelines[i].greenMask,
                              vo_modelines[i].blueMask);
            }
        }
#endif
        dga_depths_init = 1;

        if (!vo_dga_modes[1].vdm_supported
            && vo_dga_modes[2].vdm_supported)
        {
            vo_dga_modes[1].vdm_supported = 1;
        }

        if (!vo_dga_modes[3].vdm_supported
            && vo_dga_modes[4].vdm_supported)
        {
            vo_dga_modes[3].vdm_supported = 1;
        }

        for (i = 1; i < vo_dga_mode_num; i++)
        {
            mp_msg(MSGT_VO, MSGL_INFO, "vo_dga: Mode: %s",
                   vd_GetModeString(i));
            if (vo_dbpp && vo_dbpp != vo_dga_modes[i].vdm_mplayer_depth)
            {
                vo_dga_modes[i].vdm_supported = 0;
                mp_msg(MSGT_VO, MSGL_INFO, " ...disabled by -bpp %d",
                       vo_dbpp);
            }
            mp_msg(MSGT_VO, MSGL_INFO, "\n");
        }
    }

    return 0;
}
Ejemplo n.º 6
0
Archivo: vo_xv.c Proyecto: kax4/mpv
static int preinit(struct vo *vo, const char *arg)
{
    XvPortID xv_p;
    int busy_ports = 0;
    unsigned int i;
    strarg_t ck_src_arg = { 0, NULL };
    strarg_t ck_method_arg = { 0, NULL };
    struct xvctx *ctx = talloc_zero(vo, struct xvctx);
    vo->priv = ctx;
    int xv_adaptor = -1;

    if (!vo_init(vo))
        return -1;

    struct vo_x11_state *x11 = vo->x11;

    const opt_t subopts[] =
    {
      /* name         arg type     arg var         test */
      {  "port",      OPT_ARG_INT, &x11->xv_port,  int_pos },
      {  "adaptor",   OPT_ARG_INT, &xv_adaptor,    int_non_neg },
      {  "ck",        OPT_ARG_STR, &ck_src_arg,    xv_test_ck },
      {  "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm },
      {  NULL }
    };

    x11->xv_port = 0;

    /* parse suboptions */
    if (subopt_parse(arg, subopts) != 0) {
        return -1;
    }

    /* modify colorkey settings according to the given options */
    xv_setup_colorkeyhandling(vo, ck_method_arg.str, ck_src_arg.str);

    /* check for Xvideo extension */
    unsigned int ver, rel, req, ev, err;
    if (Success != XvQueryExtension(x11->display, &ver, &rel, &req, &ev, &err)) {
        mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] Sorry, Xv not supported by this X11 version/driver\n[VO_XV] ******** Try with  -vo x11 *********\n");
        goto error;
    }

    /* check for Xvideo support */
    if (Success !=
        XvQueryAdaptors(x11->display, DefaultRootWindow(x11->display),
                        &ctx->adaptors, &ctx->ai)) {
        mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] XvQueryAdaptors failed.\n");
        goto error;
    }

    /* check adaptors */
    if (x11->xv_port) {
        int port_found;

        for (port_found = 0, i = 0; !port_found && i < ctx->adaptors; i++) {
            if ((ctx->ai[i].type & XvInputMask)
                && (ctx->ai[i].type & XvImageMask)) {
                for (xv_p = ctx->ai[i].base_id;
                     xv_p < ctx->ai[i].base_id + ctx->ai[i].num_ports;
                     ++xv_p) {
                    if (xv_p == x11->xv_port) {
                        port_found = 1;
                        break;
                    }
                }
            }
        }
        if (port_found) {
            if (XvGrabPort(x11->display, x11->xv_port, CurrentTime))
                x11->xv_port = 0;
        } else {
            mp_tmsg(MSGT_VO, MSGL_WARN, "[VO_XV] Invalid port parameter, overriding with port 0.\n");
            x11->xv_port = 0;
        }
    }

    for (i = 0; i < ctx->adaptors && x11->xv_port == 0; i++) {
        /* check if adaptor number has been specified */
        if (xv_adaptor != -1 && xv_adaptor != i)
            continue;

        if ((ctx->ai[i].type & XvInputMask) && (ctx->ai[i].type & XvImageMask)) {
            for (xv_p = ctx->ai[i].base_id;
                 xv_p < ctx->ai[i].base_id + ctx->ai[i].num_ports; ++xv_p)
                if (!XvGrabPort(x11->display, xv_p, CurrentTime)) {
                    x11->xv_port = xv_p;
                    mp_msg(MSGT_VO, MSGL_V,
                           "[VO_XV] Using Xv Adapter #%d (%s)\n",
                           i, ctx->ai[i].name);
                    break;
                } else {
                    mp_tmsg(MSGT_VO, MSGL_WARN, "[VO_XV] Could not grab port %i.\n",
                           (int) xv_p);
                    ++busy_ports;
                }
        }
    }
    if (!x11->xv_port) {
        if (busy_ports)
            mp_tmsg(MSGT_VO, MSGL_ERR,
                "[VO_XV] Could not find free Xvideo port - maybe another process is already\n"\
                "[VO_XV] using it. Close all video applications, and try again. If that does\n"\
                "[VO_XV] not help, see 'mpv -vo help' for other (non-xv) video out drivers.\n");
        else
            mp_tmsg(MSGT_VO, MSGL_ERR,
                "[VO_XV] It seems there is no Xvideo support for your video card available.\n"\
                "[VO_XV] Run 'xvinfo' to verify its Xv support and read\n"\
                "[VO_XV] DOCS/HTML/en/video.html#xv!\n"\
                "[VO_XV] See 'mpv -vo help' for other (non-xv) video out drivers.\n"\
                "[VO_XV] Try -vo x11.\n");
        goto error;
    }

    if (!vo_xv_init_colorkey(vo)) {
        goto error;             // bail out, colorkey setup failed
    }
    vo_xv_enable_vsync(vo);
    vo_xv_get_max_img_dim(vo, &ctx->max_width, &ctx->max_height);

    ctx->fo = XvListImageFormats(x11->display, x11->xv_port,
                                 (int *) &ctx->formats);

    ctx->osd_backup = talloc_steal(ctx, mp_draw_sub_backup_new());

    return 0;

  error:
    uninit(vo);                 // free resources
    return -1;
}