/// <summary> /// Writes data to a byte stream. /// </summary> /// <typeparam name="T">A value type.</typeparam> /// <param name="byteStream">A valid IMFByteStream instance.</param> /// <param name="buffer">An array of T that contains the data to write.</param> /// <param name="offset">An offset from the start of the buffer at which to begin reading the data written to the byte stream.</param> /// <param name="count">The number of items to write.</param> /// <param name="itemsWritten">Receives the number of items written.</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 Write <T>(this IMFByteStream byteStream, T[] buffer, int offset, int count, out int itemsWritten) where T : struct { if (buffer == null) { throw new ArgumentNullException("value"); } if (count > buffer.Length) { throw new ArgumentOutOfRangeException("count"); } ArraySegment <T> arraySegment = new ArraySegment <T>(buffer, offset, count); return(IMFByteStreamExtensions.Write <T>(byteStream, arraySegment, out itemsWritten)); }
/// <summary> /// Writes data to a byte stream. /// </summary> /// <param name="byteStream">A valid IMFByteStream instance.</param> /// <param name="buffer">A byte array that contains the data to write.</param> /// <param name="offset">An offset from the start of the buffer at which to begin reading the data written to the byte stream.</param> /// <param name="count">The number of bytes to write.</param> /// <param name="bytesWritten">The total number of bytes write into the buffer.</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 Write(this IMFByteStream byteStream, byte[] buffer, int offset, int count, out int bytesWritten) { return(IMFByteStreamExtensions.Write <byte>(byteStream, buffer, offset, count, out bytesWritten)); }