--- /dev/null
+INCLUDEDIR = /usr/include
+CFLAGS = -O3 -Wall -I/usr/include/directfb
+LIBS = -L/usr/lib -ldirectfb
+
+OBJS = dfbapi.o
+OBJS2 = new_ivac
+
+new_ivac: $(OBJS)
+ $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) ivac.c
+
+all: new_ivac
+
+clean:
+ rm $(OBJS) $(OBJS2)
+
+remake: clean all
+
--- /dev/null
+/* dfb functions
+ *
+ * author: hackbard@hackdaworld.dyndns.org
+ *
+ */
+
+#include <stdio.h>
+#include <directfb.h>
+#include "ivac.h"
+
+int dfb_init(int arg_c,char **arg_v,struct ivac *ivac) {
+ DFBSurfaceDescription surface_dsc;
+ DFBFontDescription font_dsc;
+
+ DirectFBInit(&arg_c,&arg_v);
+ DirectFBCreate(&(ivac->dfb_stuff.dfb));
+ ivac->dfb_stuff.dfb->SetCooperativeLevel(ivac->dfb_stuff.dfb,DFSCL_FULLSCREEN);
+
+ surface_dsc.flags=DSDESC_CAPS;
+ surface_dsc.caps=DSCAPS_PRIMARY|DSCAPS_FLIPPING;
+ ivac->dfb_stuff.dfb->CreateSurface(ivac->dfb_stuff.dfb,&surface_dsc,&(ivac->dfb_stuff.p_surface));
+ ivac->dfb_stuff.p_surface->GetSize(ivac->dfb_stuff.p_surface,&(ivac->dfb_stuff.s_width),&(ivac->dfb_stuff.s_height));
+
+ font_dsc.flags=DFDESC_HEIGHT;
+ font_dsc.height=ivac->dfb_stuff.s_height/20;
+ ivac->dfb_stuff.dfb->CreateVideoProvider(ivac->dfb_stuff.dfb,ivac->video_dev,&(ivac->dfb_stuff.v_provider));
+
+ return 1;
+}
+
+int dfb_tini(struct ivac *ivac) {
+ ivac->dfb_stuff.v_provider->Release(ivac->dfb_stuff.v_provider);
+ ivac->dfb_stuff.p_surface->Release(ivac->dfb_stuff.p_surface);
+ ivac->dfb_stuff.dfb->Release(ivac->dfb_stuff.dfb);
+
+ return 1;
+}
+
--- /dev/null
+/* dfbapi.h
+ *
+ * author: hackbard@hackdaworld.dyndns.org
+ *
+ */
+
+/* function prototypes */
+int dfb_init(int arg_c,char **arg_v,struct ivac *ivac);
+int dfb_tini(struct ivac *ivac);
+
*/
#include <stdio.h>
-
+#include <string.h>
+#include <unistd.h>
+#include "ivac.h"
+#include "dfbapi.h"
// in development
+
+int usage(void) {
+ puts("usage: ivac <options>");
+ puts("options:");
+ puts("-h \t this help");
+ puts("-V \t <video device>");
+ puts("-A \t <audio device>");
+ puts("-v \t verbose debug output");
+ return 1;
+}
+
+int video_callback(void *ctx) {
+ struct ivac *ivac;
+ IDirectFBSurface *surf;
+ DFBSurfaceDescription desc;
+
+ ivac=ctx;
+ puts("debug: callback!");
+ ivac->dfb_stuff.v_provider->GetSurfaceDescription(ivac->dfb_stuff.v_provider,&desc);
+ printf("debug: w: %d -- h: %d\n",desc.width,desc.height);
+ ivac->dfb_stuff.dfb->CreateSurface(ivac->dfb_stuff.dfb,&desc,&surf);
+ ivac->dfb_stuff.p_surface->Blit(ivac->dfb_stuff.p_surface,surf,NULL,0,0);
+ ivac->dfb_stuff.p_surface->Flip(ivac->dfb_stuff.p_surface,NULL,DSFLIP_WAITFORSYNC);
+ ivac->dfb_stuff.count+=1;
+ if(ivac->dfb_stuff.count==5000)
+ ivac->dfb_stuff.v_provider->Stop(ivac->dfb_stuff.v_provider);
+ return DFENUM_OK;
+}
+
+int main(int argc, char **argv) {
+ int i;
+ struct ivac ivac;
+
+ /* default */
+ strcpy(ivac.video_dev,VIDEO_DEV);
+ strcpy(ivac.audio_dev,AUDIO_DEV);
+
+ for(i=1;i<argc;i++) {
+ if(argv[i][0]=='-') {
+ switch(argv[i][1]) {
+ case 'h':
+ usage();
+ break;
+ case 'V':
+ strcpy(ivac.video_dev,argv[++i]);
+ break;
+ case 'A':
+ strcpy(ivac.audio_dev,argv[++i]);
+ break;
+ case 'v':
+ ivac.flags|=VERBOSE_FLAG;
+ break;
+ default:
+ usage();
+ break;
+ }
+ } else usage();
+ }
+
+ if(dfb_init(argc,argv,&ivac)<0) {
+ puts("dfb init failed");
+ return -1;
+ }
+
+ puts("debug: dfb init done!!");
+
+ ivac.dfb_stuff.count=0;
+ ivac.dfb_stuff.rect.x=5;
+ ivac.dfb_stuff.rect.y=5;
+ ivac.dfb_stuff.rect.w=500;
+ ivac.dfb_stuff.rect.h=400;
+ ivac.dfb_stuff.v_provider->PlayTo(ivac.dfb_stuff.v_provider,ivac.dfb_stuff.p_surface,&(ivac.dfb_stuff.rect),video_callback,(void *)&ivac);
+
+ sleep(2);
+
+ dfb_tini(&ivac);
+ puts("debug: dfb tini done!!");
+
+ return 1;
+}
--- /dev/null
+/* internet video/audio conferencing
+ *
+ * author: hackbard@hackdaworld.dyndns.org
+ *
+ */
+
+#ifndef IVAC_H
+#define IVAC_H
+
+#define MAX_CHAR_VIDEO_DEV 64
+#define MAX_CHAR_AUDIO_DEV 64
+
+#define VIDEO_DEV "/dev/v4l/video0"
+#define AUDIO_DEV "/dev/sound/dsp"
+
+#define VERBOSE_FLAG 1
+
+#include <directfb.h>
+
+struct dfb_stuff {
+ IDirectFB *dfb;
+ IDirectFBSurface *p_surface;
+ IDirectFBFont *font;
+ IDirectFBInputDevice *keyboard;
+ IDirectFBEventBuffer *k_buffer;
+ IDirectFBVideoProvider *v_provider;
+ IDirectFBImageProvider *i_provider;
+ int s_width,s_height;
+ DFBRectangle rect;
+ int count;
+};
+
+struct ivac {
+ struct dfb_stuff dfb_stuff;
+ char video_dev[MAX_CHAR_VIDEO_DEV];
+ char audio_dev[MAX_CHAR_AUDIO_DEV];
+ unsigned char flags;
+};
+
+
+#endif /* IVAC_H */