How to implement qt/embedded + gstreamer in imx6 with alpha function?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to implement qt/embedded + gstreamer in imx6 with alpha function?

Jump to solution
7,118 Views
lonsn
Contributor I

Hi,

I want to implement a qt program including a window to play video using gstreamer. As I know the UI area above the video windows should be transparent.

Timesys theater system is a sample to do this. fb0 is qt program and fb2 is gstreamer video(mfw_v4lsink). But it only support global alpha and color key in fb0. I think I need to  to pixel alpha which can then be supported by qt.

How can implement this function, should I shoud mfw_isink or I can implement with mfw_v4lsink.

Regards,

0 Kudos
Reply
1 Solution
1,637 Views
hongdong_chu
NXP Employee
NXP Employee

Here is an example to config frame buffer for alpha in pixel  function, you can have a try.

retval = ioctl(fd, FBIOGET_VSCREENINFO, &fb_var);
if (retval < 0)
{
       printf("fb ioctl FBIOGET_VSCREENINFO fail\n");
}

fb_var.xres = 1280;
fb_var.yres = 720;
fb_var.bits_per_pixel = 32;
fb_var.activate |= FB_ACTIVATE_FORCE;
fb_var.nonstd = v4l2_fourcc('A', 'B', 'G', 'R');
fb_var.red.offset = 24;
fb_var.red.length = 8;
fb_var.green.offset = 16;
fb_var.green.length = 8;
fb_var.blue.offset = 8;
fb_var.blue.length = 8;
fb_var.transp.offset = 0;
fb_var.transp.length = 8;

fb_var.xres_virtual = fb_var.xres;
fb_var.yres_virtual = fb_var.yres * 3;
fb_var.yoffset = 0;

retval = ioctl(fd, FBIOPUT_VSCREENINFO, &fb_var);
if (retval < 0)
{
       printf("fb ioctl FBIOPUT_VSCREENINFO fail\n");
}

loc_alpha.enable = 1;
loc_alpha.alpha_in_pixel = 1;
retval = ioctl(fd, MXCFB_SET_LOC_ALPHA, &loc_alpha);
if (retval < 0)
{
       printf("fb ioctl MXCFB_SET_LOC_ALPHA fail\n");
}
ioctl(fd, MXCFB_WAIT_FOR_VSYNC, 0);
ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK);

View solution in original post

0 Kudos
Reply
3 Replies
1,637 Views
sudiptasubudhi
Contributor III

Hi Ionsn,

I am trying to overlay 2D graphics on top of video output(using gstreamer). i went through this discussion and i have some queries:

1. Could you please help me to know what headers are required in the application because i am getting errors like:

error: 'MXCFB_SET_CLR_KEY' undeclared (first use in this function)

  if ( ioctl(fd_fb, MXCFB_SET_CLR_KEY, &color_key) < 0) {

2. Should i write one single application for the video output and the 2D graphics overlayed or different applications?

Thanks in advance.

0 Kudos
Reply
1,637 Views
lonsn
Contributor I

Now I can add local alpha with following code:

        ioctl(fb0_fd, FBIOBLANK, FB_BLANK_NORMAL);

        loc_alpha.enable = 1;

        loc_alpha.alpha_in_pixel = 1;

        result = ioctl(fb0_fd, MXCFB_SET_LOC_ALPHA, &loc_alpha);

        if (result < 0)

        {

                printf("fb ioctl MXCFB_SET_LOC_ALPHA fail\n");

                //goto err1;

        }

        ioctl(fb0_fd, MXCFB_WAIT_FOR_VSYNC, 0);

        ioctl(fb0_fd, FBIOBLANK, FB_BLANK_UNBLANK)

But with this settings, I can only see the video and QT program at the same time in 16bpp mode(But the qt text above video is not very clear).

root@freescale ~$ fbset

mode "1280x720-60"

        # D: 74.250 MHz, H: 45.000 kHz, V: 60.000 Hz

        geometry 1280 720 1280 720 16

        timings 13468 220 110 20 5 40 5

        accel false

        rgba 5/11,6/5,5/0,0/0

endmode

root@freescale ~$ fbset -fb /dev/fb2

mode "1280x720-54"

        # D: 64.998 MHz, H: 40.624 kHz, V: 53.594 Hz

        geometry 1280 720 1280 768 16

        timings 15385 220 40 21 7 60 10

        accel false

        rgba 5/11,6/5,5/0,0/0

endmode

After I change the kernel command line to 32bpp:

console=ttymxc1,115200 video=mxcfb0:dev=hdmi,1280x720M@60,if=RGB24,bpp=32

or using fbset -depth 32,

then I can only see the QT graphic and I cann't see the video.

How can I make the correct settings to let QT and video be visible at the same time? I want to use QT widget's transparency to control the alpha effect.

Regards,

0 Kudos
Reply
1,638 Views
hongdong_chu
NXP Employee
NXP Employee

Here is an example to config frame buffer for alpha in pixel  function, you can have a try.

retval = ioctl(fd, FBIOGET_VSCREENINFO, &fb_var);
if (retval < 0)
{
       printf("fb ioctl FBIOGET_VSCREENINFO fail\n");
}

fb_var.xres = 1280;
fb_var.yres = 720;
fb_var.bits_per_pixel = 32;
fb_var.activate |= FB_ACTIVATE_FORCE;
fb_var.nonstd = v4l2_fourcc('A', 'B', 'G', 'R');
fb_var.red.offset = 24;
fb_var.red.length = 8;
fb_var.green.offset = 16;
fb_var.green.length = 8;
fb_var.blue.offset = 8;
fb_var.blue.length = 8;
fb_var.transp.offset = 0;
fb_var.transp.length = 8;

fb_var.xres_virtual = fb_var.xres;
fb_var.yres_virtual = fb_var.yres * 3;
fb_var.yoffset = 0;

retval = ioctl(fd, FBIOPUT_VSCREENINFO, &fb_var);
if (retval < 0)
{
       printf("fb ioctl FBIOPUT_VSCREENINFO fail\n");
}

loc_alpha.enable = 1;
loc_alpha.alpha_in_pixel = 1;
retval = ioctl(fd, MXCFB_SET_LOC_ALPHA, &loc_alpha);
if (retval < 0)
{
       printf("fb ioctl MXCFB_SET_LOC_ALPHA fail\n");
}
ioctl(fd, MXCFB_WAIT_FOR_VSYNC, 0);
ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK);

0 Kudos
Reply