]> hackdaworld.org Git - my-code/ivac.git/commitdiff
buf size redueced to 1000 again
authorhackbard <hackbard>
Mon, 3 Feb 2003 12:41:58 +0000 (12:41 +0000)
committerhackbard <hackbard>
Mon, 3 Feb 2003 12:41:58 +0000 (12:41 +0000)
added dfb_api.c - first dfb experiences
added logo

Makefile
dfb_api.c [new file with mode: 0644]
receive.c
stream.c

index 9be9376640324aa0eba53bbe285b5a584f2ca9cc..c24c2f996bc84c1f57f3d21e4c8068bc131010c6 100644 (file)
--- 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 (file)
index 0000000..0641534
--- /dev/null
+++ b/dfb_api.c
@@ -0,0 +1,72 @@
+/*
+ * dfb_api.c - api to dfb interface
+ */
+
+/* std includes */
+#include <stdio.h>
+#include <unistd.h>
+
+/* dfb includes */
+#include <directfb.h>
+
+/* 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;
+}
+
index 9bd11f86cda602b9c9a3a7ff64964c832704a5b8..5c6e7dd46863ec638974f9ce40d629d09aa6c268 100644 (file)
--- a/receive.c
+++ b/receive.c
@@ -27,7 +27,7 @@
 #include <unistd.h>
 
 /* defines ... */
-#define MAX_SIZE 1400
+#define MAX_SIZE 1000
 
 int main(int argc, char *argv[]) {
   int receive_fd;
index 2320b13e2c63ef98e8a3570a87376ac3b310c0b5..b97a670e77a10f78c5750c0c6ee9afd88b8f02b7 100644 (file)
--- a/stream.c
+++ b/stream.c
@@ -27,7 +27,7 @@
 #include <unistd.h>
 
 /* defines ... */
-#define MAX_SIZE 1400
+#define MAX_SIZE 1000
 
 int main(int argc, char *argv[]) {
   int listen_fd, send_fd;