From 38a94016ecd0208d5475d31a7df3b684b1891ba1 Mon Sep 17 00:00:00 2001 From: hackbard Date: Tue, 26 Aug 2003 18:23:39 +0000 Subject: [PATCH] - --- dfbapi.c | 41 ++++++++++++++++++++++++++++++----------- dfbapi.o | Bin 960 -> 1096 bytes ivac.c | 33 ++++----------------------------- ivac.h | 16 ++++++++-------- 4 files changed, 42 insertions(+), 48 deletions(-) diff --git a/dfbapi.c b/dfbapi.c index 45960be..7de46c3 100644 --- a/dfbapi.c +++ b/dfbapi.c @@ -8,29 +8,48 @@ #include #include "ivac.h" +// do +// int flip_blit_callback() +// int dfb_play_video() +// int dfb_stop_video() + int dfb_init(int arg_c,char **arg_v,struct ivac *ivac) { - DFBSurfaceDescription surface_dsc; - DFBFontDescription font_dsc; - + DFBSurfaceDescription sdsc; + // DFBFontDescription fdsc; + DFBWindowDescription wdsc; + + /* init */ 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)); + /* input devices and event stuff */ + ivac->dfb_stuff.dfb->GetInputDevice(ivac->dfb_stuff.dfb,DIDID_MOUSE,&(ivac->dfb_stuff.mouse)); + ivac->dfb_stuff.dfb->GetInputDevice(ivac->dfb_stuff.dfb,DIDID_KEYBOARD,&(ivac->dfb_stuff.keyboard)); + ivac->dfb_stuff.mouse->CreateEventBuffer(ivac->dfb_stuff.mouse,&(ivac->dfb_stuff.buffer)); - font_dsc.flags=DFDESC_HEIGHT; - font_dsc.height=ivac->dfb_stuff.s_height/20; + /* first window -- video window */ + ivac->dfb_stuff.dfb->GetDisplayLayer(ivac->dfb_stuff.dfb,DLID_PRIMARY,&(ivac->dfb_stuff.layer)); ivac->dfb_stuff.dfb->CreateVideoProvider(ivac->dfb_stuff.dfb,ivac->video_dev,&(ivac->dfb_stuff.v_provider)); + ivac->dfb_stuff.v_provider->GetSurfaceDescription(ivac->dfb_stuff.v_provider,&sdsc); + + wdsc.flags=DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT; + wdsc.posx=0; + wdsc.posy=0; + wdsc.width=sdsc.width; + wdsc.height=sdsc.height; + + ivac->dfb_stuff.layer->CreateWindow(ivac->dfb_stuff.layer,&wdsc,&(ivac->dfb_stuff.v_window)); + ivac->dfb_stuff.v_window->GetSurface(ivac->dfb_stuff.v_window,&(ivac->dfb_stuff.v_surface)); + ivac->dfb_stuff.v_window->SetOpacity(ivac->dfb_stuff.v_window,0xff); + ivac->dfb_stuff.v_provider->PlayTo(ivac->dfb_stuff.v_provider,ivac->dfb_stuff.v_surface,NULL,NULL,NULL); 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.v_window->Release(ivac->dfb_stuff.v_window); + ivac->dfb_stuff.layer->Release(ivac->dfb_stuff.layer); ivac->dfb_stuff.dfb->Release(ivac->dfb_stuff.dfb); return 1; diff --git a/dfbapi.o b/dfbapi.o index c1ce11098cb7b81cb94ea95c49b2b480d7533884..4dc8798882973ab50f1d17fdd4c5fc0e70f7d18c 100644 GIT binary patch delta 394 zcmX@Weu86y0^^T~imHqy6WwL&dxLelxjREtIF7rhurM+(Fm&>${0}tf4c6%91_=R0 z7(mi6VS{dO9Uz|t%$Mj5X2GINqc@lbVrXx$30$#5Z|I3`Zyq>bpf_0Lc)jZZkPY3g z7mmBGFaxo?SwPnHhOX#z-O%lN1*-hG>mHE0PS-8}15(>xB|AW#j*dM%p|?bhA++;p^Ba!N z*gxH|9No@5VACf4)|{-$*v^#AIC&kT5|ahXiSDxX-OR^bR9F}p7#KQPRQ?C>^aisWcReErHBs=?zxs_GSUg2FpNY{|5@}N>58mJMOxI38dLuq4UJ|SDh!i zxexx32kJifi&^tfXXu9BV3Fp-7M(FbBY~#>mk4xdK9aHnWN>us;n2>f&2Kn5WB+u= zPHth;oVjt37Mw5Rs`vU;SL3 diff --git a/ivac.c b/ivac.c index d4e1581..a9f270e 100644 --- a/ivac.c +++ b/ivac.c @@ -22,27 +22,12 @@ int usage(void) { 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; + DFBInputDeviceKeyState quit; + + quit=DIKS_UP; /* default */ strcpy(ivac.video_dev,VIDEO_DEV); @@ -75,19 +60,9 @@ int main(int argc, char **argv) { 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); + getchar(); dfb_tini(&ivac); - puts("debug: dfb tini done!!"); return 1; } diff --git a/ivac.h b/ivac.h index beb9b82..030b144 100644 --- a/ivac.h +++ b/ivac.h @@ -19,15 +19,14 @@ struct dfb_stuff { IDirectFB *dfb; - IDirectFBSurface *p_surface; - IDirectFBFont *font; - IDirectFBInputDevice *keyboard; - IDirectFBEventBuffer *k_buffer; - IDirectFBVideoProvider *v_provider; + IDirectFBDisplayLayer *layer; IDirectFBImageProvider *i_provider; - int s_width,s_height; - DFBRectangle rect; - int count; + IDirectFBVideoProvider *v_provider; + IDirectFBWindow *window,*v_window;; + IDirectFBSurface *v_surface,*i_surface,*surface; + IDirectFBFont *font; + IDirectFBInputDevice *keyboard,*mouse; + IDirectFBEventBuffer *buffer; }; struct ivac { @@ -35,6 +34,7 @@ struct ivac { char video_dev[MAX_CHAR_VIDEO_DEV]; char audio_dev[MAX_CHAR_AUDIO_DEV]; unsigned char flags; + int count; }; -- 2.39.2