Example #1
0
 /// <summary>
 /// (Abstract) Process the input buffers from a previous call to InternalProcessInput into the provided output buffers
 /// </summary>
 /// <param name="dwFlags">Flags controlling the operation</param>
 /// <param name="cOutputBufferCount">The number of buffers provided (one per output stream)</param>
 /// <param name="pOutputBuffers">The output buffer into which the data is processed</param>
 /// <param name="pdwStatus">Zero</param>
 /// <returns>S_FALSE if there is no output, S_OK for successful operation.</returns>
 /// <remarks>
 /// This method is called by the abstract class.  It passes the output buffers to the implementor.
 /// Typically, this is when the actual work is done, processing the input buffers into the output
 /// buffers.
 /// </remarks>
 protected abstract int InternalProcessOutput(DMOProcessOutput dwFlags, int cOutputBufferCount,  DMOOutputDataBuffer [] pOutputBuffers,  out int pdwStatus);
Example #2
0
        /// <summary>
        /// COM entry point for IMediaObject.ProcessOutput
        /// </summary>
        /// <remarks>
        /// There should be no need to modify or override this method.  It will call the
        /// abstract and virtual methods to perform its work.
        /// </remarks>
        public int ProcessOutput(
            DMOProcessOutput dwFlags,
            int ulOutputBufferCount,
            DMOOutputDataBuffer [] pOutputBuffers,
            out int pdwStatus)
        {
            int hr;

            try
            {
                // Avoid multi-threaded access issues
                lock(this)
                {
                    m_Log.Write("ProcessOutput\r\n");
                    pdwStatus = 0;

                    // The number of buffers needs to exactly equal the number of streams
                    if (ulOutputBufferCount == m_NumOutputs && ( (dwFlags & ~DMOProcessOutput.DiscardWhenNoBuffer) == 0))
                    {
                        // If there are output streams, pOutputBuffers can't be null
                        if (m_NumOutputs > 0 || pOutputBuffers != null)
                        {
                            hr = AllocateStreamingResources();
                            if (hr >= 0)
                            {
                                // Init the status flags to zero
                                int dw;
                                for (dw = 0; dw < m_NumOutputs; dw++)
                                {
                                    pOutputBuffers[dw].dwStatus = DMOOutputDataBufferFlags.None;
                                }

                                // Fill the buffers
                                hr = InternalProcessOutput(
                                    dwFlags,
                                    ulOutputBufferCount,
                                    pOutputBuffers,
                                    out pdwStatus);

                                // remember the DMO's incomplete status
                                for (dw = 0; dw < m_NumOutputs; dw++)
                                {
                                    if ( (pOutputBuffers[dw].dwStatus & DMOOutputDataBufferFlags.InComplete) > 0)
                                    {
                                        m_OutputInfo[dw].fIncomplete = true;
                                    }
                                    else
                                    {
                                        m_OutputInfo[dw].fIncomplete = false;
                                    }
                                }
                            }
                        }
                        else
                        {
                            hr =  E_POINTER;
                        }
                    }
                    else
                    {
                        hr = E_INVALIDARG;
                    }
                }
            }
            catch (Exception e)
            {
                // Generic handling of all exceptions.  While .NET will turn exceptions into
                // HRESULTS "automatically", I prefer to have some place I can set a breakpoint.
                hr = CatFail(e);

                // Have to have this to make the compiler happy.
                pdwStatus = 0;
            }

            return hr;
        }