Hello all,

I'm using LibVLC player and sending the video to directfb (--vout=directfb)
inside X11 window, the base code is the tutorial in
http://wiki.videolan.org/LibVLC_SampleCode_Qt , this working perfectly, now
I want that this application must create a surface and do some drawings, to
test this I modified the main.cpp (shown bellow) from this tutorial and add
some DirectFB code to create a primary surface again (I'm using Fusion) and
do some draw, I have to do this because the super surface and primary
surface are not accessible from outside VLC DirectFB plugin, When I run this
app it shows only my little red square in left-upper corner 640x480 black
square in center of video window, I want that my "new primary surface" have
a transparent background but nothing that I do a transparent background...

Thanks for any help.


/* libVLC and Qt sample code
 * Copyright © 2009 Alexander Maringer <[email protected]>
 */

#include "vlc_on_qt.h"
#include <stdio.h>
#include <directfb.h>
#include <QtGui/QApplication>

IDirectFB *p_directfb = NULL;
IDirectFBSurface *p_primary = NULL;
IDirectFBSurface *p_secondary = NULL;
DFBSurfaceDescription dsc;

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Player p;
    p.resize(640,480);
    p.playFile(argv[1]); // Replace with what you want to play
    p.show();

    sleep(2);

   /*we don't need DirectFBInit() because LibVLC directfb plugin does*/

    if( DirectFBCreate( &p_directfb ) != DFB_OK )
        fprintf(stderr, "***************************Cannot create DFB super
interface.\n");
    else {
            p_directfb->SetCooperativeLevel(p_directfb, DFSCL_NORMAL);

            dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS |
DSDESC_HEIGHT | DSDESC_WIDTH);
            dsc.caps  = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY |
DSCAPS_SHARED | DSCAPS_PREMULTIPLIED);
            dsc.width = 640;
            dsc.height = 480;
            if( p_directfb->CreateSurface( p_directfb, &dsc, &p_primary ) !=
DFB_OK )
                fprintf(stderr, "***************************Cannot create
DFB primary surface.\n");
            else {
                fprintf(stderr, "***************************Created DFB
primary surface.\n");
                p_primary->SetDrawingFlags(p_primary, DSDRAW_BLEND);
                p_primary->SetPorterDuff(p_primary, DSPD_SRC);
                p_primary->SetColor(p_primary, 0x00, 0x00, 0x00, 0x00);
                p_primary->FillRectangle(p_primary, 0, 0, dsc.width,
dsc.height);
                p_primary->Flip( p_primary, NULL,
(DFBSurfaceFlipFlags)DSFLIP_ONSYNC );
                fprintf(stderr, "***************************Wait before
draw.\n");
                sleep(4);
                p_primary->SetColor( p_primary, 255, 0, 0, 0xff );
                p_primary->DrawRectangle( p_primary, 0, 0, 150, 150 );
                p_primary->FillRectangle( p_primary, 0, 0, 150, 150 );
                p_primary->Flip( p_primary, NULL,
(DFBSurfaceFlipFlags)DSFLIP_ONSYNC );
            }
    }

    return a.exec();
}
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to