]> hackdaworld.org Git - my-code/ivac.git/commitdiff
-
authorhackbard <hackbard>
Sun, 16 Feb 2003 01:48:17 +0000 (01:48 +0000)
committerhackbard <hackbard>
Sun, 16 Feb 2003 01:48:17 +0000 (01:48 +0000)
Makefile
dfb_api.c

index c24c2f996bc84c1f57f3d21e4c8068bc131010c6..432f72a3b9b1d643b05b8d6042ebda2937d2ebd8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 
 INCLUDEDIR = /usr/include
 
-CFLAGS = -DDEBUG -O3 -Wall -I/usr/X11/include -I/usr/include/directfb -DVIDEO_DEV=\"/dev/video\"
+CFLAGS = -DDEBUG -O3 -Wall -I/usr/X11/include -I/usr/include/directfb -DVIDEO_DEV=\"/dev/v4l/video0\"
 LIBS = -L/usr/X11/lib -L/usr/lib/directfb-0.9.15 -lX11 -lXext -ldirectfb
 
 OBJS = minirgb.o webcam.o
index 00bc88c0bd1cb51c1c8f233f1dd9a29cc730e0fd..6583652551711be5823914f60b9421096eaf5b29 100644 (file)
--- a/dfb_api.c
+++ b/dfb_api.c
@@ -28,7 +28,7 @@ IDirectFBVideoProvider *video_provider = NULL;
 int screen_width  = 0;
 int screen_height = 0;
 
-char dfb_video_dev[]="/dev/v4l/video0";
+char dfb_video_dev[]=VIDEO_DEV;
 char text_top[]="Internet Video / Audio Conferencing";
 char dfb_image[]="./images/ivac_logo.png";
 char dfb_font[]="./fonts/decker.ttf";
@@ -111,6 +111,30 @@ int release_dfb(void) {
  return 1;
 }
 
+int blit_surface(IDirectFBSurface *source,int x,int y) {
+ primary->Blit(primary,source,NULL,x,y);
+ return 1;
+}
+
+int blit_logo(void) {
+ int x,y;
+ get_surface_size(logo,&x,&y);
+ printf("size of logo width/height: %d/%d\n",x,y);
+ blit_surface(logo,((screen_width-x)/2),((screen_height-y)/2));
+ return 1;
+}
+
+int blit_video(void) {
+ int x,y;
+ get_surface_size(video,&x,&y);
+ blit_surface(video,((screen_width-x)/2),((screen_height-y)/2));
+ return 1;
+}
+
+int flip_it(void) {
+ primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC);
+ return 1;
+}
 
 /* test api app */
 int main (int argc, char **argv) {
@@ -120,20 +144,26 @@ int main (int argc, char **argv) {
  check_accel();
 
  create_primary_surface();
- printf("primary surface created\n");
 
  // create_video_surface();
  create_logo_surface();
 
  get_primary_surface_size();
+ printf("primary surface width/height: %d/%d\n",screen_width,screen_height);
 
  clear_screen(primary);
 
// primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC);
blit_logo();
 
- sleep(5);
+ flip_it();
+
+ sleep(10);
+
+ release_surface(logo);
 
  release_surface(primary);
 
+ release_dfb();
+
  return 1;
 }