Methods (65) Properties (2)
Namespace: CSCore.MediaFoundation

Syntax

public class MFAttributes : ComObject

Base Type

Summary

Provides a generic way to store key/value pairs on an object.

Uses

Used by

Methods

MFAttributes()

Initializes a new instance of the MFAttributes class.

public void MFAttributes()

MFAttributes(Int32 initialSize)

Initializes a new instance of the MFAttributes class with a initial size.

public void MFAttributes(Int32 initialSize)

Parameters

initialSize

Int32

The initial size in bytes.

MFAttributes(IntPtr ptr)

Initializes a new instance of the MFAttributes class.

public void MFAttributes(IntPtr ptr)

Parameters

ptr

IntPtr

The native pointer of the COM object.

Compare(MFAttributes theirs, MFAttributeMatchType matchType)

Compares the attributes on this object with the attributes on another object.

public Boolean Compare(MFAttributes theirs, MFAttributeMatchType matchType)

Parameters

theirs

MFAttributes

The MFAttributes interface of the object to compare with this object.

matchType

MFAttributeMatchType

A value, specifying the type of comparison to make.

Returns

Returns true if the two sets of attributes match in the way specified by the matchType parameter; otherwise, false.

CompareItem(Guid key, PropertyVariant value)

Queries whether a stored attribute value equals a specified PropertyVariant.

public Boolean CompareItem(Guid key, PropertyVariant value)

Parameters

key

Guid

Guid that identifies which value to query.

value

PropertyVariant

PropertyVariant that contains the value to compare.

Returns

A boolean value indicating whether the attribute matches the value given in value.

Remarks

For more information, see .

CompareItemNative(Guid key, PropertyVariant value, NativeBool& result)

Queries whether a stored attribute value equals a specified PropertyVariant.

public Int32 CompareItemNative(Guid key, PropertyVariant value, NativeBool& result)

Parameters

key

Guid

Guid that identifies which value to query.

value

PropertyVariant

PropertyVariant that contains the value to compare.

result

NativeBool&

Receives a boolean value indicating whether the attribute matches the value given in value.

Returns

HRESULT

Remarks

For more information, see .

CompareNative(MFAttributes theirs, MFAttributeMatchType matchType, NativeBool& result)

Compares the attributes on this object with the attributes on another object.

public Int32 CompareNative(MFAttributes theirs, MFAttributeMatchType matchType, NativeBool& result)

Parameters

theirs

MFAttributes

The MFAttributes interface of the object to compare with this object.

matchType

MFAttributeMatchType

A value, specifying the type of comparison to make.

result

NativeBool&

Receives a Boolean value. The value is True if the two sets of attributes match in the way specified by the matchType parameter. Otherwise, the value is False.

Returns

HRESULT

CopyAllItems(MFAttributes destination)

Copies all of the attributes from this object into another attribute store.

public void CopyAllItems(MFAttributes destination)

Parameters

destination

MFAttributes

The attribute store that recevies the copy.

CopyAllItemsNative(MFAttributes destination)

Copies all of the attributes from this object into another attribute store.

public Int32 CopyAllItemsNative(MFAttributes destination)

Parameters

destination

MFAttributes

The attribute store that recevies the copy.

Returns

HRESULT

DeleteAllItems()

Removes all key/value pairs from the object's attribute list.

DeleteAllItemsNative()

Removes all key/value pairs from the object's attribute list.

public Int32 DeleteAllItemsNative()

Returns

HRESULT

DeleteItem(Guid key)

Removes a key/value pair from the object's attribute list.

public void DeleteItem(Guid key)

Parameters

key

Guid

Guid that identifies the value to delete.

DeleteItemNative(Guid key)

Removes a key/value pair from the object's attribute list.

public Int32 DeleteItemNative(Guid key)

Parameters

key

Guid

Guid that identifies the value to delete.

Returns

HRESULT

Exists(Guid key)

Determines whether the attribute store contains an attribute with the specified key.

public Boolean Exists(Guid key)

Parameters

key

Guid

The key of the attribute.

Returns

True if the attribute exists; otherwise, false

Exceptions

MediaFoundationException

An unexpected error occurred.

Get(Guid key)

Gets the item which got associated with the specified key.

public object Get(Guid key)

Parameters

key

Guid

The key of the item.

Returns

The item which got associated with the specified key.

Exceptions

NotSupportedException

The value type of the associated item is not supported.

Get(Guid key)

Gets the item which got associated with the specified key.

public TValueType Get<TValueType>(Guid key)

Parameters

key

Guid

The key of the item.

Type Parameters

TValueType

Type of the returned item.

Returns

The item which got associated with the specified key.

Exceptions

NotSupportedException

The specified TValueType is not supported.

CSCore.MediaFoundation.MFAttributesGetif (typeof(TValueType) == typeof(int) || typeof(TValueType) == typeof(bool) || typeof(TValueType) == typeof(byte) || typeof(TValueType) == typeof(uint) || typeof(TValueType) == typeof(short) || typeof(TValueType) == typeof(ushort) || typeof(TValueType) == typeof(byte) || typeof(TValueType) == typeof(sbyte))GetUINT32endif (typeof(TValueType).IsEnum)GetUINT32endif (typeof(TValueType) == typeof(IntPtr))GetUINT64endif (typeof(TValueType) == typeof(long) || typeof(TValueType) == typeof(ulong))GetUINT64endif (typeof(TValueType) == typeof(Guid))GetGuidendif (typeof(TValueType) == typeof(string))GetStringendif (typeof(TValueType) == typeof(double) || typeof(TValueType) == typeof(float))GetDoubleendif (typeof(TValueType) == typeof(byte[] ))GetBlobendif (typeof(TValueType).IsValueType)GetBlobendreturn TValueType

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom

GetAllocatedBlobNative(Guid key, Byte[]& buffer, Int32& pcbSize)

Retrieves a byte array associated with a key.

public Int32 GetAllocatedBlobNative(Guid key, Byte[]& buffer, Int32& pcbSize)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Blob.

buffer

Byte[]&

If the key is found and the value is a byte array, this parameter receives a copy of the array.

pcbSize

Int32&

Receives the size of the array, in bytes.

Returns

HRESULT

Remarks

Obsolete, use the GetBlob method instead.

GetAllocatedStringNative(Guid key, IntPtr wszValue, Int32& cchLength)

Retrieves a wide-character string associated with a key. This method allocates the memory for the string.

public Int32 GetAllocatedStringNative(Guid key, IntPtr wszValue, Int32& cchLength)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be String.

wszValue

IntPtr

If the key is found and the value is a string type, this parameter receives a copy of the string. The caller must free the memory for the string by calling FreeCoTaskMem.

cchLength

Int32&

Receives the number of characters in the string, excluding the terminating NULL character.

Returns

HRESULT

Remarks

Don't use the GetAllocatedStringNative method. Use the GetString method instead.

GetBlob(Guid key)

Retrieves a byte array associated with a key.

public Byte[] GetBlob(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Blob.

Returns

The byte array associated with the key.

GetBlob(Guid key, Type type)

Retrieves an object associated with a key.

public object GetBlob(Guid key, Type type)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Blob.

type

Type

The type of the object (type of the returned object -> see return value).

Returns

The object associated with the key.

Exceptions

ArgumentNullException

Type is null.

Remarks

Internally this method retrieves a byte-array with gets converted to a instance of the specified type.

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom

public Int32 GetBlobNative(Guid key, IntPtr bufferPtr, Int32 cbBufSize, IntPtr cbBlobSize)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Blob.

bufferPtr

IntPtr

Pointer to a buffer allocated by the caller. If the key is found and the value is a byte array, the method copies the array into this buffer. To find the required size of the buffer, call GetBlobSize.

cbBufSize

Int32

The size of the bufferPtr buffer, in bytes.

cbBlobSize

IntPtr

Receives the size of the byte array. This parameter can be Zero.

Returns

HRESULT

GetBlobSize(Guid key)

Retrieves the length of a byte array associated with a key.

public Int32 GetBlobSize(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Blob.

Returns

If the key is found and the value is a byte array, this method returns the size of the array, in bytes.

GetBlobSizeNative(Guid key, Int32& size)

Retrieves the length of a byte array associated with a key.

public Int32 GetBlobSizeNative(Guid key, Int32& size)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Blob.

size

Int32&

If the key is found and the value is a byte array, this parameter receives the size of the array, in bytes.

Returns

HRESULT

GetCount()

Retrieves the number of attributes that are set on this object.

public Int32 GetCount()

Returns

Returns the number of attributes.

GetCountNative(Int32& itemCount)

Retrieves the number of attributes that are set on this object.

public Int32 GetCountNative(Int32& itemCount)

Parameters

itemCount

Int32&

Receives the number of attributes.

Returns

HRESULT

GetDouble(Guid key)

Retrieves a Double value associated with a key.

public Double GetDouble(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Double.

Returns

If the key is found and the data type is Double, the method returns the associated value.

GetDoubleNative(Guid key, Double& result)

Retrieves a Double value associated with a key.

public Int32 GetDoubleNative(Guid key, Double& result)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Double.

result

Double&

Receives a Double value. If the key is found and the data type is Double, the method copies the value into this parameter.

Returns

HRESULT

GetGuid(Guid key)

Retrieves a Guid value associated with a key.

public Guid GetGuid(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Guid.

Returns

If the key is found and the data type is Guid, the method returns the associated value.

GetGuidNative(Guid key, Guid& result)

Retrieves a Guid value associated with a key.

public Int32 GetGuidNative(Guid key, Guid& result)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be Guid.

result

Guid&

Receives a Guid value. If the key is found and the data type is Guid, the method copies the value into this parameter.

Returns

HRESULT

GetItem(Guid key)

Retrieves the value associated with a key.

public PropertyVariant GetItem(Guid key)

Parameters

key

Guid

A Guid that identifies which value to retrieve.

Returns

A PropertyVariant that receives the value.

Remarks

For more information, see .

GetItemByIndex(Int32 index, Guid& key)

Retrieves an attribute at the specified index.

public PropertyVariant GetItemByIndex(Int32 index, Guid& key)

Parameters

index

Int32

Index of the attribute to retrieve. To get the number of attributes, call GetCount.

key

Guid&

Receives the Guid that identifies this attribute.

Returns

Returns the value of the attribute specified by the index.

GetItemByIndexNative(Int32 index, Guid& key, IntPtr value)

Retrieves an attribute at the specified index.

public Int32 GetItemByIndexNative(Int32 index, Guid& key, IntPtr value)

Parameters

index

Int32

Index of the attribute to retrieve. To get the number of attributes, call GetCount.

key

Guid&

Receives the Guid that identifies this attribute.

value

IntPtr

Pointer to a PropertyVariant that receives the value. This parameter can be Zero. If it is not Zero, the method fills the PropertyVariant with a copy of the attribute value. Call Dispose to free the memory allocated by this method.

Returns

HRESULT

GetItemNative(Guid key, IntPtr valueRef)

Retrieves the value associated with a key.

public Int32 GetItemNative(Guid key, IntPtr valueRef)

Parameters

key

Guid

A Guid that identifies which value to retrieve.

valueRef

IntPtr

A pointer to a PropertyVariant that receives the value.

Returns

HRESULT

Remarks

For more information, see .

GetItemType(Guid key)

Retrieves the data type of the value associated with a key.

public MFAttributeType GetItemType(Guid key)

Parameters

key

Guid

Guid that identifies which value to query.

Returns

The type of the item, associated with the specified key.

Remarks

For more information, see .

GetItemTypeNative(Guid key, MFAttributeType& attributeType)

Retrieves the data type of the value associated with a key.

public Int32 GetItemTypeNative(Guid key, MFAttributeType& attributeType)

Parameters

key

Guid

Guid that identifies which value to query.

attributeType

MFAttributeType&

The type of the item, associated with the specified key.

Returns

HRESULT

Remarks

For more information, see .

GetString(Guid key)

Retrieves a wide-character string associated with a key.

public String GetString(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be String.

Returns

If the key is found and the data type is String, the method returns the associated value.

GetStringLength(Guid key)

Retrieves the length of a string value associated with a key.

public Int32 GetStringLength(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be String.

Returns

If the key is found and the data type is String, this method returns the number of characters in the string, not including the terminating NULL character.

GetStringLengthNative(Guid key, Int32& result)

Retrieves the length of a string value associated with a key.

public Int32 GetStringLengthNative(Guid key, Int32& result)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be String.

result

Int32&

If the key is found and the data type is String, this parameter receives the number of characters in the string, not including the terminating NULL character.

Returns

HRESULT

GetStringNative(Guid key, IntPtr wszValue, Int32 cchBufSize, IntPtr cchLength)

Retrieves a wide-character string associated with a key.

public Int32 GetStringNative(Guid key, IntPtr wszValue, Int32 cchBufSize, IntPtr cchLength)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be String.

wszValue

IntPtr

Pointer to a wide-character array allocated by the caller. The array must be large enough to hold the string, including the terminating NULL character. If the key is found and the value is a string type, the method copies the string into this buffer. To find the length of the string, call GetStringLength.

cchBufSize

Int32

The size of the pwszValue array, in characters. This value includes the terminating NULL character.

cchLength

IntPtr

Receives the number of characters in the string, excluding the terminating NULL character. This parameter can be NULL.

Returns

HRESULT

GetUINT32(Guid key)

Retrieves a UINT32 value associated with a key.

public Int32 GetUINT32(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be UInt32.

Returns

If the key is found and the data type is UInt32, the method returns the associated value.

GetUINT32Native(Guid key, Int32& result)

Retrieves a UINT32 value associated with a key.

public Int32 GetUINT32Native(Guid key, Int32& result)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be UInt32.

result

Int32&

Receives a UINT32 value. If the key is found and the data type is UInt32, the method copies the value into this parameter.

Returns

HRESULT

GetUINT64(Guid key)

Retrieves a UINT64 value associated with a key.

public Int64 GetUINT64(Guid key)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be UInt64.

Returns

If the key is found and the data type is UInt64, the method returns the associated value.

GetUINT64Native(Guid key, Int64& result)

Retrieves a UINT64 value associated with a key.

public Int32 GetUINT64Native(Guid key, Int64& result)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be UInt64.

result

Int64&

Receives a UINT64 value. If the key is found and the data type is UInt64, the method copies the value into this parameter.

Returns

HRESULT

GetUnknownNative(Guid key, Guid riid, IntPtr& unknown)

Retrieves an interface pointer associated with a key.

public Int32 GetUnknownNative(Guid key, Guid riid, IntPtr& unknown)

Parameters

key

Guid

Guid that identifies which value to retrieve. The attribute type must be IUnknown.

riid

Guid

Interface identifier (IID) of the interface to retrieve.

unknown

IntPtr&

Receives a pointer to the requested interface. The caller must release the interface.

Returns

HRESULT

LockStore()

Locks the attribute store so that no other thread can access it. If the attribute store is already locked by another thread, this method blocks until the other thread unlocks the object. After calling this method, call UnlockStore to unlock the object.

LockStoreNative()

Locks the attribute store so that no other thread can access it. If the attribute store is already locked by another thread, this method blocks until the other thread unlocks the object. After calling this method, call UnlockStore to unlock the object.

public Int32 LockStoreNative()

Returns

HRESULT

Set(MFAttribute keyValuePair)

Sets the value of a property specified by the key of the keyValuePair object.

public void Set<T>(MFAttribute keyValuePair)

Parameters

keyValuePair

MFAttribute

Specifies the key of the property and the new value to set.

Type Parameters

T

The type of the property.

Set(Guid key, TValueType value)

Sets the value of a property specified by its key.

public void Set<TValueType>(Guid key, TValueType value)

Parameters

key

Guid

The key of the property.

value

TValueType

The value to set.

Type Parameters

TValueType

The type of the property.

Exceptions

NotSupportedException

The specified TValueType is not supported.

SetBlob(Guid key, Byte[] buffer)

Associates a byte array with a key.

public void SetBlob(Guid key, Byte[] buffer)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

buffer

Byte[]

The byte array to associate with the key

SetBlobNative(Guid key, IntPtr buf, Int32 cbBufSize)

Associates a byte array with a key.

public Int32 SetBlobNative(Guid key, IntPtr buf, Int32 cbBufSize)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

buf

IntPtr

Pointer to a byte array to associate with this key. The method stores a copy of the array.

cbBufSize

Int32

Size of the array, in bytes.

Returns

HRESULT

SetDouble(Guid key, Double value)

Associates a Double value with a key.

public void SetDouble(Guid key, Double value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Double

New value for this key.

SetDoubleNative(Guid key, Double value)

Associates a Double value with a key.

public Int32 SetDoubleNative(Guid key, Double value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Double

New value for this key.

Returns

HRESULT

SetGuid(Guid key, Guid value)

Associates a Guid value with a key.

public void SetGuid(Guid key, Guid value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Guid

New value for this key.

SetGuidNative(Guid key, Guid value)

Associates a Guid value with a key.

public Int32 SetGuidNative(Guid key, Guid value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Guid

New value for this key.

Returns

HRESULT

SetItem(Guid key, PropertyVariant value)

Associates an attribute value with a key.

public void SetItem(Guid key, PropertyVariant value)

Parameters

key

Guid

A Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

PropertyVariant

A PropertyVariant that contains the attribute value. The method copies the value. The PropertyVariant type must be one of the types listed in the MFAttributeType enumeration.

SetItemNative(Guid key, PropertyVariant value)

Associates an attribute value with a key.

public Int32 SetItemNative(Guid key, PropertyVariant value)

Parameters

key

Guid

A Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

PropertyVariant

A PropertyVariant that contains the attribute value. The method copies the value. The PropertyVariant type must be one of the types listed in the MFAttributeType enumeration.

Returns

HRESULT

SetString(Guid key, String value)

Associates a wide-character string with a key.

public void SetString(Guid key, String value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

String

New value for this key.

Remarks

Internally this method stores a copy of the string specified by the value parameter.

SetStringNative(Guid key, String value)

Associates a wide-character string with a key.

public Int32 SetStringNative(Guid key, String value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

String

New value for this key.

Returns

HRESULT

Remarks

Internally this method stores a copy of the string specified by the value parameter.

SetUINT32(Guid key, Int32 value)

Associates a UINT32 value with a key.

public void SetUINT32(Guid key, Int32 value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Int32

New value for this key.

SetUINT32Native(Guid key, Int32 value)

Associates a UINT32 value with a key.

public Int32 SetUINT32Native(Guid key, Int32 value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Int32

New value for this key.

Returns

HRESULT

SetUINT64(Guid key, Int64 value)

Associates a UINT64 value with a key.

public void SetUINT64(Guid key, Int64 value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Int64

New value for this key.

SetUINT64Native(Guid key, Int64 value)

Associates a UINT64 value with a key.

public Int32 SetUINT64Native(Guid key, Int64 value)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

value

Int64

New value for this key.

Returns

HRESULT

SetUnknownNative(Guid key, IntPtr unknown)

Associates an IUnknown pointer with a key.

public Int32 SetUnknownNative(Guid key, IntPtr unknown)

Parameters

key

Guid

Guid that identifies the value to set. If this key already exists, the method overwrites the old value.

unknown

IntPtr

IUnknown pointer to be associated with this key.

Returns

HRESULT

UnlockStore()

Unlocks the attribute store after a call to the LockStore method. While the object is unlocked, multiple threads can access the object's attributes.

UnlockStoreNative()

Unlocks the attribute store after a call to the LockStore method. While the object is unlocked, multiple threads can access the object's attributes.

public Int32 UnlockStoreNative()

Returns

HRESULT

Properties

Count

Gets the number of attributes that are set on this object.

public Int32 Count { get; }

Item

Gets or sets an item specified by its index.

public PropertyVariant Item { get; set; }

Parameters

index

The index of the item.

Class Diagram

save

reset

Drag to pan - Use Mousewheel + Ctrl to zoom