Bu Bacoo wrote:
> Hello, I',m trying to play video in my C++ (DFB++ based) application,
> the same way, as it is done in DFB_extra samples, sample1 (the one
> without xine).
>
> When I'm linking, I have to use gcc instead of g++ for file using
> direct_hash_create, direct_hash_insert, direct_hash_iterate, because
> of having problems with linking.
>
> (Changing gcc to g++ for linking the samples shows the same problem).
>
> After creating .c, calling extern "C" files, etc, I made it, but the
> application is still segfaulting, etc, cannot make it work. I can get
> some video info, but no playing.
>
> Do you have please some sample, some piece of code, about how to play
> a video file with DFB++?
>
See the attached example program.
--
Regards,
Claudio Ciccani
[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb
#include <iostream>
#include <dfb++.h>
static IDirectFB *dfb;
static IDirectFBVideoProvider *video;
static IDirectFBDisplayLayer *layer;
static IDirectFBWindow *window;
static IDirectFBEventBuffer *buffer;
static IDirectFBSurface *surface;
static IDirectFBSurface *frame;
static void
frame_callback( void *ctx )
{
surface->StretchBlit( frame );
surface->Flip();
}
int
main( int argc, char **argv )
{
DFBSurfaceDescription s_dsc;
DFBWindowDescription w_dsc;
DirectFBInit( &argc, &argv );
if (argc < 2) {
std::cerr << "Usage: play <file>" << std::endl;
exit( 1 );
}
dfb = DirectFB::Create();
video = dfb->CreateVideoProvider( argv[1] );
video->GetSurfaceDescription( &s_dsc );
frame = dfb->CreateSurface( s_dsc );
w_dsc.flags = (DFBWindowDescriptionFlags)(DWDESC_WIDTH | DWDESC_HEIGHT);
w_dsc.width = s_dsc.width;
w_dsc.height = s_dsc.height;
layer = dfb->GetDisplayLayer( DLID_PRIMARY );
window = layer->CreateWindow( w_dsc );
buffer = window->CreateEventBuffer();
surface = window->GetSurface();
surface->Clear( 0, 0, 0, 0 );
surface->Flip();
window->SetOpacity( 0xff );
video->PlayTo( frame, NULL, frame_callback, NULL );
while (true) {
DFBWindowEvent e;
buffer->WaitForEvent();
buffer->GetEvent( DFB_EVENT(&e) );
switch (e.type) {
case DWET_KEYDOWN:
if (e.key_symbol != DIKS_ESCAPE)
break;
case DWET_CLOSE:
case DWET_DESTROYED:
video->Release();
buffer->Release();
window->Release();
surface->Release();
frame->Release();
layer->Release();
dfb->Release();
return 0;
default:
break;
}
}
return 0;
}
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users