From 3d01f06a186ec5571fb6e3337d24432a96f8e8a2 Mon Sep 17 00:00:00 2001 From: hackbard Date: Sun, 16 Feb 2003 01:48:17 +0000 Subject: [PATCH] - --- Makefile | 2 +- dfb_api.c | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c24c2f9..432f72a 100644 --- 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 diff --git a/dfb_api.c b/dfb_api.c index 00bc88c..6583652 100644 --- 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; } -- 2.39.2