Exemplo n.º 1
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>
        /// <param name="mediaType">A variable that receives the retrieved media type of the specified output stream.</param>
        /// <returns>HRESULT</returns>
        public unsafe int GetOutputCurrentType(int outputStreamIndex, out MediaType mediaType)
        {
            fixed(void *p = &mediaType)
            {
                return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, outputStreamIndex, p, ((void **)(*(void **)UnsafeBasePtr))[11]));
            }
        }
Exemplo n.º 2
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>
        /// <param name="maxLatency">Receives the maximum latency in reference type units. Unit = REFERENCE_TIME = 100 nanoseconds</param>
        /// <returns>HRESULT</returns>
        public unsafe int GetInputMaxLatencyNative(int inputStreamIndex, out long maxLatency)
        {
            fixed(void *p = &maxLatency)
            {
                return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, inputStreamIndex, p, ((void **)(*(void **)UnsafeBasePtr))[14]));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Specifies the channel matrix.
 /// </summary>
 /// <param name="channelConversitionMatrix">An array of floating-point values that represents a channel conversion matrix.</param>
 /// <returns>HRESULT</returns>
 /// <remarks>
 ///     Use the <see cref="ChannelMatrix" /> class to build the channel-conversation-matrix and its
 ///     <see cref="ChannelMatrix.GetOneDimensionalMatrix" /> method to convert the channel-conversation-matrix into a
 ///     compatible array which can be passed as value for the <paramref name="channelConversitionMatrix" /> parameter.
 ///     For more information,
 ///     <see href="https://msdn.microsoft.com/en-us/library/windows/desktop/ff819252(v=vs.85).aspx" />.
 /// </remarks>
 public unsafe int SetUserChannelMtxNative(float[] channelConversitionMatrix)
 {
     fixed(void *pccm = &channelConversitionMatrix[0])
     {
         return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, pccm, ((void **)(*(void **)UnsafeBasePtr))[4]));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        ///     Retrieves a specified number of items in the enumeration sequence.
        /// </summary>
        /// <param name="itemsToFetch">Number of items to retrieve.</param>
        /// <param name="clsids">Array that is filled with the CLSIDs of the enumerated DMOs.</param>
        /// <param name="names">Array that is filled with the friendly names of the enumerated DMOs.</param>
        /// <param name="itemsFetched">Actual number of items retrieved.</param>
        /// <returns>HRESULT</returns>
        public unsafe int NextNative(int itemsToFetch, out Guid[] clsids, out string[] names, out int itemsFetched)
        {
            if (itemsToFetch <= 0)
            {
                throw new ArgumentOutOfRangeException("itemsToFetch");
            }

            int result;

            clsids = new Guid[itemsToFetch];
            names  = new string[itemsToFetch];

            var pnames = new IntPtr[itemsToFetch];

            fixed(void *p1 = &clsids[0], p2 = &pnames[0], p3 = &itemsFetched)
            {
                result = LocalInterop.CalliMethodPtr(UnsafeBasePtr, itemsToFetch, p1, p2, p3,
                                                     ((void **)(*(void **)UnsafeBasePtr))[3]);
            }

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

            for (int i = 0; i < itemsFetched; i++)
            {
                names[i] = Marshal.PtrToStringUni(pnames[i]);
                Marshal.FreeCoTaskMem(pnames[i]);
            }

            return(result);
        }
Exemplo n.º 5
0
        //---

        /// <summary>
        ///     This method is not implemented.
        /// </summary>
        /// <param name="pEnum">Reserved</param>
        /// <returns><see cref="HResult.E_NOTIMPL"/></returns>
        public unsafe int CloneNative(out IntPtr pEnum)
        {
            fixed(void *p = &pEnum)
            {
                return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, p, ((void **)(*(void **)UnsafeBasePtr))[6]));
            }
        }
Exemplo n.º 6
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>
 /// <returns>HRESULT</returns>
 public unsafe int GetStreamCountNative(out int inputStreams, out int outputStreams)
 {
     inputStreams = outputStreams = 0;
     fixed(void *i0 = &inputStreams, i1 = &outputStreams)
     {
         return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, i0, i1, ((void **)(*(void **)UnsafeBasePtr))[3]));
     }
 }
Exemplo n.º 7
0
        //--

        /// <summary>
        ///     Retrieves information about a specified output stream.
        /// </summary>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        /// <param name="flags">Bitwise combination of zero or more <see cref="DmoOutputStreamInfoFlags" /> flags.</param>
        /// <returns>HRESULT</returns>
        public unsafe int GetOutputStreamInfoNative(int outputStreamIndex, out DmoOutputStreamInfoFlags flags)
        {
            flags = DmoOutputStreamInfoFlags.None;
            fixed(void *p = &flags)
            {
                return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, outputStreamIndex, p, ((void **)(*(void **)UnsafeBasePtr))[5]));
            }
        }
Exemplo n.º 8
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>
 /// <param name="flags">A variable that receives either <see cref="InputStatusFlags.None"/> or <see cref="InputStatusFlags.AcceptData"/>.</param>
 /// <returns>HRESULT</returns>
 /// <remarks>
 ///     For more information, see <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd406950(v=vs.85).aspx"/>.
 /// </remarks>
 public unsafe int GetInputStatusNative(int inputStreamIndex, out InputStatusFlags flags)
 {
     fixed(void *pflags = &flags)
     {
         return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, inputStreamIndex, pflags,
                                            ((void **)(*(void **)UnsafeBasePtr))[20]));
     }
 }
Exemplo n.º 9
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>
        /// <param name="minSize">Minimum size of an output buffer for this stream, in bytes.</param>
        /// <param name="alignment">
        ///     The required buffer alignment, in bytes. If the output stream has no alignment requirement, the
        ///     value is 1.
        /// </param>
        /// <returns>HRESULT</returns>
        public unsafe int GetOutputSizeInfoNative(int outputStreamIndex, out int minSize, out int alignment)
        {
            fixed(void *p0 = &minSize, p2 = &alignment)
            {
                return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, outputStreamIndex, p0, p2,
                                                   ((void **)(*(void **)UnsafeBasePtr))[13]));
            }
        }
Exemplo n.º 10
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>
 /// <param name="status">Receives a reserved value (zero). The application should ignore this value.</param>
 /// <returns>HREUSLT</returns>
 public unsafe int ProcessOutputNative(ProcessOutputFlags flags, int bufferCount, DmoOutputDataBuffer[] buffers,
                                       out int status)
 {
     fixed(void *pstatus = &status)
     {
         return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, flags, bufferCount, buffers, pstatus,
                                            ((void **)(*(void **)UnsafeBasePtr))[22]));
     }
 }
Exemplo n.º 11
0
        //---

        /// <summary>
        ///     Retrieves the buffer requirements for a specified input stream.
        /// </summary>
        /// <param name="inputStreamIndex">Zero-based index of an input stream on the DMO.</param>
        /// <param name="minSize">Minimum size of an input buffer for this stream, in bytes.</param>
        /// <param name="maxLookahead">
        ///     The maximum amount of data that the DMO will hold for a lookahead, in bytes. If the DMO does
        ///     not perform a lookahead on the stream, the value is zero.
        /// </param>
        /// <param name="alignment">
        ///     The required buffer alignment, in bytes. If the input stream has no alignment requirement, the
        ///     value is 1.
        /// </param>
        /// <returns>HRESULT</returns>
        public unsafe int GetInputSizeInfoNative(int inputStreamIndex, out int minSize, out int maxLookahead,
                                                 out int alignment)
        {
            fixed(void *p0 = &minSize, p1 = &maxLookahead, p2 = &alignment)
            {
                return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, inputStreamIndex, p0, p1, p2,
                                                   ((void **)(*(void **)UnsafeBasePtr))[12]));
            }
        }
Exemplo n.º 12
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="mediaType">
        ///     Can be null to check whether the typeIndex argument is in range. If not, the errorcode will be
        ///     <see cref="DmoErrorCodes.DMO_E_NO_MORE_ITEMS"/> (0x80040206).
        /// </param>
        /// <param name="outputStreamIndex">Zero-based index of an output stream on the DMO.</param>
        /// <returns>HRESULT</returns>
        public unsafe int GetOutputTypeNative(int outputStreamIndex, int typeIndex, ref MediaType?mediaType)
        {
            var ptr = (void *)IntPtr.Zero;
            var mt  = new MediaType();

            if (mediaType != null)
            {
                ptr = &mt;
            }

            int result = LocalInterop.CalliMethodPtr(UnsafeBasePtr, outputStreamIndex, typeIndex, ptr,
                                                     ((void **)(*(void **)UnsafeBasePtr))[7]);

            if (mediaType != null)
            {
                mediaType = mt;
            }

            return(result);
        }
Exemplo n.º 13
0
 public unsafe int ProcessInputNative(int inputStreamIndex, MONO.MediaBuffer mediaBuffer, InputDataBufferFlags flags,
                                      long timestamp, long timeduration)
 {
     return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, inputStreamIndex, mediaBuffer.NativePointer.ToPointer(), flags, timestamp, timeduration,
                                        ((void **)(*(void **)UnsafeBasePtr))[21]));
 }
Exemplo n.º 14
0
        //---

        /// <summary>
        ///     Skips over a specified number of items in the enumeration sequence.
        /// </summary>
        /// <param name="itemsToSkip">Number of items to skip.</param>
        /// <returns>HRESULT</returns>
        public unsafe int SkipNative(int itemsToSkip)
        {
            return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, itemsToSkip, ((void **)(*(void **)UnsafeBasePtr))[4]));
        }
Exemplo n.º 15
0
        //---

        /// <summary>
        ///     Frees resources allocated by the DMO. Calling this method is always optional.
        /// </summary>
        /// <returns>HREUSLT</returns>
        /// <remarks>
        ///     For more information, see <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd406946(v=vs.85).aspx"/>.
        /// </remarks>
        public unsafe int FreeStreamingResourcesNative()
        {
            return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, ((void **)(*(void **)UnsafeBasePtr))[19]));
        }
Exemplo n.º 16
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>
        /// <returns>HRESULT</returns>
        /// <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(AudioSharp.DMO.ProcessOutputFlags,AudioSharp.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 unsafe int DiscontinuityNative(int inputStreamIndex)
        {
            return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, inputStreamIndex, ((void **)(*(void **)UnsafeBasePtr))[17]));
        }
Exemplo n.º 17
0
        //---

        /// <summary>
        ///     This method flushes all internally buffered data.
        /// </summary>
        /// <returns>HRESULT</returns>
        public unsafe int FlushNative()
        {
            return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, ((void **)(*(void **)UnsafeBasePtr))[16]));
        }
Exemplo n.º 18
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 unsafe int SetInputMaxLatencyNative(int inputStreamIndex, long maxLatency)
        {
            return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, inputStreamIndex, maxLatency,
                                               ((void **)(*(void **)UnsafeBasePtr))[15]));
        }
Exemplo n.º 19
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>
        /// <returns>HRESULT</returns>
        public unsafe int SetOutputTypeNative(int outputStreamIndex, MediaType mediaType, SetTypeFlags flags)
        {
            return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, outputStreamIndex, &mediaType, flags,
                                               ((void **)(*(void **)UnsafeBasePtr))[9]));
        }
Exemplo n.º 20
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(
         LocalInterop.CalliMethodPtr(UnsafeBasePtr, outputStreamIndex, IntPtr.Zero.ToPointer(), SetTypeFlags.Clear,
                                     ((void **)(*(void **)UnsafeBasePtr))[9]), n, "SetOutputType");
 }
Exemplo 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>
        /// <returns>HRESULT</returns>
        public unsafe int LockNative(long bLock)
        {
            return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, bLock, ((void **)(*(void **)UnsafeBasePtr))[23]));
        }
Exemplo n.º 22
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>
 /// <returns>HRESULT</returns>
 public unsafe int SetHalfFilterLengthNative(int quality)
 {
     return(LocalInterop.CalliMethodPtr(UnsafeBasePtr, quality, ((void **)(*(void **)UnsafeBasePtr))[3]));
 }