MemAllocator* MemAllocatorCreate() { MemAllocator* This = (MemAllocator*) malloc(sizeof(MemAllocator)); if (!This) return NULL; Debug printf("MemAllocatorCreate() called -> %p\n", This); This->refcount = 1; This->props.cBuffers = 1; This->props.cbBuffer = 65536; /* :/ */ This->props.cbAlign = 1; This->props.cbPrefix = 0; This->vt = (IMemAllocator_vt*) malloc(sizeof(IMemAllocator_vt)); if (!This->vt) { free(This); return NULL; } This->vt->QueryInterface = MemAllocator_QueryInterface; This->vt->AddRef = MemAllocator_AddRef; This->vt->Release = MemAllocator_Release; This->vt->SetProperties = MemAllocator_SetProperties; This->vt->GetProperties = MemAllocator_GetProperties; This->vt->Commit = MemAllocator_Commit; This->vt->Decommit = MemAllocator_Decommit; This->vt->GetBuffer = MemAllocator_GetBuffer; This->vt->ReleaseBuffer = MemAllocator_ReleaseBuffer; This->SetPointer = MemAllocator_SetPointer; This->ResetPointer = MemAllocator_ResetPointer; This->modified_sample = 0; This->new_pointer = 0; This->used_list = 0; This->free_list = 0; This->interfaces[0]=IID_IUnknown; This->interfaces[1]=IID_IMemAllocator; #ifdef WIN32_LOADER if (AllocatorKeeper++ == 0) RegisterComClass(&CLSID_MemoryAllocator, MemAllocator_CreateAllocator); #endif return This; }
FilterGraph* FilterGraphCreate() { FilterGraph* This = calloc(1, sizeof(*This)); if (!This) return NULL; Debug printf("FilterGraphCreate() called -> %p\n", This); This->refcount = 1; This->vt = calloc(1, sizeof(*This->vt)); if (!This->vt) { free(This); return NULL; } This->vt->QueryInterface = FilterGraph_QueryInterface; This->vt->AddRef = FilterGraph_AddRef; This->vt->Release = FilterGraph_Release; This->vt->AddFilter = FilterGraph_AddFilter; This->vt->RemoveFilter = FilterGraph_RemoveFilter; This->vt->EnumFilters = FilterGraph_EnumFilters; This->vt->FindFilterByName = FilterGraph_FindFilterByName; This->vt->ConnectDirect = FilterGraph_ConnectDirect; This->vt->Reconnect = FilterGraph_Reconnect; This->vt->Disconnect = FilterGraph_Disconnect; This->vt->SetDefaultSyncSource = FilterGraph_SetDefaultSyncSource; This->interfaces[0] = IID_IUnknown; This->interfaces[1] = IID_IFilterGraph; #ifdef WIN32_LOADER if (GraphKeeper++ == 0) RegisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph); #endif return This; }