예제 #1
0
        /// <summary>
        /// Generates output from the current input data.
        /// </summary>
        /// <param name="dwFlags">Bitwise OR of zero or more flags from the <strong><see cref="SharpDX.MediaFoundation.TransformProcessOutputFlags" /></strong> enumeration.</param>
        /// <param name="outputSamplesRef">Pointer to an array of <strong><see cref="SharpDX.MediaFoundation.TOutputDataBuffer" /></strong> structures, allocated by the caller. The MFT uses this array to return output data to the caller.</param>
        /// <param name="dwStatusRef">Receives a bitwise OR of zero or more flags from the <strong><see cref="SharpDX.MediaFoundation.TransformProcessOutputStatus" /></strong> enumeration.</param>
        /// <returns><c>true</c> if the transform cannot produce output data until it receives more input data, <c>false</c> otherwise</returns>
        /// <msdn-id>ms704014</msdn-id>
        /// <unmanaged>HRESULT IMFTransform::ProcessOutput([In] _MFT_PROCESS_OUTPUT_FLAGS dwFlags,[In] unsigned int cOutputBufferCount,[In] MFT_OUTPUT_DATA_BUFFER* pOutputSamples,[Out] _MFT_PROCESS_OUTPUT_STATUS* pdwStatus)</unmanaged>
        /// <unmanaged-short>IMFTransform::ProcessOutput</unmanaged-short>
        public bool ProcessOutput(TransformProcessOutputFlags dwFlags, TOutputDataBuffer[] outputSamplesRef, out TransformProcessOutputStatus dwStatusRef)
        {
            bool needMoreInput = false;
            var  result        = ProcessOutput(dwFlags, outputSamplesRef.Length, outputSamplesRef[0], out dwStatusRef);

            // Check if it needs more input
            if (result == ResultCode.TransformNeedMoreInput)
            {
                needMoreInput = true;
            }
            else
            {
                result.CheckError();
            }

            return(!needMoreInput);
        }
예제 #2
0
        /// <summary>
        /// Generates output from the current input data.
        /// </summary>
        /// <param name="dwFlags">Bitwise OR of zero or more flags from the <strong><see cref="SharpDX.MediaFoundation.TransformProcessOutputFlags" /></strong> enumeration.</param>
        /// <param name="outputSamplesRef">Pointer to an array of <strong><see cref="SharpDX.MediaFoundation.TOutputDataBuffer" /></strong> structures, allocated by the caller. The MFT uses this array to return output data to the caller.</param>
        /// <param name="dwStatusRef">Receives a bitwise OR of zero or more flags from the <strong><see cref="SharpDX.MediaFoundation.TransformProcessOutputStatus" /></strong> enumeration.</param>
        /// <returns><c>true</c> if the transform cannot produce output data until it receives more input data, <c>false</c> otherwise</returns>
        /// <msdn-id>ms704014</msdn-id>	
        /// <unmanaged>HRESULT IMFTransform::ProcessOutput([In] _MFT_PROCESS_OUTPUT_FLAGS dwFlags,[In] unsigned int cOutputBufferCount,[In] MFT_OUTPUT_DATA_BUFFER* pOutputSamples,[Out] _MFT_PROCESS_OUTPUT_STATUS* pdwStatus)</unmanaged>	
        /// <unmanaged-short>IMFTransform::ProcessOutput</unmanaged-short>	
        public bool ProcessOutput(TransformProcessOutputFlags dwFlags, TOutputDataBuffer[] outputSamplesRef, out TransformProcessOutputStatus dwStatusRef)
        {
            bool needMoreInput = false;
            var result = ProcessOutput(dwFlags, outputSamplesRef.Length, outputSamplesRef[0], out dwStatusRef);

            // Check if it needs more input
            if (result== ResultCode.TransformNeedMoreInput)
            {
                needMoreInput = true;
            }
            else
            {
                result.CheckError();
            }

            return needMoreInput;
        }
예제 #3
0
 public Result ProcessOutput(TransformProcessOutputFlags dwFlags, TOutputDataBuffer outputSampleRef, out TransformProcessOutputStatus dwStatusRef)
 {
     return(_ProcessOutput(dwFlags, 1, ref outputSampleRef, out dwStatusRef));
 }
예제 #4
0
        public unsafe SharpDX.Result _ProcessOutput(TransformProcessOutputFlags dwFlags, int cOutputBufferCount, ref TOutputDataBuffer outputSamplesRef, out TransformProcessOutputStatus dwStatusRef)
        {
            SharpDX.MediaFoundation.TOutputDataBuffer.__Native outputSamplesRef_ = default(SharpDX.MediaFoundation.TOutputDataBuffer.__Native);
            SharpDX.Result __result__;
            outputSamplesRef.__MarshalTo(ref outputSamplesRef_);

            fixed(void *dwStatusRef_ = &dwStatusRef)
            {
                __result__ = SharpDX.MediaFoundation.LocalInterop.CalliStdCallint(this._nativePointer,
                                                                                  unchecked ((System.Int32)dwFlags), cOutputBufferCount, &outputSamplesRef_, dwStatusRef_,
                                                                                  (*(void ***)this._nativePointer)[25]);
            }

            outputSamplesRef.__MarshalFrom(ref outputSamplesRef_); //<--!!!
            outputSamplesRef.__MarshalFree(ref outputSamplesRef_);
            return(__result__);
        }
예제 #5
0
        //internal unsafe void __MarshalFrom(ref __Native @ref)
        //{
        //    DwStreamID = @ref.DwStreamID;
        //    if (@ref.PSample != System.IntPtr.Zero)
        //        PSample = new SharpDX.MediaFoundation.Sample(@ref.PSample);
        //    else
        //        PSample = null;
        //    DwStatus = @ref.DwStatus;
        //    if (@ref.PEvents != System.IntPtr.Zero)
        //        PEvents = new SharpDX.MediaFoundation.Collection(@ref.PEvents);
        //    else
        //        PEvents = null;
        //}

        public unsafe void ProcessOutput(TransformProcessOutputFlags dwFlags, int cOutputBufferCount, TOutputDataBuffer[] outputBuffersRef, out TransformProcessOutputStatus dwStatusRef)
        {
            TOutputDataBuffer.__Native[] outputBuffersRef_ = new TOutputDataBuffer.__Native[outputBuffersRef.Length];
            SharpDX.Result __result__;

            fixed(void *dwStatusRef_ = &dwStatusRef)
            {
                fixed(void *_outputBuffersRef = outputBuffersRef_)
                {
                    __result__ = SharpDX.MediaFoundation.LocalInterop.CalliStdCallint(this._nativePointer,
                                                                                      unchecked ((System.Int32)dwFlags), cOutputBufferCount, _outputBuffersRef, dwStatusRef_,
                                                                                      (*(void ***)this._nativePointer)[25]);
                }

                for (int i = 0; i < outputBuffersRef.Length; ++i)
                {
                    outputBuffersRef[i].__MarshalFrom(ref (outputBuffersRef_)[i]);
                }
            }

            __result__.CheckError();
        }
예제 #6
0
        public unsafe Result TryProcessOutput(TransformProcessOutputFlags dwFlags, TOutputDataBuffer[] outputBuffersRef, out TransformProcessOutputStatus dwStatusRef)
        {
            int cOutputBufferCount = outputBuffersRef.Length;

            TOutputDataBuffer.__Native[] outputBuffersRef_ = new TOutputDataBuffer.__Native[outputBuffersRef.Length];

            for (int i = 0; i < outputBuffersRef.Length; ++i)
            {
                outputBuffersRef[i].__MarshalTo(ref (outputBuffersRef_)[i]);
            }

            SharpDX.Result __result__;

            fixed(void *dwStatusRef_ = &dwStatusRef)
            {
                fixed(void *_outputBuffersRef_ = outputBuffersRef_)
                {
                    __result__ = LocalInterop.CalliStdCallint(this._nativePointer,
                                                              unchecked ((System.Int32)dwFlags), cOutputBufferCount, _outputBuffersRef_, dwStatusRef_,
                                                              (*(void ***)this._nativePointer)[25]);
                }

                for (int i = 0; i < outputBuffersRef.Length; ++i)
                {
                    IntPtr pSample_ = outputBuffersRef_[i].PSample;

                    if (pSample_ != IntPtr.Zero)
                    {
                        Sample sample  = outputBuffersRef[i].PSample;
                        IntPtr pSample = IntPtr.Zero;

                        if (sample != null)
                        {
                            pSample = (IntPtr)sample._nativePointer;
                        }

                        if (pSample == IntPtr.Zero)
                        {
                            outputBuffersRef[i].PSample = new SharpDX.MediaFoundation.Sample(pSample_);
                        }

                        //if(pSample != pSample_)
                        //{
                        //    //TODO: х.з может ли быть такое??
                        //}
                    }

                    IntPtr pEvents_ = outputBuffersRef_[i].PEvents;
                    if (pEvents_ != IntPtr.Zero)
                    {
                        Collection events  = outputBuffersRef[i].PEvents;
                        IntPtr     pEvents = IntPtr.Zero;

                        if (events != null)
                        {
                            pEvents = (IntPtr)events._nativePointer;
                        }

                        if (pEvents == IntPtr.Zero)
                        {
                            outputBuffersRef[i].PEvents = new SharpDX.MediaFoundation.Collection(pSample_);
                        }

                        //if (pEvents != pEvents_)
                        //{
                        //    //TODO: х.з может ли быть такое??
                        //}
                    }

                    //outputBuffersRef[i].__MarshalFrom(ref (outputBuffersRef_)[i]);
                    //outputBuffersRef[i].__MarshalFree(ref (outputBuffersRef_)[i]);
                }
            }

            return(__result__);
        }