the videos can change only if I drop the mouse over it,
Is there a API to control refresh??
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <directfb.h>
static IDirectFB *dfb;
static IDirectFBDisplayLayer *layer;
static IDirectFBImageProvider *provider;
static IDirectFBVideoProvider *videoprovider;
static IDirectFBWindow *videowindow;
static IDirectFBSurface *videosurface;
static IDirectFBWindow *dfbwindow;
static IDirectFBSurface *dfbsurface;
static IDirectFBInputDevice *mouse;
static IDirectFBInputDevice *keyboard;
static IDirectFBEventBuffer *mouse_events;
int err;
/* macro for a safe call to DirectFB functions */
#define DFBCHECK(x...) \
{ \
err = x; \
if (err != DFB_OK) { \
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
DirectFBErrorFatal( #x, err ); \
} \
}
int main( int argc, char *argv[] )
{
DFBDisplayLayerConfig layer_config;
DFBInputDeviceKeyState quit = DIKS_UP;
DFBCHECK(DirectFBInit( &argc, &argv ));
if (argc < 2) {
fprintf(stderr, "%s: you must specify a video source\n", argv[0]);
return 1;
}
DFBCHECK(DirectFBCreate( &dfb ));
DFBCHECK(dfb->GetInputDevice( dfb, DIDID_MOUSE, &mouse ));
DFBCHECK(dfb->GetInputDevice( dfb, DIDID_KEYBOARD, &keyboard ));
DFBCHECK(mouse->CreateEventBuffer( mouse, &mouse_events ));
DFBCHECK(dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer ));
{
DFBSurfaceDescription sdsc;
DFBWindowDescription desc;
DFBCHECK(dfb->CreateVideoProvider( dfb, argv[1],
&videoprovider ));
videoprovider->GetSurfaceDescription( videoprovider, &sdsc );
desc.flags = DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT;
desc.posx = 0;
desc.posy = 0;
desc.width = sdsc.width;
desc.height = sdsc.height;
DFBCHECK(layer->CreateWindow( layer, &desc, &videowindow ) );
DFBCHECK(videowindow->GetSurface( videowindow, &videosurface ) );
videowindow->SetOpacity( videowindow, 0xFF );
DFBCHECK(videoprovider->PlayTo( videoprovider, videosurface,
NULL, NULL, NULL ));
}
{
DFBWindowDescription desc;
desc.flags = DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH |
DWDESC_HEIGHT | DWDESC_CAPS;
desc.posx = 0;
desc.posy = 20;
desc.width = 275;//512;
desc.height = 116;//145;
desc.caps = DWCAPS_ALPHACHANNEL;
DFBCHECK(layer->CreateWindow( layer, &desc, &dfbwindow ) );
DFBCHECK(dfbwindow->GetSurface( dfbwindow, &dfbsurface ) );
DFBCHECK(dfb->CreateImageProvider( dfb, DATADIR"/shot.png",
&provider ));
DFBCHECK(provider->RenderTo( provider, dfbsurface, NULL ));//try to play
provider->Release( provider );
dfbwindow->SetOpacity( dfbwindow, 0xFF );
}
layer->GetConfiguration( layer, &layer_config );
while (quit == DIKS_UP) {
DFBInputEvent ev;
int movx = 0;
int movy = 0;
keyboard->GetKeyState( keyboard, DIKI_ESCAPE, &quit );
}
videoprovider->Release( videoprovider );
dfbwindow->Release( dfbwindow );
layer->Release( layer );
dfb->Release( dfb );
return 42;
}
_______________________________________________ directfb-users mailing list [email protected] http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users
