On Saturday 06 March 2010 17:26:32 Mile Davidovic wrote:
> Hello
> I am wondering if someone has managed to create small Qt based app
> which can deal with video (I want to have OSD and video in same time).
> 
> What can be best starting point for this?
> 

Hi,

I'm integrating GStreamer with Qt. Since GStreamer-ti plugins provide 
acceleration for GStreamer, this combination has everything I need. 

Following can be a starting point:

1) Create a filesystem image from Narcissus[1]. Most of the DaVinci processors 
   are present. My suggestion is to use unstable branch. Either select 
   gstreamer-ti plugins while creating the image or install those while 
   running on your device. Package list can be found at [2].

2) Try gstreamer plugins using the command line, i.e. gst-launch. Many example 
    pipelines can be found at [3]. Some examples present at the filesystem as 
    well.

3) After deciding which pipelines are suitable for your case, set-up an 
   OpenEmbedded environment. This will permit you compile your own 
   applications with Qt.

4) Write your Qt application and integrate your pipelines you decided in step 
    2 using 'gst_parse_launch' command from GStreamer library. More 
    information and examples about using GStreamer can be found at [4].

5) Use attribute window for controlling video and osd layers in your 
   application. An example code is attached at the end of this mail.

Best regards,
Caglar

[1] http://www.angstrom-distribution.org/narcissus
[2] http://www.angstrom-distribution.org/repo/
[3] http://wiki.davincidsp.com/index.php/Example_GStreamer_Pipelines
[4] 
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html

___________________________________________________________________________

/**
 * DM6446 has separate framebuffers(windows) for OSD and Video layers.
 * This function controls attribute window for transparency adjustment.
 *
 * trans: A value between 0-127. 0 means Video visible, and 127 means OSD.
 * x: Start horizontal offset, must be multiple of 32.
 * y: Start vertical offset
 * width: Horizontal length, must be multiple of 32.
 * height: vertical length
 */
bool MainWindow::SetOsdTransparency(unsigned char trans, unsigned int x,
                unsigned int y, unsigned int width, unsigned int height)
{
        struct fb_var_screeninfo vScreenInfo;
        struct fb_fix_screeninfo fScreenInfo;
        unsigned short          *attrDisplay;
        int                      attrSize;
        /*
         * Check parameters
         */
        if(((x & 31) != 0) || ((width & 31) != 0)) {
                qDebug() << "Wrong tranparency width/x values";
                return false;
        }
        int fd = open("/dev/fb2", O_RDWR);
        if(fd < 0) {
                qDebug() << "Error opening attribute window";
                return false;// err;
        }

        if (ioctl(fd, FBIOGET_FSCREENINFO, &fScreenInfo) == -1) {
                ::close(fd);
                qDebug() << "Unable to get screen info";
                return false;
        }

        if (ioctl(fd, FBIOGET_VSCREENINFO, &vScreenInfo) == -1) {
                qDebug() << "Unable to get screen info";
                ::close(fd);
                return false;
        }

        attrSize = fScreenInfo.line_length * vScreenInfo.yres;
        /* Map the attribute window to this user space process */
        attrDisplay = (unsigned short *) mmap(NULL, attrSize,
                        PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
        if (attrDisplay == MAP_FAILED) {
                qDebug() << "Unable to map attribute window";
                ::close(fd);
        return false;
        }

        /* Fill the window with the new attribute value */
        if(height < vScreenInfo.yres) {
                for(unsigned int i = y; i < y + height; i++) {
                        int start = fScreenInfo.line_length * i + x / 2;
                        int size = (width + x) / 2 < fScreenInfo.line_length ?
                                        width / 2 : fScreenInfo.line_length - x 
/ 2;
                        memset(attrDisplay + start / 2, trans, size);
                }
        } else
                memset(attrDisplay, trans, attrSize);

        munmap(attrDisplay, attrSize);
        ::close(fd);

        return true;

}
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to