Re: Message negociation
Steve Lhomme <[email protected]>
| Newsgroups | gmane.comp.multimedia.media-api |
|---|---|
| Message-ID | <[email protected]> |
Toby Hudon wrote:
> So your call in init would look like this (pseudocode):
>
> ----------------------------
> pNextFilter->GetSupportedFunctions(myList, listCount);
>
> listNode* head = myList;
> listNode* current = head;
> int i = 0;
> int j = 0;
>
> for(i = listCount-1; i >= 0; i--) // while we have entries
> {
> for(j = 0; j <= i; j++) // find the current end of the list
> {
> current = current->pNext; // follow list
> } // end for j
>
> switch(current->functionID) // check what function is at the end of the list
> {
> case FOO:
> fpMyFooFunction = current->fpointer; // map function to our pointer
> break;
> ...
> ...
> default:
> // we don't map functions we don't understand
> break;
> }
> } // end for i
>
> -------------------------
Here is my code for the vtable in one block
enum {
CALLBACK_INIT=0,
CALLBACK_PROCESS,
CALLBACK_DUMMY,
CALLBACK_CLOSE,
ENUM_MAX
};
struct callback_table[ENUM_MAX];
other_filter->AcquireCallbacks(callback_table, sizeof(callback_table));
// local variables to use another filter
other_filter_init = callback_table[CALLBACK_INIT];
other_filter_close = callback_table[CALLBACK_CLOSE];
if (other_filter_init == NULL || other_filter_close == NULL)
return ERROR_CANT_USE_THIS_FILTER;
// proceed now