Class MFAttributes
The IMFAttributes interface is a general-purpose interface for storing key/value pairs, where the key is a GUID and the value is one of a small number of common data types, including UINT32, UINT64, double, GUID, Unicode string, and BLOB (counted array of UINT8). In addition to the methods inherited from IUnknown, the IMFAttributes interface exposes the following methods.
Implements
Inherited Members
Namespace: JeremyAnsel.DirectX.MediaFoundation
Assembly: JeremyAnsel.DirectX.MediaFoundation.dll
Syntax
[SecurityCritical]
public class MFAttributes : DXComObject, IDisposable
Remarks
The LockStore and UnlockStore calls may not be nested, and may not be called from different threads.
Constructors
| Edit this page View SourceMFAttributes(nint)
Initializes a new instance of the MFAttributes class.
Declaration
public MFAttributes(nint comPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | comPtr |
Fields
| Edit this page View SourceMFAttributesGuid
The interface GUID.
Declaration
public static readonly Guid MFAttributesGuid
Field Value
| Type | Description |
|---|---|
| Guid |
Methods
| Edit this page View SourceCopyAllItems(MFAttributes)
CopyAllItems clones all items from the store to the specified store.
Declaration
public void CopyAllItems(MFAttributes pDest)
Parameters
| Type | Name | Description |
|---|---|---|
| MFAttributes | pDest | pointer to an IMFAttributes interface which will recieve all items from this set. |
Remarks
Note that the pDest store must be unlocked in order to retrieve or set items by key.
CopyAllItems is a destructive operation on the destination store. In the event of a failure to copy all items, the state of the pDest store is UNDEFINED. Furthermore, any existing items in the pDest store will be removed prior to copying items from the source store.
DeleteAllItems()
DeleteAllItems removes all values from the attribute set.
Declaration
public void DeleteAllItems()
DeleteItem(Guid)
DeleteItem removes the value associated with the specified key from the attribute set.
Declaration
public void DeleteItem(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the key. |
GetAttribute2UINT32asUINT64(Guid, out uint, out uint)
Declaration
public void GetAttribute2UINT32asUINT64(Guid guidKey, out uint punHigh32, out uint punLow32)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| uint | punHigh32 | |
| uint | punLow32 |
GetAttributeDouble(Guid, double)
Declaration
public double GetAttributeDouble(Guid guidKey, double fDefault)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| double | fDefault |
Returns
| Type | Description |
|---|---|
| double |
GetAttributeRatio(Guid, out uint, out uint)
Declaration
public void GetAttributeRatio(Guid guidKey, out uint punNumerator, out uint punDenominator)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| uint | punNumerator | |
| uint | punDenominator |
GetAttributeSize(Guid, out uint, out uint)
Declaration
public void GetAttributeSize(Guid guidKey, out uint punWidth, out uint punHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| uint | punWidth | |
| uint | punHeight |
GetAttributeUINT32(Guid, uint)
Declaration
public uint GetAttributeUINT32(Guid guidKey, uint unDefault)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| uint | unDefault |
Returns
| Type | Description |
|---|---|
| uint |
GetAttributeUINT64(Guid, ulong)
Declaration
public ulong GetAttributeUINT64(Guid guidKey, ulong unDefault)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| ulong | unDefault |
Returns
| Type | Description |
|---|---|
| ulong |
GetCount()
GetCount retrieves the number of items currently in the set.
Declaration
public uint GetCount()
Returns
| Type | Description |
|---|---|
| uint | S_OK. The call was successful, and *pcItems contains the number of values in the set. |
GetDouble(Guid)
GetDouble retrieves a value of type double corresponding to the given key.
Declaration
public double GetDouble(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the value to retrieve. |
Returns
| Type | Description |
|---|---|
| double | S_OK. Value was found and retrieved successfully. MF_E_INVALIDTYPE Value was found, but is not of type double. MF_E_ATTRIBUTENOTFOUND. No value corresponding to this key is stored in this object. |
GetGUID(Guid)
GetGUID retrieve a value of type GUID corresponding to the given key.
Declaration
public Guid GetGUID(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the value to retrieve. |
Returns
| Type | Description |
|---|---|
| Guid | S_OK. Value was found and retrieved successfully. MF_E_INVALIDTYPE Value was found, but is not of type GUID. MF_E_ATTRIBUTENOTFOUND. No value corresponding to this key is stored in this object. |
GetItemType(Guid)
GetItemType returns the type of a value from the attributes store that corresponds to the given key (a GUID).
Declaration
public int GetItemType(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | Key corresponding to value to search for |
Returns
| Type | Description |
|---|---|
| int | S_OK. The key exists, and the value of pType signifies the type of the item value. MF_E_ATTRIBUTENOTFOUND. No value corresponding to this key is stored in this object. |
GetString(Guid)
GetString retrieves a string value corresponding to the given key.
Declaration
public string GetString(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the value to retrieve. |
Returns
| Type | Description |
|---|---|
| string | S_OK. Value was found and retrieved successfully. E_OUTOFMEMORY Value was found, but string length is too large to fit in a UINT32 value. HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER ) cchBufSize was not sufficiently large to hold the string value with NULL terminator. In this case, *pcchLength will be set to the length of the string value in chars. The caller will need to allocate a buffer of size at least *ppchLength + 1 chars and call the method again. MF_E_INVALIDTYPE Value was found, but is not of type LPWSTR. MF_E_ATTRIBUTENOTFOUND. No value corresponding to this key is stored in this object. |
GetStringLength(Guid)
GetStringLength retrieve the length of a string value corresponding to the given key.
Declaration
public uint GetStringLength(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the value to check. |
Returns
| Type | Description |
|---|---|
| uint | S_OK. Value was found and retrieved successfully. E_OUTOFMEMORY Value was found, but string length is too large to fit in a UINT32 value. MF_E_INVALIDTYPE Value was found, but is not of type LPWSTR. MF_E_ATTRIBUTENOTFOUND. No value corresponding to this key is stored in this object. |
GetUINT32(Guid)
GetUINT32 retrieves a value of type UINT32 corresponding to the given key.
Declaration
public uint GetUINT32(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the value to retrieve. |
Returns
| Type | Description |
|---|---|
| uint | S_OK. Value was found and retrieved successfully. MF_E_INVALIDTYPE Value was found, but is not of type UINT32. MF_E_ATTRIBUTENOTFOUND. No value corresponding to this key is stored in this object. |
GetUINT64(Guid)
GetUINT64 retrieves a value of type UINT64 corresponding to the given key.
Declaration
public ulong GetUINT64(Guid guidKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the value to retrieve. |
Returns
| Type | Description |
|---|---|
| ulong | S_OK. Value was found and retrieved successfully. MF_E_INVALIDTYPE Value was found, but is not of type UINT64. MF_E_ATTRIBUTENOTFOUND. No value corresponding to this key is stored in this object. |
GetUnknown(Guid, Guid)
Declaration
public nint GetUnknown(Guid guidKey, Guid riid)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| Guid | riid |
Returns
| Type | Description |
|---|---|
| nint |
LockStore()
LockStore excludes other threads from accessing the set, until such time as UnlockStore is called.
Declaration
public void LockStore()
SetAttribute2UINT32asUINT64(Guid, uint, uint)
Declaration
public void SetAttribute2UINT32asUINT64(Guid guidKey, uint unHigh32, uint unLow32)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| uint | unHigh32 | |
| uint | unLow32 |
SetAttributeRatio(Guid, uint, uint)
Declaration
public void SetAttributeRatio(Guid guidKey, uint unNumerator, uint unDenominator)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| uint | unNumerator | |
| uint | unDenominator |
SetAttributeSize(Guid, uint, uint)
Declaration
public void SetAttributeSize(Guid guidKey, uint unWidth, uint unHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | |
| uint | unWidth | |
| uint | unHeight |
SetDouble(Guid, double)
SetDouble associates the given double value with the specified key.
Declaration
public void SetDouble(Guid guidKey, double fValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the key. |
| double | fValue | Value of the property. |
SetGUID(Guid, Guid)
SetGUID associates the given GUID value with the specified key.
Declaration
public void SetGUID(Guid guidKey, Guid guidValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the key. |
| Guid | guidValue | Value of the property. |
SetString(Guid, string)
SetString associates the given LPWSTR value with the specified key.
Declaration
public void SetString(Guid guidKey, string wszValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the key. |
| string | wszValue | Value of the property. WszValue is presumed to be NULL-terminated. |
Remarks
Callee will allocate a new buffer and copy the given string, rather than storing a reference to the string passed in. Thus, caller is responsible for freeing any memory which may have been allocated for wszValue.
SetUINT32(Guid, uint)
SetUINT32 associates the given UINT32 value with the specified key.
Declaration
public void SetUINT32(Guid guidKey, uint unValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the key. |
| uint | unValue | Value of the property. |
SetUINT64(Guid, ulong)
SetUINT64 associates the given UINT64 value with the specified key.
Declaration
public void SetUINT64(Guid guidKey, ulong unValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the key. |
| ulong | unValue | Value of the property. |
SetUnknown(Guid, nint)
SetUnknown associates the given IUnknown interface pointer value with the specified key.
Declaration
public void SetUnknown(Guid guidKey, nint pUnknown)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | guidKey | GUID specifying the key. |
| nint | pUnknown | Value of the property. |
UnlockStore()
UnlockStore allows other threads access to the set, if they were previously denied access via LockStore.
Declaration
public void UnlockStore()