Re: to be effcient or not to be efficient
Tuukka Toivonen <[email protected]>
| Newsgroups | gmane.comp.multimedia.media-api |
|---|---|
| Message-ID | <Pine.GSO.4.58.0401081131440.13832@stekt37> |
On Thu, 8 Jan 2004, Artem Baguinski wrote:
>static vtable_t my_vtable {
> .get_next_frame = get_next_frame; /* implemented call */
> .seek_ms = seek_ms; /* another one */
> .seek_frame = NULL; /* not implemented call */
> ...
>}
If the vtable is set up by the API library (as opposed to a specific
codec/filter) it might be nicer to set unimplemented functions to
some dummy functions which just return an error instead of NULL; otherwise
the caller has to always check whether a pointer is NULL before calling the
function.
There might then be another function for checking whether a function is
implemented (if a codec/filter wants to really know if a function is
implemented or returning error for some other reason).
If the vtable is set up by codec, using NULLs for unimplemented calls might
be better because that makes the codec simpler.