Re: Message negociation
Steve Lhomme <[email protected]>
| Newsgroups | gmane.comp.multimedia.media-api |
|---|---|
| Message-ID | <[email protected]> |
Artem Baguinski wrote:
> the vtables with NULLs for not-implemented "methods" will be even more
> efficient, cause you request all callbacks at once ;)
Nop, that's not the same thing. If you request everything at once, that
means you know the order of things in the vtable, ie using a fixed
struct. Hopefully the impact of using a struct is less important than
"message" parameters. You can add new callbacks at the end. Hopefully we
will never have a system with 5000 callbacks/message :) (and even though
it can still be handled by mosts systems)
So I agree with the vtable requested on "init". Something that would
look like this :
typedef struct dialog_vtable {
int (*callback1)(void);
void (*callback2)(int);
long (*callback3)(long, void *);
....
};
int get_your_vtable(dialog_vtable *table_to_fill, int size_of_this_table);
Depending on the "size_of_this_table" you know when to stop filling the
structure (or fill it with NULL when you support less features).
As said before, the structure has to be updated at the end, *always*.