/// <summary> /// Connects a streamIndex from the capture source to this capture sink. /// </summary> /// <param name="captureSink">A valid IMFCaptureSink instance.</param> /// <param name="streamIndex">A value from the <see cref="CaptureEngineStreams"/> enumeration.</param> /// <param name="mediaType">An IMFMediaType instance that specifies the desired format of the output streamIndex.</param> /// <param name="attributes">An IMFAttributes instance or null.</param> /// <param name="sinkStreamIndex">Receives the index of the new streamIndex on the capture sink.</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 AddStream(this IMFCaptureSink captureSink, CaptureEngineStreams streamIndex, IMFMediaType mediaType, IMFAttributes attributes, out int sinkStreamIndex) { if (captureSink == null) { throw new ArgumentNullException("captureSink"); } return(captureSink.AddStream((int)streamIndex, mediaType, attributes, out sinkStreamIndex)); }