From: hackbard Date: Mon, 3 Feb 2003 12:41:58 +0000 (+0000) Subject: buf size redueced to 1000 again X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a0f1529fb2086dbbb93b3d8164389c844d84fab;p=my-code%2Fivac.git buf size redueced to 1000 again added dfb_api.c - first dfb experiences added logo --- diff --git a/Makefile b/Makefile index 9be9376..c24c2f9 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,18 @@ INCLUDEDIR = /usr/include -CFLAGS = -DDEBUG -O3 -Wall -I/usr/X11/include -DVIDEO_DEV=\"/dev/video\" -LIBS = -L/usr/X11/lib -lX11 -lXext +CFLAGS = -DDEBUG -O3 -Wall -I/usr/X11/include -I/usr/include/directfb -DVIDEO_DEV=\"/dev/video\" +LIBS = -L/usr/X11/lib -L/usr/lib/directfb-0.9.15 -lX11 -lXext -ldirectfb OBJS = minirgb.o webcam.o OBJS2 = stream receive datagram dgramrcv +OBJS3 = dfb_api.o webcam: $(OBJS) $(CC) -o $@ $(OBJS) $(LIBS) - netstuff: $(OBJS2) - +ivac: $(OBJS3) + $(CC) -o $@ $(OBJS3) $(LIBS) all: webcam netstuff clean: diff --git a/dfb_api.c b/dfb_api.c new file mode 100644 index 0000000..0641534 --- /dev/null +++ b/dfb_api.c @@ -0,0 +1,72 @@ +/* + * dfb_api.c - api to dfb interface + */ + +/* std includes */ +#include +#include + +/* dfb includes */ +#include + +/* global stuff */ + +/* well ... */ +static IDirectFB *dfb = NULL; +/* surface */ +static IDirectFBSurface *primary = NULL; +static int screen_width = 0; +static int screen_height = 0; +static IDirectFBSurface *logo = NULL; +/* image to load */ +char dfb_image[]="./images/ivac_logo.png"; + +int main (int argc, char **argv) { + int i; + DFBSurfaceDescription dsc; + /* image provider */ + IDirectFBImageProvider *provider; + + /* init */ + DirectFBInit (&argc, &argv); + DirectFBCreate (&dfb); + dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN); + dsc.flags=DSDESC_CAPS; + dsc.caps=DSCAPS_PRIMARY | DSCAPS_FLIPPING; + dfb->CreateSurface(dfb,&dsc,&primary); + primary->GetSize(primary,&screen_width,&screen_height); + printf("debug: w/h = %d / %d\n",screen_width,screen_height); + + /* create the imag provider */ + dfb->CreateImageProvider(dfb,dfb_image,&provider); + /* get image/provider description */ + provider->GetSurfaceDescription(provider,&dsc); + printf("debug: w/h %d / %d\n",dsc.width,dsc.height); + /* create apropriate surface */ + dfb->CreateSurface(dfb,&dsc,&logo); + /* render image */ + provider->RenderTo(provider,logo,NULL); + + provider->Release(provider); + + /* slide logo */ + for(i = -dsc.width; i < screen_width; i++) { + /* clear screen */ + primary->FillRectangle(primary,0,0,screen_width,screen_height); + + /* blit image */ + primary->Blit(primary,logo,NULL,i,(screen_height-dsc.height)/2); + + /* flip */ + primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC); + } + + /* release image */ + logo->Release(logo); + + primary->Release(primary); + dfb->Release(dfb); + + return 23; +} + diff --git a/receive.c b/receive.c index 9bd11f8..5c6e7dd 100644 --- a/receive.c +++ b/receive.c @@ -27,7 +27,7 @@ #include /* defines ... */ -#define MAX_SIZE 1400 +#define MAX_SIZE 1000 int main(int argc, char *argv[]) { int receive_fd; diff --git a/stream.c b/stream.c index 2320b13..b97a670 100644 --- a/stream.c +++ b/stream.c @@ -27,7 +27,7 @@ #include /* defines ... */ -#define MAX_SIZE 1400 +#define MAX_SIZE 1000 int main(int argc, char *argv[]) { int listen_fd, send_fd;