Changeset 6710 for trunk/src/quartz/imem.c
- Timestamp:
- Sep 15, 2001, 11:28:23 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/quartz/imem.c
r6649 r6710 1 /* $Id: imem.c,v 1.3 2001-09-05 13:36:35 bird Exp $ */2 1 /* 3 2 * Implementation of CLSID_MemoryAllocator. … … 28 27 IMemAllocator_fnQueryInterface(IMemAllocator* iface,REFIID riid,void** ppobj) 29 28 { 30 29 CMemoryAllocator_THIS(iface,memalloc); 31 30 32 31 TRACE("(%p)->()\n",This); 33 32 34 33 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); 35 34 } 36 35 … … 38 37 IMemAllocator_fnAddRef(IMemAllocator* iface) 39 38 { 40 39 CMemoryAllocator_THIS(iface,memalloc); 41 40 42 41 TRACE("(%p)->()\n",This); 43 42 44 43 return IUnknown_AddRef(This->unk.punkControl); 45 44 } 46 45 … … 48 47 IMemAllocator_fnRelease(IMemAllocator* iface) 49 48 { 50 49 CMemoryAllocator_THIS(iface,memalloc); 51 50 52 51 TRACE("(%p)->()\n",This); 53 52 54 53 return IUnknown_Release(This->unk.punkControl); 55 54 } 56 55 … … 58 57 IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropReq,ALLOCATOR_PROPERTIES* pPropActual) 59 58 { 60 CMemoryAllocator_THIS(iface,memalloc); 59 CMemoryAllocator_THIS(iface,memalloc); 60 long padding; 61 61 62 FIXME( "(%p)->() stub!\n", This ); 63 return E_NOTIMPL; 62 TRACE( "(%p)->(%p,%p)\n", This, pPropReq, pPropActual ); 63 64 if ( pPropReq == NULL || pPropActual == NULL ) 65 return E_POINTER; 66 if ( pPropReq->cBuffers < 0 || 67 pPropReq->cbBuffer < 0 || 68 pPropReq->cbAlign < 0 || 69 pPropReq->cbPrefix < 0 ) 70 return E_INVALIDARG; 71 72 if ( ( pPropReq->cbAlign & (pPropReq->cbAlign-1) ) != 0 ) 73 return E_INVALIDARG; 74 75 EnterCriticalSection( &This->csMem ); 76 77 This->prop.cBuffers = pPropReq->cBuffers; 78 This->prop.cbBuffer = pPropReq->cbBuffer; 79 This->prop.cbAlign = pPropReq->cbAlign; 80 This->prop.cbPrefix = pPropReq->cbPrefix; 81 82 if ( This->prop.cbAlign == 0 ) 83 This->prop.cbAlign = 1; 84 padding = This->prop.cbAlign - 85 ( (This->prop.cbBuffer+This->prop.cbPrefix) % This->prop.cbAlign ); 86 87 This->prop.cbBuffer += padding; 88 89 memcpy( pPropActual, &This->prop, sizeof(ALLOCATOR_PROPERTIES) ); 90 91 LeaveCriticalSection( &This->csMem ); 92 93 return NOERROR; 64 94 } 65 95 … … 67 97 IMemAllocator_fnGetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pProp) 68 98 { 69 99 CMemoryAllocator_THIS(iface,memalloc); 70 100 71 FIXME( "(%p)->() stub!\n", This ); 72 return E_NOTIMPL; 101 TRACE( "(%p)->(%p)\n", This, pProp ); 102 103 if ( pProp == NULL ) 104 return E_POINTER; 105 106 EnterCriticalSection( &This->csMem ); 107 108 memcpy( pProp, &This->prop, sizeof(ALLOCATOR_PROPERTIES) ); 109 110 LeaveCriticalSection( &This->csMem ); 111 112 return NOERROR; 73 113 } 74 114 … … 76 116 IMemAllocator_fnCommit(IMemAllocator* iface) 77 117 { 78 118 CMemoryAllocator_THIS(iface,memalloc); 79 119 80 81 120 FIXME( "(%p)->() stub!\n", This ); 121 return E_NOTIMPL; 82 122 } 83 123 … … 85 125 IMemAllocator_fnDecommit(IMemAllocator* iface) 86 126 { 87 127 CMemoryAllocator_THIS(iface,memalloc); 88 128 89 90 129 FIXME( "(%p)->() stub!\n", This ); 130 return E_NOTIMPL; 91 131 } 92 132 … … 94 134 IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd,DWORD dwFlags) 95 135 { 96 136 CMemoryAllocator_THIS(iface,memalloc); 97 137 98 99 138 FIXME( "(%p)->() stub!\n", This ); 139 return E_NOTIMPL; 100 140 } 101 141 … … 103 143 IMemAllocator_fnReleaseBuffer(IMemAllocator* iface,IMediaSample* pSample) 104 144 { 105 145 CMemoryAllocator_THIS(iface,memalloc); 106 146 107 108 147 FIXME( "(%p)->() stub!\n", This ); 148 return E_NOTIMPL; 109 149 } 110 150 … … 113 153 static ICOM_VTABLE(IMemAllocator) imemalloc = 114 154 { 115 116 117 118 119 120 121 122 123 124 125 126 155 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 156 /* IUnknown fields */ 157 IMemAllocator_fnQueryInterface, 158 IMemAllocator_fnAddRef, 159 IMemAllocator_fnRelease, 160 /* IMemAllocator fields */ 161 IMemAllocator_fnSetProperties, 162 IMemAllocator_fnGetProperties, 163 IMemAllocator_fnCommit, 164 IMemAllocator_fnDecommit, 165 IMemAllocator_fnGetBuffer, 166 IMemAllocator_fnReleaseBuffer, 127 167 }; 128 168 129 169 130 voidCMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma )170 HRESULT CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma ) 131 171 { 132 TRACE("(%p)\n",pma); 133 ICOM_VTBL(&pma->memalloc) = &imemalloc; 172 TRACE("(%p)\n",pma); 173 174 ICOM_VTBL(&pma->memalloc) = &imemalloc; 175 176 ZeroMemory( &pma->prop, sizeof(pma->prop) ); 177 178 InitializeCriticalSection( &pma->csMem ); 179 180 return NOERROR; 134 181 } 182 183 void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma ) 184 { 185 TRACE("(%p)\n",pma); 186 187 IMemAllocator_Decommit( (IMemAllocator*)(&pma->memalloc) ); 188 189 DeleteCriticalSection( &pma->csMem ); 190 }
Note:
See TracChangeset
for help on using the changeset viewer.