Exemplo n.º 1
0
        /// <summary>
        /// Adds an effect to a capture streamIndex.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="sourceStream">A member of the <see cref="CaptureEngineStreams"/> enumeration.</param>
        /// <param name="activate">An MFT activation instance.</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 AddEffect(this IMFCaptureSource captureSource, CaptureEngineStreams sourceStream, IMFActivate activate)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            return(captureSource.AddEffect((int)sourceStream, activate));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the output format for a capture streamIndex.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="sourceStream">A member of the <see cref="CaptureEngineStreams"/> enumeration.</param>
        /// <param name="mediaType">An instance of the IMFMediaType interface.</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 SetCurrentDeviceMediaType(this IMFCaptureSource captureSource, CaptureEngineStreams sourceStream, IMFMediaType mediaType)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            return(captureSource.SetCurrentDeviceMediaType((int)sourceStream, mediaType));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds an effect to a capture streamIndex.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="sourceStreamIndex">The capture streamIndex.</param>
        /// <param name="activate">An MFT activation instance.</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 AddEffect(this IMFCaptureSource captureSource, int sourceStreamIndex, IMFActivate activate)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            return(captureSource.AddEffect(sourceStreamIndex, activate));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Removes an effect from a capture streamIndex.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="sourceStream">A member of the <see cref="CaptureEngineStreams"/> enumeration.</param>
        /// <param name="transform">A Media Foundation transform instance.</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 RemoveEffect(this IMFCaptureSource captureSource, CaptureEngineStreams sourceStream, IMFTransform transform)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            return(captureSource.RemoveEffect((int)sourceStream, transform));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Removes an effect from a capture streamIndex.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="sourceStreamIndex">The capture streamIndex.</param>
        /// <param name="transform">A Media Foundation transform instance.</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 RemoveEffect(this IMFCaptureSource captureSource, int sourceStreamIndex, IMFTransform transform)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            return(captureSource.RemoveEffect(sourceStreamIndex, transform));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Gets the actual device streamIndex index translated from a friendly streamIndex name.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="friendlyName">A member of the <see cref="CaptureEngineFriendlyName"/> enumeration.</param>
        /// <param name="actualStreamIndex">Receives the value of the streamIndex index that corresponds to the friendly name.</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 GetStreamIndexFromFriendlyName(this IMFCaptureSource captureSource, CaptureEngineFriendlyName friendlyName, out int actualStreamIndex)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            return(captureSource.GetStreamIndexFromFriendlyName((int)friendlyName, out actualStreamIndex));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Gets a format that is supported by one of the capture streams.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="sourceStream">A member of the <see cref="CaptureEngineStreams"/> enumeration.</param>
        /// <param name="mediaTypeIndex">The zero-based index of the media type to retrieve.</param>
        /// <param name="mediaType">Receives an instance of the IMFMediaType interface.</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 GetAvailableDeviceMediaType(this IMFCaptureSource captureSource, CaptureEngineStreams sourceStream, int mediaTypeIndex, out IMFMediaType mediaType)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            return(captureSource.GetAvailableDeviceMediaType((int)sourceStream, mediaTypeIndex, out mediaType));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Gets a pointer to the underlying Source Reader object.
        /// </summary>
        /// <param name="captureSource">A valid IMFCaptureSource instance.</param>
        /// <param name="sourceReader">Receives an instance of the underlying Source Reader.</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 GetService(this IMFCaptureSource captureSource, out IMFSourceReader sourceReader)
        {
            if (captureSource == null)
            {
                throw new ArgumentNullException("captureSource");
            }

            object tmp;

            HResult hr = captureSource.GetService(Guid.Empty, typeof(IMFSourceReader).GUID, out tmp);

            sourceReader = hr.Succeeded() ? tmp as IMFSourceReader : null;

            return(hr);
        }