Exemplo n.º 1
0
        /// <summary>
        /// Connect up a branch of the graph for network sending.  Source filter should already be in the graph.
        /// DVSplitter and compressor may also already be connected, but for uncompressed cases, the Splitter
        /// may not be there yet.
        /// </summary>
        /// <param name="rtpSender"></param>
        /// <param name="payload"></param>
        public override void RenderNetwork(RtpSender rtpSender, PayloadType payload)
        {
            if (rtpSender == null) {
                string msg = Strings.NullRtpSenderError;
                Debug.Fail(msg);
                throw new ArgumentNullException(Strings.RtpSender, msg);
            }

            //Splitter may not yet be added in network scenarios without compression
            if (!this.AddDVSplitter()) {
                throw new ApplicationException("Failed to add DV Splitter");
            }

            networkContext = true;

            if (payload == PayloadType.dynamicVideo) {
                videoRenderer = (Renderer)Filter.NetworkRenderer();
                ((IRtpRenderer)videoRenderer.BaseFilter).Initialize2(rtpSender, this.rtpRendererFlags);
                iGB.AddFilter(videoRenderer.BaseFilter, videoRenderer.FriendlyName);
                videoRenderer.AddedToGraph(fgm);
                iGB.Connect(videoCompressor != null ? videoCompressor.OutputPin : splitterVideoOut,
                    videoRenderer.InputPin);
            }
            else if (payload == PayloadType.dynamicAudio) {
                audioRenderer = (Renderer)Filter.NetworkRenderer();
                ((IRtpRenderer)audioRenderer.BaseFilter).Initialize2(rtpSender, this.rtpRendererFlags);
                iGB.AddFilter(audioRenderer.BaseFilter, audioRenderer.FriendlyName);
                audioRenderer.AddedToGraph(fgm);
                iGB.Connect(audioCompressor != null ? audioCompressor.OutputPin : splitterAudioOut,
                    audioRenderer.InputPin);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Finish building the Graph for local DV audio playback.  If there is already an audio compressor, just 
        /// add the renderer, and connect.  Otherwise add and connect the DV Splitter and the renderer.
        /// </summary>
        /// <param name="fiRenderer"></param>
        public override void AddAudioRenderer(FilterInfo fiRenderer)
        {
            RemoveAndDispose(audioRenderer);

            //Add selected renderer
            audioRenderer = (Renderer)Filter.CreateFilter(fiRenderer);
            iGB.AddFilter(audioRenderer.BaseFilter, audioRenderer.FriendlyName);
            audioRenderer.AddedToGraph(fgm);

            if (!AddDVSplitter()) {
                RemoveAndDispose(audioRenderer);
                throw new ApplicationException("Failed to add DV Splitter Filter");
            }

            IPin pin = audioCompressor == null ? splitterAudioOut : audioCompressor.OutputPin;

            //Connect
            try {
                iGB.Connect(pin, audioRenderer.InputPin);
            }
            catch (COMException) {
                RemoveAndDispose(audioRenderer);
                throw;
            }

            renderer = audioRenderer;
        }
Exemplo n.º 3
0
 private void DisposeRenderer()
 {
     if(renderer != null)
     {
         renderer.Dispose();
         renderer = null;
     }
 }
Exemplo n.º 4
0
        public void RenderNetwork(RtpSender rtpSender)
        {
            if(rtpSender == null)
            {
                string msg = Strings.NullRtpSenderError;

                Debug.Fail(msg);
                throw new ArgumentNullException(Strings.RtpSender, msg);
            }

            renderer = (Renderer)Filter.NetworkRenderer();
            ((IRtpRenderer)renderer.BaseFilter).Initialize2(rtpSender,this.rtpRendererFlags);
            iGB.AddFilter(renderer.BaseFilter, renderer.FriendlyName);
            renderer.AddedToGraph(fgm);

            // Connect last pin (device or compressor) to the network renderer
            iGB.Connect(compressor != null ? compressor.OutputPin : source.OutputPin,
                renderer.InputPin);
        }
Exemplo n.º 5
0
        public virtual void AddAudioRenderer(FilterInfo fiRenderer)
        {
            RemoveRenderer();

            renderer = (Renderer)Filter.CreateFilter(fiRenderer);
            iGB.AddFilter(renderer.BaseFilter, renderer.FriendlyName);
            renderer.AddedToGraph(fgm); // Chooses input pin

            IPin pin = compressor == null ? source.OutputPin : compressor.OutputPin;

            try
            {
                iGB.Connect(pin, renderer.InputPin);
            }
            catch(COMException)
            {
                RemoveRenderer();
                throw;
            }
        }
Exemplo n.º 6
0
        public void RenderNetwork(RtpSender rtpSender)
        {
            if(rtpSender == null)
            {
                string msg = "Null is not a valid value for parameter 'rtpSender'";

                Debug.Fail(msg);
                throw new ArgumentNullException("rtpSender", msg);
            }

            renderer = (Renderer)Filter.NetworkRenderer();
            ((IRtpRenderer)renderer.BaseFilter).Initialize(rtpSender);
            iGB.AddFilter(renderer.BaseFilter, renderer.FriendlyName);
            renderer.AddedToGraph(fgm);

            // Connect last pin (device or compressor) to the network renderer
            iGB.Connect(compressor != null ? compressor.OutputPin : source.OutputPin,
                renderer.InputPin);
        }