/// <summary> /// Retrieves a byte array associated with a key. /// </summary> /// <param name="attributes">A valid IMFAttributes instance.</param> /// <param name="guidKey">Guid that identifies which value to retrieve.</param> /// <param name="value">Receives the byte array.</param> /// <returns>If this function succeeds, it returns the S_OK member. Otherwise, it returns another HResult's member that describe the error.</returns> public static HResult GetAllocatedBlob(this IMFAttributes attributes, Guid guidKey, out byte[] value) { if (attributes == null) { throw new ArgumentNullException("attributes"); } IntPtr resultPtr; int resultLength; HResult hr = attributes.GetAllocatedBlob(guidKey, out resultPtr, out resultLength); if (hr.Succeeded()) { try { value = new byte[resultLength]; Marshal.Copy(resultPtr, value, 0, resultLength); } finally { Marshal.FreeCoTaskMem(resultPtr); } } else { value = null; } return(hr); }
/// <summary> /// Retrieves a <see cref="MemoryBuffer"/> associated with a key. /// </summary> /// <param name="attributes">A valid IMFAttributes instance.</param> /// <param name="guidKey">Guid that identifies which value to retrieve.</param> /// <param name="value">Receives a MemoryBuffer wrapping the attribute content.</param> /// <returns>If this function succeeds, it returns the S_OK member. Otherwise, it returns another HResult's member that describe the error.</returns> public static HResult GetAllocatedBlob(this IMFAttributes attributes, Guid guidKey, out MemoryBuffer value) { if (attributes == null) { throw new ArgumentNullException("attributes"); } IntPtr resultPtr; int resultLength; HResult hr = attributes.GetAllocatedBlob(guidKey, out resultPtr, out resultLength); value = hr.Succeeded() ? new MemoryBuffer(resultPtr, (uint)resultLength) : null; return(hr); }
public HResult GetAllocatedBlob(Guid guidKey, out IntPtr ip, out int pcbSize) { return(m_Attribs.GetAllocatedBlob(guidKey, out ip, out pcbSize)); }