[MPlayer-dev-eng] libvo2, 1st proposed spec
David Holm
dholm at telia.com
Sun Nov 18 14:55:55 CET 2001
David Holm wrote:
>Hi,
>here is the first proposed specification of how libvo2 should look. It's
>mostly written by Arpi but I have made some minor changes here and there.
>Please express your feelings, what's missing, what's superfluous etc.
>The libvo2 core isn't implemented at all so don't start writing/porting
>devices, especially since the interface is likely to change.
>
>What is defined in vo2_def.h are the only things needed to be implemented by
>the device developer (all format conversions etc are handled by the core)
>
>
>------------------------------------------------------------------------
>// include only from vo2_*.c drivers!
>
>static int control(void *p, int cmd, void* param);
>static int start(void *p, int w,int h,int format,int buffering,int flags);
>static int stop(void *p);
>static vo2_surface_t* get_surface(void *p, int num);
>static void flip_image(void *p, int num);
>
>static vo2_functions_t functions =
>{
> control,
> start,
> stop,
> get_surface,
> flip_image
>};
>
>static vo2_handle_t* new_handle()
>{
> vo2_handle_t* h=malloc(sizeof(vo2_handle_t));
> if(!h) return NULL;
> h->priv=malloc(sizeof(priv_t));
> if(!h->priv){ free(h); return NULL; }
> memset(h->priv,0,sizeof(priv_t));
> h->info=&info;
> h->functions=&functions;
> h->surface=NULL;
> return h;
>}
>
I myself propose we change new_handle() to:
static vo2_handle_t* new_handle( priv_t *priv )
{
vo2_handle_t* h=malloc(sizeof(vo2_handle_t));
if(!h) return NULL;
h->priv = priv;
h->info=&info;
h->functions=&functions;
h->surface=NULL;
return h;
}
since, priv_t might contain pointers etc a sizeof(priv_t) isn't
useful... and why memset it to 0 when perhaps some of it's members are
initialized in init() the very function who returns new_handle(...)?
//David Holm
More information about the MPlayer-dev-eng
mailing list