Ejemplo n.º 1
0
        /// <summary>
        ///     Retrieves the maximum latency on a specified input stream.
        /// </summary>
        /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
        /// <returns>The maximum latency in reference type units. Unit = REFERENCE_TIME = 100 nanoseconds</returns>
        public long GetInputMaxLatency(int inputStreamIndex)
        {
            long l0;

            DmoException.Try(GetInputMaxLatencyNative(inputStreamIndex, out l0), n, "GetInputMaxLatency");
            return(l0);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Enumerates DMOs listed in the registry. The caller can search by category, media type, or both.
        /// </summary>
        /// <param name="category">
        ///     GUID that specifies which category of DMO to search. Use Guid.Empty to search every category.
        ///     See <see cref="DmoEnumeratorCategories" /> for a list of category guids.
        /// </param>
        /// <param name="flags">Flags that specify search criteria.</param>
        /// <param name="inputTypes">Array of input-Mediatypes.</param>
        /// <param name="outputTypes">Array of output-Mediatypes.</param>
        /// <returns>EnumDMO</returns>
        public static EnumDmo EnumerateDMOs(Guid category, DmoEnumFlags flags, DmoPartialMediaType[] inputTypes,
                                            DmoPartialMediaType[] outputTypes)
        {
            IntPtr ptr;
            int    numberOfInputTypes  = 0;
            int    numberOfOutputTypes = 0;

            if (inputTypes != null)
            {
                numberOfInputTypes = inputTypes.Length;
            }
            if (outputTypes != null)
            {
                numberOfOutputTypes = outputTypes.Length;
            }

            int result = NativeMethods.DMOEnum(
                ref category,
                flags,
                numberOfInputTypes,
                inputTypes,
                numberOfOutputTypes,
                outputTypes,
                out ptr);

            DmoException.Try(result, "Interops", "DMOEnum");

            return(new EnumDmo(ptr));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Retrieves information about a specified output stream.
        /// </summary>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        /// <returns>The information about the specified output stream.</returns>
        public DmoOutputStreamInfoFlags GetOutputStreamInfo(int outputStreamIndex)
        {
            DmoOutputStreamInfoFlags flags;

            DmoException.Try(GetOutputStreamInfoNative(outputStreamIndex, out flags), n, "GetOutputSreamInfo");
            return(flags);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Retrieves the media type that was set for an output stream, if any.
        /// </summary>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        /// <returns>The media type that was set for the specified output stream.</returns>
        public MediaType GetOutputCurrentType(int outputStreamIndex)
        {
            MediaType mediaType;

            DmoException.Try(GetOutputCurrentType(outputStreamIndex, out mediaType), n, "GetOutputCurrentType");
            return(mediaType);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///     This method is not implemented.
        /// </summary>
        /// <returns>This method is not implemented an will throw an <see cref="DmoException"/> with the error code <see cref="HResult.E_NOTIMPL"/>.</returns>
        public EnumDmo Clone()
        {
            IntPtr p;

            DmoException.Try(CloneNative(out p), InterfaceName, "Clone");
            return(new EnumDmo(p));
        }
Ejemplo n.º 6
0
        /// <summary>
        ///     Retrieves a specified number of items in the enumeration sequence.
        /// </summary>
        /// <param name="itemsToFetch">Number of items to retrieve.</param>
        /// <returns>Array of enumerated DMOs.</returns>
        public DmoEnumItem[] Next(int itemsToFetch)
        {
            Guid[]   clsids;
            string[] names;
            int      itemsFetched;

            int result = NextNative(itemsToFetch, out clsids, out names, out itemsFetched);

            if (result != (int)HResult.S_FALSE && result != (int)HResult.S_OK)
            {
                DmoException.Try(result, InterfaceName, "Next");
            }

            var items = new DmoEnumItem[itemsFetched];

            for (int i = 0; i < items.Length; i++)
            {
                items[i] = new DmoEnumItem
                {
                    CLSID = clsids[i],
                    Name  = names[i]
                };
            }

            return(items);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Retrieves a preferred media type for a specified output stream.
        /// </summary>
        /// <param name="typeIndex">Zero-based index on the set of acceptable media types.</param>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        public MediaType GetOutputType(int outputStreamIndex, int typeIndex)
        {
            MediaType?mediaType = new MediaType();

            DmoException.Try(GetOutputTypeNative(outputStreamIndex, typeIndex, ref mediaType), n, "GetOutputType");
            return(mediaType.Value);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     This method retrieves the buffer requirements for a specified output stream.
        /// </summary>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        /// <returns>The buffer requirements for the specified output stream.</returns>
        public DmoSizeInfo GetOutputSizeInfo(int outputStreamIndex)
        {
            int i0, i2;

            DmoException.Try(GetOutputSizeInfoNative(outputStreamIndex, out i0, out i2), n, "GetInputSizeInfo");
            return(new DmoSizeInfo(i0, i2));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// This method is not implemented.
        /// </summary>
        public EnumDMO Clone()
        {
            IntPtr p;

            DmoException.Try(CloneNative(out p), n, "Clone");
            return(new EnumDMO(p));
        }
Ejemplo n.º 10
0
        //---

        /// <summary>
        ///     Queries whether an input stream can accept more input data.
        /// </summary>
        /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
        /// <returns>The queried input status.</returns>
        /// <remarks>
        ///     For more information, see <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd406950(v=vs.85).aspx"/>.
        /// </remarks>
        public InputStatusFlags GetInputStatus(int inputStreamIndex)
        {
            InputStatusFlags flags;
            int result = GetInputStatusNative(inputStreamIndex, out flags);

            DmoException.Try(result, n, "GetInputStatus");
            return(flags);
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Retrieves a preferred media type for a specified output stream.
        /// </summary>
        /// <param name="typeIndex">Zero-based index on the set of acceptable media types.</param>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        /// <returns>The preferred media type for the specified output stream.</returns>
        public MediaType GetOutputType(int outputStreamIndex, int typeIndex)
        {
            MediaType?mediaType = new MediaType();

            DmoException.Try(GetOutputTypeNative(outputStreamIndex, typeIndex, ref mediaType), n, "GetOutputType");
            Debug.Assert(mediaType != null, "No mediatype was returned.");
            return(mediaType.Value);
        }
Ejemplo n.º 12
0
 /// <summary>
 ///     Specifies the quality of the output.
 /// </summary>
 /// <param name="quality">
 ///     Specifies the quality of the output. The valid range is 1 to 60,
 ///     inclusive.
 /// </param>
 public void SetHalfFilterLength(int quality)
 {
     if (quality < 1 || quality > 60)
     {
         throw new ArgumentOutOfRangeException("quality");
     }
     DmoException.Try(SetHalfFilterLengthNative(quality), "IWMResamplerProps", "SetHalfFilterLength");
 }
Ejemplo n.º 13
0
        /// <summary>
        ///     Sets the <see cref="MediaType"/> on an output stream, or tests whether a <see cref="MediaType"/> is acceptable.
        /// </summary>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        /// <param name="mediaType">The new <see cref="MediaType"/>.</param>
        /// <param name="flags">Bitwise combination of zero or more flags from the <see cref="SetTypeFlags"/> enumeration.</param>
        public void SetOutputType(int outputStreamIndex, MediaType mediaType, SetTypeFlags flags)
        {
            int result = SetOutputTypeNative(outputStreamIndex, mediaType, flags);

            if ((flags & SetTypeFlags.TestOnly) != SetTypeFlags.TestOnly)
            {
                DmoException.Try(result, n, "SetOutputType");
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Enumerates DMOs listed in the registry. The caller can search by category, media type, or both.
        /// </summary>
        /// <param name="category">GUID that specifies which category of DMO to search. Use Guid.Empty to search every category. See <see cref="DmoEnumeratorCategories"/> for a list of category guids.</param>
        /// <param name="flags">Flags that specify search criteria.</param>
        /// <param name="inputTypes">Array of input-Mediatypes.</param>
        /// <param name="outputTypes">Array of output-Mediatypes.</param>
        /// <returns>EnumDMO</returns>
        public static EnumDMO EnumerateDMOs(Guid category, DmoEnumFlags flags, DmoPartialMediaType[] inputTypes, DmoPartialMediaType[] outputTypes)
        {
            IntPtr ptr;
            int    result = DmoInterop.DMOEnum(ref category, flags, inputTypes != null ? inputTypes.Length : 0, inputTypes, outputTypes != null ? inputTypes.Length : 0, outputTypes, out ptr);

            DmoException.Try(result, "Interops", "DMOEnum");

            return(new EnumDMO(ptr));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// See http://msdn.microsoft.com/en-us/library/windows/desktop/ff819252(v=vs.85).aspx
        /// </summary>
        public void SetUserChannelMtx(float[] channelConversitionMatrix)
        {
            if (channelConversitionMatrix == null)
            {
                throw new ArgumentNullException("channelConversitionMatrix");
            }

            DmoException.Try(SetUserChannelMtxNative(channelConversitionMatrix), "IWMResamplerProps", "SetUserChannelMtxNative");
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Delivers a buffer to the specified input stream.
        /// </summary>
        /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
        /// <param name="mediaBuffer">The mediabuffer which has to be processed.</param>
        /// <param name="flags">Flags to describe the mediabuffer.</param>
        /// <param name="timestamp">Time stamp that specifies the start time of the data in the buffer. If the buffer has a valid time stamp, set the Time flag in the flags parameter.</param>
        /// <param name="timeduration">Reference time specifying the duration of the data in the buffer. If the buffer has a valid time stamp, set the TimeLength flag in the flags parameter.</param>
        public unsafe void ProcessInput(int inputStreamIndex, IMediaBuffer mediaBuffer, InputDataBufferFlags flags, long timestamp, long timeduration)
        {
            int result = ProcessInputNative(inputStreamIndex, mediaBuffer, flags, timestamp, timeduration);

            if (result == (int)HResult.S_FALSE)
            {
                return;
            }

            DmoException.Try(result, n, "ProcessInput");
        }
Ejemplo n.º 17
0
        /// <summary>
        ///     Generates output from the current input data.
        /// </summary>
        /// <param name="flags">Bitwise combination of <see cref="ProcessOutputFlags.None"/> or more flags from the <see cref="ProcessOutputFlags"/> enumeration.</param>
        /// <param name="buffers">An array of output buffers to process.</param>
        /// <param name="bufferCount">Number of output buffers.</param>
        public void ProcessOutput(ProcessOutputFlags flags, DmoOutputDataBuffer[] buffers, int bufferCount)
        {
            int status;

            int result = ProcessOutputNative(flags, bufferCount, buffers, out status);

            if (result == (int)HResult.S_FALSE)
            {
                return;
            }
            DmoException.Try(result, n, "ProcessOutput");
        }
Ejemplo n.º 18
0
 /// <summary>
 ///     Resets the enumeration sequence to the beginning.
 /// </summary>
 public void Reset()
 {
     DmoException.Try(ResetNative(), InterfaceName, "Reset");
 }
Ejemplo n.º 19
0
 /// <summary>
 ///     Skips over a specified number of items in the enumeration sequence.
 /// </summary>
 /// <param name="itemsToSkip">Number of items to skip.</param>
 public void Skip(int itemsToSkip)
 {
     DmoException.Try(SkipNative(itemsToSkip), InterfaceName, "Skip");
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Clears the inputtype for a specific inputStreamIndex.
 /// </summary>
 /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
 public unsafe void ClearInputType(int inputStreamIndex)
 {
     DmoException.Try(InteropCalls.CalliMethodPtr(_basePtr, inputStreamIndex, IntPtr.Zero.ToPointer(), SetTypeFlags.Clear, ((void **)(*(void **)_basePtr))[8]), n, "SetInputType");
 }
Ejemplo n.º 21
0
 /// <summary>
 ///     Acquires or releases a lock on the DMO. Call this method to keep the DMO serialized when performing multiple
 ///     operations.
 /// </summary>
 /// <param name="bLock">
 ///     Value that specifies whether to acquire or release the lock. If the value is non-zero, a lock is
 ///     acquired. If the value is zero, the lock is released.
 /// </param>
 public void Lock(long bLock)
 {
     DmoException.Try(LockNative(bLock), n, "Lock");
 }
Ejemplo n.º 22
0
 /// <summary>
 ///     Retrieves the number of input and output streams.
 /// </summary>
 /// <param name="inputStreams">A variable that receives the number of input streams.</param>
 /// <param name="outputStreams">A variable that receives the number of output streams.</param>
 public void GetStreamCount(out int inputStreams, out int outputStreams)
 {
     DmoException.Try(GetStreamCountNative(out inputStreams, out outputStreams), n, "GetStreamCount");
 }
Ejemplo n.º 23
0
 /// <summary>
 ///     Sets the media type on an input stream.
 /// </summary>
 /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
 /// <param name="mediaType">The new mediatype.</param>
 /// <param name="flags">Bitwise combination of zero or more flags from the <see cref="SetTypeFlags"/> enumeration.</param>
 public void SetInputType(int inputStreamIndex, MediaType mediaType, SetTypeFlags flags)
 {
     DmoException.Try(SetInputTypeNative(inputStreamIndex, mediaType, flags), n, "SetInputType");
 }
Ejemplo n.º 24
0
 /// <summary>
 ///     Frees resources allocated by the DMO. Calling this method is always optional.
 /// </summary>
 /// <remarks>
 ///     For more information, see <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd406946(v=vs.85).aspx"/>.
 /// </remarks>
 public void FreeStreamingResources()
 {
     DmoException.Try(FreeStreamingResourcesNative(), n, "FreeStreamingResources");
 }
Ejemplo n.º 25
0
 /// <summary>
 ///     Allocates any resources needed by the DMO. Calling this method is always
 ///     optional.
 /// </summary>
 /// <remarks>
 ///     For more information, see <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd406943(v=vs.85).aspx"/>.
 /// </remarks>
 public void AllocateStreamingResources()
 {
     DmoException.Try(AllocateStreamingResourcesNative(), n, "AllocateStreamingResources");
 }
Ejemplo n.º 26
0
 /// <summary>
 ///     Signals a discontinuity on the specified input stream.
 /// </summary>
 /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
 /// <remarks>A discontinuity represents a break in the input. A discontinuity might occur because no more data is expected, the format is changing, or there is a gap in the data.
 /// After a discontinuity, the DMO does not accept further input on that stream until all pending data has been processed.
 /// The application should call the <see cref="ProcessOutput(CSCore.DMO.ProcessOutputFlags,CSCore.DMO.DmoOutputDataBuffer[])"/> method until none of the streams returns the <see cref="OutputDataBufferFlags.Incomplete"/> (see <see cref="DmoOutputDataBuffer.Status"/>) flag.
 /// This method might fail if it is called before the client sets the input and output types on the DMO.</remarks>
 public void Discontinuity(int inputStreamIndex)
 {
     DmoException.Try(DiscontinuityNative(inputStreamIndex), n, "Discontinuity");
 }
Ejemplo n.º 27
0
 /// <summary>
 ///     This method flushes all internally buffered data.
 /// </summary>
 public void Flush()
 {
     DmoException.Try(FlushNative(), n, "Flush");
 }
Ejemplo n.º 28
0
 /// <summary>
 ///     Clears the outputtype for a specific output stream.
 /// </summary>
 /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
 public unsafe void ClearOutputType(int outputStreamIndex)
 {
     DmoException.Try(
         InteropCalls.CalliMethodPtr(UnsafeBasePtr, outputStreamIndex, IntPtr.Zero.ToPointer(), SetTypeFlags.Clear,
                                     ((void **)(*(void **)UnsafeBasePtr))[9]), n, "SetOutputType");
 }
Ejemplo n.º 29
0
 /// <summary>
 ///     Sets the maximum latency on a specified input stream.
 /// </summary>
 /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
 /// <param name="maxLatency">Maximum latency in reference time units. Unit = REFERENCE_TIME = 100 nanoseconds</param>
 /// <returns>HRESULT</returns>
 /// <remarks>For the definition of maximum latency, see <see href="https://msdn.microsoft.com/en-us/Library/dd406948(v=vs.85).aspx"/>.</remarks>
 public void SetInputMaxLatency(int inputStreamIndex, long maxLatency)
 {
     DmoException.Try(SetInputMaxLatencyNative(inputStreamIndex, maxLatency), n, "SetInputMaxLatency");
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Resets the enumeration sequence to the beginning.
 /// </summary>
 public void Reset()
 {
     DmoException.Try(ResetNative(), n, "Reset");
 }