示例#1
0
static void x11_check_events(void)
{
    int e = vo_x11_check_events(mDisplay);

    if (e & VO_EVENT_RESIZE)
        vo_calc_drwXY(&drwX, &drwY);

    if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
    {
        vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1);
        omapfb_update(0, 0, 0, 0, 1);
    }
}
示例#2
0
文件: vo_xv.c 项目: kax4/mpv
static void resize(struct vo *vo)
{
    struct xvctx *ctx = vo->priv;

    // Can't be used, because the function calculates screen-space coordinates,
    // while we need video-space.
    struct mp_osd_res unused;

    vo_get_src_dst_rects(vo, &ctx->src_rect, &ctx->dst_rect, &unused);

    struct mp_rect *dst = &ctx->dst_rect;
    int dw = dst->x1 - dst->x0, dh = dst->y1 - dst->y0;
    vo_x11_clearwindow_part(vo, vo->x11->window, dw, dh);
    vo_xv_draw_colorkey(vo, dst->x0, dst->y0, dw, dh);
    read_xv_csp(vo);
}
示例#3
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)
{
    uint8_t *fbmem;
    int i;
    struct omapfb_color_key color_key;

    XVisualInfo vinfo;
    XSetWindowAttributes xswa;
    XWindowAttributes attribs;
    unsigned long xswamask;
    int depth;

    Window root, parent;
    Window *child;
    unsigned int n_children;

    fullscreen_flag = flags & VOFLAG_FULLSCREEN;
    if (!fb_overlay_only)
    {
        if (!title)
            title = "MPlayer OMAPFB (X11/FB) render";

        XGetWindowAttributes(mDisplay, mRootWin, &attribs);
        depth = attribs.depth;
        if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
            depth = 24;
        XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);

        xswa.border_pixel = 0;
        xswa.background_pixel = xv_colorkey = TRANSPARENT_COLOR_KEY;

        xswamask = CWBackPixel | CWBorderPixel;
        xv_ck_info.method = CK_METHOD_BACKGROUND;

        vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight,
                                flags, CopyFromParent, "omapfb", title);
        XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);

        /* Need to receive events on the parent window -- so when it is
           moved / resized / etc., we know. */
        if(WinID > 0)
        {
            /* Query window tree information */
            XQueryTree(mDisplay, vo_window, &root, &parent, &child, &n_children);
            if (n_children)
                XFree(child);

            XUnmapWindow(mDisplay, vo_window);
            if (parent)
                XSelectInput(mDisplay, parent, StructureNotifyMask);
            XMapWindow(mDisplay, vo_window);
        }

        vo_calc_drwXY(&drwX, &drwY);
        vo_xv_draw_colorkey(drwX, drwY, vo_dwidth - 1, vo_dheight - 1);
    }

    fbmem = mmap(NULL, minfo.size, PROT_READ|PROT_WRITE, MAP_SHARED, dev_fd, 0);
    if (fbmem == MAP_FAILED) {
        mp_msg(MSGT_VO, MSGL_FATAL, "[omapfb] Error mmap\n");
        return -1;
    }

    for (i = 0; i < minfo.size / 4; i++)
        ((uint32_t*)fbmem)[i] = 0x80008000;

    sinfo.xres = FFMIN(sinfo_p0.xres, width)  & ~15;
    sinfo.yres = FFMIN(sinfo_p0.yres, height) & ~15;
    sinfo.xoffset = 0;
    sinfo.yoffset = 0;
    sinfo.nonstd = OMAPFB_COLOR_YUY422;

    fb_pages[0].x = 0;
    fb_pages[0].y = 0;
    fb_pages[0].buf = fbmem;

    if (dbl_buffer && minfo.size >= sinfo.xres * sinfo.yres * 2) {
        sinfo.xres_virtual = sinfo.xres;
        sinfo.yres_virtual = sinfo.yres * 2;
        fb_pages[1].x = 0;
        fb_pages[1].y = sinfo.yres;
        fb_pages[1].buf = fbmem + sinfo.xres * sinfo.yres * 2;
        fb_page_flip = 1;
    } else {
        sinfo.xres_virtual = sinfo.xres;
        sinfo.yres_virtual = sinfo.yres;
        fb_page_flip = 0;
    }

    ioctl(dev_fd, FBIOPUT_VSCREENINFO, &sinfo);

    if (WinID <= 0) {
        if (fullscreen_flag) {
            omapfb_update(0, 0, sinfo_p0.xres, sinfo_p0.yres, 1);
        } else {
            omapfb_update(sinfo_p0.xres / 2 - sinfo.xres / 2, sinfo_p0.yres / 2 - sinfo.yres / 2, sinfo.xres, sinfo.yres, 1);
        }
    }

    color_key.channel_out = OMAPFB_CHANNEL_OUT_LCD;
    color_key.background = 0x0;
    color_key.trans_key = TRANSPARENT_COLOR_KEY;
    if (fb_overlay_only)
        color_key.key_type = OMAPFB_COLOR_KEY_DISABLED;
    else
        color_key.key_type = OMAPFB_COLOR_KEY_GFX_DST;
    ioctl(dev_fd, OMAPFB_SET_COLOR_KEY, &color_key);

    plane_ready = 1;
    return 0;
}