コード例 #1
0
        private void RenderToAsfWriter(
            string file,
            string profileData,
            ICallbackParticipant[] videoParticipants,
            ICallbackParticipant[] audioParticipants)
        {
            int hr;

            if (file == null)
            {
                throw new SplicerException(Resources.ErrorInvalidOutputFileName);
            }

            // Contains useful routines for creating the graph
            var graphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();

            try
            {
                hr = graphBuilder.SetFiltergraph(Graph);
                DESError.ThrowExceptionForHR(hr);

                IBaseFilter pMux = StandardFilters.RenderAsfWriterWithProfile(Cleanup, Graph, profileData, file);

                ValidateAsfWriterIsSuitable(pMux);

                Cleanup.Add(pMux);

                try
                {
                    RenderGroups(graphBuilder, null, null, pMux, audioParticipants, videoParticipants);
                }
                finally
                {
                    Marshal.ReleaseComObject(pMux);
                }

                DisableClock();
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                Marshal.ReleaseComObject(graphBuilder);
            }
        }
コード例 #2
0
        protected void RenderToAsfWriter(
            string file,
            string profileData,
            IDESCombineCB pVideoCallback,
            IDESCombineCB pAudioCallback)
        {
            int hr;

            if (file == null)
            {
                throw new SplicerException("Output file name cannot be null");
            }

            // Contains useful routines for creating the graph
            ICaptureGraphBuilder2 icgb = (ICaptureGraphBuilder2) new CaptureGraphBuilder2();

            try
            {
                hr = icgb.SetFiltergraph(_graph);
                DESError.ThrowExceptionForHR(hr);

                IBaseFilter pMux = StandardFilters.RenderAsfWriterWithProfile(_dc, _graph, profileData, file);

                ValidateAsfWriterIsSuitable(pMux);

                _dc.Add(pMux);

                try
                {
                    RenderGroups(icgb, null, null, pMux, pAudioCallback, pVideoCallback);
                }
                finally
                {
                    Marshal.ReleaseComObject(pMux);
                }
            }
            finally
            {
                Marshal.ReleaseComObject(icgb);
            }
        }