This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Menu overlay with video

My application requires that I have a video playing in the background and when prompted by the user, the video should be grayed out a menu laid over it. I have use the saLoopBackFbdev application and got video showing up on /dev/fb0 (HDMI connection to a LCD) working great. I've also modified the test application and added global alpha blending to gray out the video as needed on the fly. I've tested that I can do this with the video going and I don't see any issues.

Now I'm trying to figure out the next step of overlaying the menu, which will be created in Qt, on top of the video showing up on /dev/fb0. I've read a bunch of posts kinda related to this with references to being able to overlay video and so on, but I'd love some steps or code pointers on how to do this.

So far I've seen:

http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/153110.aspx

http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/207351.aspx

http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/p/113606/402616.aspx#402616

I've talked to a bunch of folks and some have suggested using 2 frame buffers, fb0 for the video and fb1 for the menu and having the hardware combine (blend?) them together and show it on fb0 or something. Any more on how this might work would be great.

Thanks

~Ashwin

  • Does anybody have any ideas for me to try? Have video on /dev/fb0 and Qt menu on /dev/fb1 and somehow combine them and send them to the HDMI output or the S-Vdieo output?

  • Hi,

    I am not sure about QT, but you can create two applications one for /dev/fb0 and other for /dev/fb1. you can do blending between fb0 and fb1. Please refer to beloe driver guide on how to route both fbdev to same encoders like HDMI or SD.

    http://processors.wiki.ti.com/index.php/TI81XX_PSP_VPSS_Video_Driver_User_Guide

  • Hi Ashwin,

    By default QT works with /dev/fb0.

    For you application, why don't you design a QT dialogue such that it will have gray (transparent) background with menus  (buttons/select box etc.). I think you can achieve this using single frame-buffer (QT default /dev/fb0).

    P.S. I have not done this with Netra but yes, done in past with other Davinci SoC.

    Is there any specific reason to use two framebuffers?

    Regards,

    Krunal

  • Hi Hardik,

    OK, this is what I ended up getting going yesterday and it does work OK. I can have my video playing on /dev/fb0 and throw up something else on /dev/fb1 and both of them show up on the HDMI output. I can further alpha blend /dev/fb0 with a alpha value to darken the video and give the contents of /dev/fb1 more focus..

    To achieve the right focus, I wanted to use some transparency. Reading through the description there and looking at the pictures with alpha blending and transparency, can you tell me what transparency settings out achieve the outcome of those pictures? 

    ~Ashwin

  • Hi Krunal,

    I'm less worried about which fb to use since I call get Qt to use any of the 3 available. I can design the Qt application to have a transparent background, but I still need the video playing in the background as well? How would I go about achieving that if /dev/fb0 is used by Qt, use /dev/fb1? Am I missing something?

    ~Ashwin

  • Hi Ashwin,

    In that case using video layer (/dev/video*) for video playback will be better idea. Frame-buffer layer will be automatically overlaid over video layer and both layers can run simultaneously. This is possible and can be achieved easily.

    You can try running "saMmapDisplay.c" and "saFbdevDisplay.c" simultaneously to do this. (of-course, first process must be running in background).

    Please note video playback on FB display is also possible but from performance point of view you should use Video Windows and video playback and FB for graphics.

    Regards,

    Krunal

  • Hi Krunal,

    I can use the default applications to work and show information out on HDMI LCD. However, I'm trying to figure out how to gray out the output of saMmapDisplay so that the contents of saFbdevDisplay show up nice and bright and the background is grayed out.

    I've looked at the link that Hardik has in his post above and when not sure what my RGB key for transparency should be with a alpha value of about 50 or so to get the output in this[1] image.

    ~Ashwin

    [1] - http://processors.wiki.ti.com/index.php/File:Transparency-0.png

  • Hi, Ashwin

     

    So sorry to bother you.

    I'm a new with dm814x.

    And I want to do the same issue with you.(qt on fb0 and viideo on fb1)

    Would you give me some steps to do this??

    Thanks a lot... 

  • Hi Kaichun,

    My configuration is video on fb0 and Qt application on fb1 (you can flip them around and just have to change which FB you are talking to when you use my commands/settings)..

    For the video, I used something like what's in saLoopbackFbdev to display the video on FB0 by default. When I want to dim the video, I apply a global alpha blend with the following code:

    ioctl(fbdev.fd, TIFB_GET_PARAMS, &regp);
    regp.blendtype = TI81XXFB_BLENDING_GLOBAL;
    regp.blendalpha = alpha;
    ioctl(fbdev.fd, TIFB_SET_PARAMS, &regp);

    The alpha value ranges from 0 to 255. With 0 being completely opaque and 255 being fully transparent.

    Now in my Qt application, I start it with "-display LinuxFb:/dev/fb1" command line parameter and in the application's main.cpp file I set up the transparency key as the following:

    ioctl(fdfb1, TIFB_GET_PARAMS, &regp);

    // Enable the transparency keying
    regp.transen = TI81XXFB_FEATURE_ENABLE;
    regp.transcolor = 0x000000; // Color key is black
    ioctl(fdfb1, TIFB_SET_PARAMS, &regp);

    I open up /dev/fb1 and set the transparency key to black. In my application where I want the video to show up, I create an empty QWidget and using a stylesheet, I set the background-color to be rgb(0,0,0). This means that the area covered by the QWidget will be fully transparent and video will show up nicely within that space, everywhere else the contents of FB1 will be overlayed/blended with the video on FB0.

    For my development right now I'm  using the HDMI output of the DM8148, so I set graphics[0/1]/nodes to 1:hdmi and display[0/1]/timings, output to 1080P60..

    Hope this helps you out..

  • Hi, Ashwin

    Thanks a lot of your reply. It's very help for me.

    I can get FB0/FB1 togerther output to HDMI.

    But....there are noice output to HDMI. I don't know why....

    I have two application. One is saLoopBackFbdev, the other one is qt application.

     Qt application just shows the buttons down side in  the picture. And saLoopBackFbdev shows the patten up side  in the picture.

    First I run saLoopBackFbdev and it shows patten.

    Then I excute qt, and patten is wrong...but button is OK...

    Have you ever been experienced in that??

    P.S. graph[0/1] node → 1:hdmi,    display0 mode → 1080P-60 , anything I miss?

    Sorry to bother...again.....

    And Thanks a lot.

  • Hi Kaichun,

    Can you run saLoopbackFbdev and your Qt application indepently on FB0 and FB1 and have no issue? I'm not sure what noise you are seeing on the screen, but ensure that you've used "fbset" to set the proper resolution and bit depth of both FBs.

    I use "fbset -depth 24" and "fbset -depth 24 -fb /dev/fb1" in my /etc/init.d/load-v4l2-firwmare.sh script to setup the FBs before using the application. By default the FBs end up in 32bit depth and that messes up the colors since saLoopbackFbdev is configuring the video for 24 bits..

    ~Ashwin

  • Hi,

    we understand that /dev/fb0 and /dev/fb1 can be blended and feed to the same encoder.

    We have a different situation. We have video on /dev/video0 and a graphical element on /dev/fb0. How can we blend this graphical element to this video ?

    Do we have provision for that? In this situation, whether global alpha support can be enabled for graphic pipeline ?

    I have attached my situation in below figure:

    Here, The graphical element is text, which is having 0 transparency, and it is not at all blending with the background video.

  • I would say text may be blended but not transparent with the background as its showing default frame buffer color . my doubt is do we need to send video frames to graphics core to make it transparent with graphical elements ?

  • Hi

    You have to set the blending type=0x03 for doing pixel blending(ie object blending), refer the datasheet of HDVPSS (pg n0:339---> regional descriptor of graphics).

  • Hi prabin ,

    thanks for the support . can u please explain this how the blending type will effect the current situation
  • Hi vishnu
    when blend_type=0x03 we are just setting that corresponding graphics layer as pixel blending, which enables the user can do object blending in that layer(Means we can make transparent/semi_transparent/opaque to particular object only).make sure your SDK having the support for FBDEV IOCTL.
    The API used for setting this FBDEV params are shown belos
    regp.blend_type=0x03;
    if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {
    perror ("TIFB_SET_PARAMS.\n");
    close(fd);
    exit(1);
    }

  • Hi vishnu
    if you are aiming for object blending in a particular graphics layer do the following....
    when blend_type=0x03 we are just setting that corresponding graphics layer as pixel blending, which enables the user can do object blending in that layer(Means we can make transparent/semi_transparent/opaque to particular object only).make sure your SDK having the support for FBDEV IOCTL.
    The API used for setting this FBDEV params are shown belos
    regp.blend_type=0x03;
    if (ioctl(fd, TIFB_SET_PARAMS, &regp) < 0) {
    perror ("TIFB_SET_PARAMS.\n");
    close(fd);
    exit(1);
    }
  • hi prabin ,
    thanks for the quick responce let me check and update u.
  • It Works, Thanks Prabin.