/// <summary>
        /// Gets a format that is supported natively by the media source.
        /// </summary>
        /// <param name="sourceReader">A valid IMFSourceReader instance.</param></param>
        /// <param name="streamIndex">The streamIndex to query.</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 GetNativeMediaType(this IMFSourceReader sourceReader, SourceReaderFirstStream streamIndex, int mediaTypeIndex, out IMFMediaType mediaType)
        {
            if (sourceReader == null)
            {
                throw new ArgumentNullException("sourceReader");
            }

            return(sourceReader.GetNativeMediaType((int)streamIndex, mediaTypeIndex, out mediaType));
        }
        /// <summary>
        /// Sets the media type for a stream.
        /// </summary>
        /// <param name="sourceReader">A valid IMFSourceReader instance.</param></param></param>
        /// <param name="streamIndex">The stream to configure.</param>
        /// <param name="mediaType">An instance of the IMFMediaType interface of the media type.</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 SetCurrentMediaType(this IMFSourceReader sourceReader, SourceReaderFirstStream streamIndex, IMFMediaType mediaType)
        {
            if (sourceReader == null)
            {
                throw new ArgumentNullException("sourceReader");
            }

            return(sourceReader.SetCurrentMediaType((int)streamIndex, null, mediaType));
        }
        /// <summary>
        /// Queries whether a stream is selected.
        /// </summary>
        /// <param name="sourceReader">A valid IMFSourceReader instance.</param></param></param>
        /// <param name="streamIndex">The stream to query.</param>
        /// <param name="mediaType">Receives True if the stream is selected and will generate data otherwise False if the stream is not selected and will not generate data.</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 GetStreamSelection(this IMFSourceReader sourceReader, SourceReaderFirstStream streamIndex, out bool selected)
        {
            if (sourceReader == null)
            {
                throw new ArgumentNullException("sourceReader");
            }

            return(sourceReader.GetStreamSelection((int)streamIndex, out selected));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a transform, such as an audio or video effect, to a stream.
        /// </summary>
        /// <param name="sourceReader">A valid IMFSourceReaderEx instance.</param></param>
        /// <param name="streamIndex">The stream to configure.</param>
        /// <param name="activate">An instance of an MFT activation object.</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 AddTransformForStream(this IMFSourceReaderEx sourceReader, SourceReaderFirstStream streamIndex, IMFActivate activate)
        {
            if (sourceReader == null)
            {
                throw new ArgumentNullException("sourceReader");
            }

            return(sourceReader.AddTransformForStream((int)streamIndex, activate));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sets the native media type for a stream on the media source.
        /// </summary>
        /// <param name="sourceReader">A valid IMFSourceReaderEx instance.</param></param>
        /// <param name="streamIndex">The stream to set.</param>
        /// <param name="mediaType">An instance of the IMFMediaType interface for the media type.</param>
        /// <param name="streamFlags">Receives one or more members of the MF_SOURCE_READER_FLAG enumeration.</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 SetNativeMediaType(this IMFSourceReaderEx sourceReader, SourceReaderFirstStream streamIndex, IMFMediaType mediaType, out MF_SOURCE_READER_FLAG streamFlags)
        {
            if (sourceReader == null)
            {
                throw new ArgumentNullException("sourceReader");
            }

            return(sourceReader.SetNativeMediaType((int)streamIndex, mediaType, out streamFlags));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Removes all of the Media Foundation transforms (MFTs) for a specified stream, with the exception of the decoder.
        /// </summary>
        /// <param name="sourceReader">A valid IMFSourceReaderEx instance.</param></param>
        /// <param name="streamIndex">The stream for which to remove the MFTs.</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 RemoveAllTransformsForStream(this IMFSourceReaderEx sourceReader, SourceReaderFirstStream streamIndex)
        {
            if (sourceReader == null)
            {
                throw new ArgumentNullException("sourceReader");
            }

            return(sourceReader.RemoveAllTransformsForStream((int)streamIndex));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets an instance of a Media Foundation transform (MFT) for a specified stream.
        /// </summary>
        /// <param name="sourceReader">A valid IMFSourceReaderEx instance.</param></param>
        /// <param name="streamIndex">The stream to query for the MFT. </param>
        /// <param name="transformIndex">The zero-based index of the MFT to retreive.</param>
        /// <param name="guidCategory">Receives a GUID that specifies the category of the MFT.</param>
        /// <param name="transform">Receives an instance of the IMFTransform interface for the MFT.</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 GetTransformForStream(this IMFSourceReaderEx sourceReader, SourceReaderFirstStream streamIndex, int transformIndex, out Guid guidCategory, out IMFTransform transform)
        {
            if (sourceReader == null)
            {
                throw new ArgumentNullException("sourceReader");
            }

            return(sourceReader.GetTransformForStream((int)streamIndex, transformIndex, out guidCategory, out transform));
        }