[MPlayer-dev-eng] Clipping in mplayer

Gregoire Gentil gregoire at gentil.com
Thu Sep 10 09:29:44 CEST 2009


Hello,

We are using mplayer on an embedded system (Touch Book, similar to
OMAP3530 Beagleboard) and I have developed a mplayer libvo to output the
video to /dev/fb1. It's working quite well but I would like now to add
clipping support. Basically, when the mplayer window is going outside
the desktop, the video becomes green (YUV=0). The video driver doesn't
support clipping and XV is not mature enough on this platform. Bottom
line, I'm trying to implement clipping directly in my libvo:
http://cgit.openembedded.net/cgit.cgi/openembedded/tree/recipes/mplayer/files/vo_omapfb.c

I have modified the following function so that the output in fb1 is
clipped correctly:

static void omapfb_update(int x, int y, int out_w, int out_h, int show)
{
    if (!fb_overlay_only)
        x11_get_window_abs_position(mDisplay, vo_window, &x, &y, &out_w,
&out_h);

    if ( (x == 0 && y == 0 && out_w ==0 && out_h == 0) ||
        (out_w < sinfo.xres / 4) || (out_h < sinfo.yres / 4) ||  /* HW
can't scale down by more than 4x */
        (out_w > sinfo.xres * 8) || (out_h > sinfo.yres * 8) ) { /* HW
can't scale up by more than 8x */
        pinfo.enabled = 0;
        pinfo.pos_x = 0;
        pinfo.pos_y = 0;
        ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo);
        ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo);
        return;
    }

    /*Treating clipping when going outside of the desktop*/
    if (x < 0) {
	out_w += x;
        x = max(x, 0);
    }
    if (x + out_w > sinfo_p0.xres)
	out_w = sinfo_p0.xres - x;
    if (y < 0) {
	out_h += y;
        y = max(y, 0);
    }
    if (y + out_h > sinfo_p0.yres)
	out_h = sinfo_p0.yres - y;

    pinfo.enabled = show;
    pinfo.pos_x = x;
    pinfo.pos_y = y;
    pinfo.out_width  = out_w;
    pinfo.out_height = out_h;
    ioctl(dev_fd, OMAPFB_SETUP_PLANE, &pinfo);
    ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo);
}


My question is how can I tell mplayer to clip the video passed to my
libvo? Or should I do everything in draw_slice? The problem of
draw_slice is that sometimes there is only one slice for the whole
video, sometimes there are 16x16 squares.

Any advice would be appreciated!

Gregoire





More information about the MPlayer-dev-eng mailing list