コード例 #1
0
        private async void mLaunchButton_Click(object sender, RoutedEventArgs e)
        {
            if (!m_socketAccessable)
            {
                return;
            }

            mLaunchButton.IsEnabled = false;

            do
            {
                if (mLaunchButton.Content == "Stop")
                {
                    if (mISession != null)
                    {
                        await mISession.closeSessionAsync();

                        mLaunchButton.Content = "Launch";
                    }

                    mISession = null;

                    if (s != null)
                    {
                        s.disconnect();
                    }

                    s = null;

                    mLaunchButton.IsEnabled = true;

                    break;
                }


                string lxmldoc = await mCaptureManager.getCollectionOfSinksAsync();

                XmlDocument doc = new XmlDocument();

                doc.LoadXml(lxmldoc);

                var lSinkNode = doc.SelectSingleNode("SinkFactories/SinkFactory[@GUID='{3D64C48E-EDA4-4EE1-8436-58B64DD7CF13}']");

                if (lSinkNode == null)
                {
                    break;
                }

                var lContainerNode = lSinkNode.SelectSingleNode("Value.ValueParts/ValuePart[1]");

                if (lContainerNode == null)
                {
                    break;
                }

                var lReadMode = setContainerFormat(lContainerNode);

                var lSinkControl = await mCaptureManager.createSinkControlAsync();

                ISampleGrabberCallbackSinkFactoryAsync lSampleGrabberCallbackSinkFactory = await lSinkControl.createSampleGrabberCallbackSinkFactoryAsync(
                    lReadMode);

                int lIndexCount = 0;

                var lVideoStreamSourceNode = await createVideoStream(lSampleGrabberCallbackSinkFactory, lIndexCount);

                var lAudioStreamSourceNode = await createAudioStream(lSampleGrabberCallbackSinkFactory, lIndexCount);


                XmlDocument l_streamMediaTypesXml = new XmlDocument();

                XmlNode ldocNode = l_streamMediaTypesXml.CreateXmlDeclaration("1.0", "UTF-8", null);

                l_streamMediaTypesXml.AppendChild(ldocNode);

                XmlElement rootNode = l_streamMediaTypesXml.CreateElement("MediaTypes");

                l_streamMediaTypesXml.AppendChild(rootNode);


                var lAttr = l_streamMediaTypesXml.CreateAttribute("StreamName");

                lAttr.Value = mStreamNameTxtBx.Text;

                rootNode.Attributes.Append(lAttr);

                List <object> lSourceMediaNodeList = new List <object>();

                if (lVideoStreamSourceNode.Item1 != null)
                {
                    doc = new XmlDocument();

                    doc.LoadXml(lVideoStreamSourceNode.Item2);

                    var lMediaType = doc.SelectSingleNode("MediaType");

                    if (lMediaType != null)
                    {
                        rootNode.AppendChild(l_streamMediaTypesXml.ImportNode(lMediaType, true));
                    }

                    lSourceMediaNodeList.Add(lVideoStreamSourceNode.Item1);
                }

                if (lAudioStreamSourceNode.Item1 != null)
                {
                    doc = new XmlDocument();

                    doc.LoadXml(lAudioStreamSourceNode.Item2);

                    var lMediaType = doc.SelectSingleNode("MediaType");

                    if (lMediaType != null)
                    {
                        rootNode.AppendChild(l_streamMediaTypesXml.ImportNode(lMediaType, true));
                    }

                    lSourceMediaNodeList.Add(lAudioStreamSourceNode.Item1);
                }

                var lSessionControl = await mCaptureManager.createSessionControlAsync();

                if (lSessionControl == null)
                {
                    break;
                }

                mISession = await lSessionControl.createSessionAsync(
                    lSourceMediaNodeList.ToArray());

                if (mISession == null)
                {
                    break;
                }

                startServer(l_streamMediaTypesXml.InnerXml);

                await mISession.registerUpdateStateDelegateAsync(UpdateStateDelegate);

                await mISession.startSessionAsync(0, Guid.Empty);

                mLaunchButton.Content = "Stop";
            } while (false);

            mLaunchButton.IsEnabled = true;
        }
コード例 #2
0
        private async Task <Tuple <object, string, int> > createAudioStream(ISampleGrabberCallbackSinkFactoryAsync aISampleGrabberCallbackSinkFactory, int aIndexCount)
        {
            object result = null;

            int index = 0;

            string lMediaType = "";

            do
            {
                var lAACSampleGrabberCallback = await aISampleGrabberCallbackSinkFactory.createOutputNodeAsync(
                    MFMediaType_Audio,
                    MFAudioFormat_AAC);

                if (lAACSampleGrabberCallback != null)
                {
                    lAACSampleGrabberCallback.mUpdateNativeFullEvent += delegate
                                                                        (uint aSampleFlags, long aSampleTime, long aSampleDuration, IntPtr aData, uint aSize)
                    {
                        if (s != null)
                        {
                            lock (s)
                            {
                                currentmillisecond = (int)(aSampleTime / (long)10000);

                                s.sendAudioData(currentmillisecond, aData, (int)aSize, aSampleFlags, aIndexCount);
                            }
                        }
                    };

                    var lSampleGrabberCallNode = lAACSampleGrabberCallback.getTopologyNode();

                    if (lSampleGrabberCallNode != null)
                    {
                        var mEncoderControl = await mCaptureManager.createEncoderControlAsync();

                        Guid lAACEncoder = new Guid("93AF0C51-2275-45d2-A35B-F2BA21CAED00");

                        var lIEncoderNodeFactory = await mEncoderControl.createEncoderNodeFactoryAsync(lAACEncoder);

                        if (lIEncoderNodeFactory != null)
                        {
                            var lSourceNode = mAudioSourcesComboBox.SelectedItem as XmlNode;

                            if (lSourceNode == null)
                            {
                                break;
                            }

                            var lNode = lSourceNode.SelectSingleNode("Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_SYMBOLIC_LINK']/SingleValue/@Value");

                            if (lNode == null)
                            {
                                break;
                            }

                            string lSymbolicLink = lNode.Value;

                            lSourceNode = mAudioStreamsComboBox.SelectedItem as XmlNode;

                            if (lSourceNode == null)
                            {
                                break;
                            }

                            lNode = lSourceNode.SelectSingleNode("@Index");

                            if (lNode == null)
                            {
                                break;
                            }

                            uint lStreamIndex = 0;

                            if (!uint.TryParse(lNode.Value, out lStreamIndex))
                            {
                                break;
                            }

                            lSourceNode = mAudioMediaTypesComboBox.SelectedItem as XmlNode;

                            if (lSourceNode == null)
                            {
                                break;
                            }

                            lNode = lSourceNode.SelectSingleNode("@Index");

                            if (lNode == null)
                            {
                                break;
                            }

                            uint lMediaTypeIndex = 0;

                            if (!uint.TryParse(lNode.Value, out lMediaTypeIndex))
                            {
                                break;
                            }


                            object lAudioSourceOutputMediaType = await mSourceControl.getSourceOutputMediaTypeAsync(
                                lSymbolicLink,
                                lStreamIndex,
                                lMediaTypeIndex);



                            string lxmlDoc = await mEncoderControl.getMediaTypeCollectionOfEncoderAsync(
                                lAudioSourceOutputMediaType,
                                lAACEncoder);

                            var doc = new System.Xml.XmlDocument();

                            doc.LoadXml(lxmlDoc);

                            var lGroup = doc.SelectSingleNode("EncoderMediaTypes/Group[@GUID='{8F6FF1B6-534E-49C0-B2A8-16D534EAF135}']");

                            uint lMaxBitRate = 0;

                            if (lGroup != null)
                            {
                                var lAttr = lGroup.SelectSingleNode("@MaxBitRate");

                                if (lAttr != null)
                                {
                                    uint.TryParse(lAttr.Value, out lMaxBitRate);
                                }
                            }


                            object lAudioEncoder = await lIEncoderNodeFactory.createEncoderNodeAsync(
                                lAudioSourceOutputMediaType,
                                StreamingCBR,
                                lMaxBitRate,
                                0,
                                lSampleGrabberCallNode);

                            object lCompressedMediaType = await lIEncoderNodeFactory.createCompressedMediaTypeAsync(
                                lAudioSourceOutputMediaType,
                                StreamingCBR,
                                lMaxBitRate,
                                0);

                            result = await mSourceControl.createSourceNodeWithDownStreamConnectionAsync(
                                lSymbolicLink,
                                lStreamIndex,
                                lMediaTypeIndex,
                                lAudioEncoder);

                            if (result != null)
                            {
                                index = aIndexCount;
                            }

                            lMediaType = await mCaptureManager.parseMediaTypeAsync(lCompressedMediaType);
                        }
                    }
                }
            }while (false);

            return(Tuple.Create <object, string, int>(result, lMediaType, index));
        }
コード例 #3
0
        private async Task <Tuple <object, RtspServer.StreamType, int> > createAudioStream(ISampleGrabberCallbackSinkFactoryAsync aISampleGrabberCallbackSinkFactory, int aIndexCount)
        {
            object result = null;

            RtspServer.StreamType type = RtspServer.StreamType.Audio;

            int index = 0;

            do
            {
                Guid lAudioFormat = Guid.Empty;

                var lAudioCompressedNode = mAudioMediaTypeComboBox.SelectedItem as XmlNode;

                if (lAudioCompressedNode != null)
                {
                    var lGUID = lAudioCompressedNode.SelectSingleNode("MediaTypeItem[@Name='MF_MT_SUBTYPE']/SingleValue/@GUID");

                    if (lGUID != null)
                    {
                        Guid.TryParse(lGUID.Value, out lAudioFormat);
                    }
                }

                var lSampleGrabberCallback = await aISampleGrabberCallbackSinkFactory.createOutputNodeAsync(
                    MFMediaType_Audio,
                    lAudioFormat);

                if (lSampleGrabberCallback != null)
                {
                    lSampleGrabberCallback.mUpdateFullEvent += delegate
                                                               (uint aSampleFlags, long aSampleTime, long aSampleDuration, byte[] aData, uint aLength)
                    {
                        if (s != null)
                        {
                            lock (s)
                            {
                                currentmillisecond = (uint)aSampleTime / 10000;

                                s.sendData(aIndexCount, (int)type, currentmillisecond * 90, aData);
                            }
                        }
                    };

                    var lSampleGrabberCallNode = lSampleGrabberCallback.getTopologyNode();

                    if (lSampleGrabberCallNode != null)
                    {
                        var mEncoderControl = await mCaptureManager.createEncoderControlAsync();

                        var lEncoderNode = mAudioEncoderComboBox.SelectedItem as XmlNode;

                        if (lEncoderNode == null)
                        {
                            break;
                        }

                        var lNode = lEncoderNode.SelectSingleNode("@CLSID");

                        if (lNode == null)
                        {
                            break;
                        }

                        Guid lCLSIDEncoder;

                        if (!Guid.TryParse(lNode.Value, out lCLSIDEncoder))
                        {
                            break;
                        }

                        var lIEncoderNodeFactory = await mEncoderControl.createEncoderNodeFactoryAsync(lCLSIDEncoder);

                        if (lIEncoderNodeFactory != null)
                        {
                            var lSourceNode = mAudioSourcesComboBox.SelectedItem as XmlNode;

                            if (lSourceNode == null)
                            {
                                break;
                            }

                            lNode = lSourceNode.SelectSingleNode("Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_SYMBOLIC_LINK']/SingleValue/@Value");

                            if (lNode == null)
                            {
                                break;
                            }

                            string lSymbolicLink = lNode.Value;

                            lSourceNode = mAudioStreamsComboBox.SelectedItem as XmlNode;

                            if (lSourceNode == null)
                            {
                                break;
                            }

                            lNode = lSourceNode.SelectSingleNode("@Index");

                            if (lNode == null)
                            {
                                break;
                            }

                            uint lStreamIndex = 0;

                            if (!uint.TryParse(lNode.Value, out lStreamIndex))
                            {
                                break;
                            }

                            lSourceNode = mAudioMediaTypesComboBox.SelectedItem as XmlNode;

                            if (lSourceNode == null)
                            {
                                break;
                            }

                            lNode = lSourceNode.SelectSingleNode("@Index");

                            if (lNode == null)
                            {
                                break;
                            }

                            uint lMediaTypeIndex = 0;

                            if (!uint.TryParse(lNode.Value, out lMediaTypeIndex))
                            {
                                break;
                            }


                            object lAudioSourceOutputMediaType = await mSourceControl.getSourceOutputMediaTypeAsync(
                                lSymbolicLink,
                                lStreamIndex,
                                lMediaTypeIndex);

                            object lAudioEncoder = await lIEncoderNodeFactory.createEncoderNodeAsync(lAudioSourceOutputMediaType,
                                                                                                     //new Guid(0xee8c3745, 0xf45b, 0x42b3, 0xa8, 0xcc, 0xc7, 0xa6, 0x96, 0x44, 0x9, 0x55),
                                                                                                     //new Guid(0xca37e2be, 0xbec0, 0x4b17, 0x94, 0x6d, 0x44, 0xfb, 0xc1, 0xb3, 0xdf, 0x55),
                                                                                                     StreamingCBR,
                                                                                                     75,
                                                                                                     0,
                                                                                                     lSampleGrabberCallNode);

                            result = await mSourceControl.createSourceNodeWithDownStreamConnectionAsync(
                                lSymbolicLink,
                                lStreamIndex,
                                lMediaTypeIndex,
                                lAudioEncoder);

                            if (result != null)
                            {
                                index = aIndexCount;
                            }
                        }
                    }
                }
            }while (false);

            return(Tuple.Create <object, RtspServer.StreamType, int>(result, type, index));
        }
コード例 #4
0
        private async Task <Tuple <object, string, int> > createVideoStream(ISampleGrabberCallbackSinkFactoryAsync aISampleGrabberCallbackSinkFactory, int aIndexCount)
        {
            object result = null;

            int index = 0;

            string lMediaType = "";

            do
            {
                var lSourceNode = mSourcesComboBox.SelectedItem as XmlNode;

                if (lSourceNode == null)
                {
                    break;
                }

                var lNode = lSourceNode.SelectSingleNode("Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK']/SingleValue/@Value");

                if (lNode == null)
                {
                    break;
                }

                string lSymbolicLink = lNode.Value;

                uint lStreamIndex = 0;

                lSourceNode = mMediaTypesComboBox.SelectedItem as XmlNode;

                if (lSourceNode == null)
                {
                    break;
                }

                lNode = lSourceNode.SelectSingleNode("@Index");

                if (lNode == null)
                {
                    break;
                }

                uint lMediaTypeIndex = 0;

                if (!uint.TryParse(lNode.Value, out lMediaTypeIndex))
                {
                    break;
                }

                var lSinkControl = await mCaptureManager.createSinkControlAsync();

                var lSinkFactory = await lSinkControl.createEVRSinkFactoryAsync(
                    Guid.Empty);

                object lEVROutputNode = await lSinkFactory.createOutputNodeAsync(
                    mVideoPanel.Handle);

                if (lEVROutputNode == null)
                {
                    break;
                }

                ISampleGrabberCallback lH264SampleGrabberCallback = await aISampleGrabberCallbackSinkFactory.createOutputNodeAsync(
                    MFMediaType_Video,
                    MFVideoFormat_H264);

                object lOutputNode = lEVROutputNode;

                if (lH264SampleGrabberCallback != null)
                {
                    lH264SampleGrabberCallback.mUpdateNativeFullEvent += delegate
                                                                         (uint aSampleFlags, long aSampleTime, long aSampleDuration, IntPtr aData, uint aSize)
                    {
                        if (s != null)
                        {
                            lock (s)
                            {
                                Console.WriteLine("aSampleFlags: {0}", aSampleFlags);

                                currentmillisecond += 1;

                                s.sendVideoData(currentmillisecond, aData, (int)aSize, aSampleFlags, aIndexCount);

                                currentmillisecond += 33;
                            }
                        }
                    };

                    var lSampleGrabberCallNode = lH264SampleGrabberCallback.getTopologyNode();

                    if (lSampleGrabberCallNode != null)
                    {
                        var streamControl = await mCaptureManager.createStreamControlAsync();

                        object        spreaderNode   = null;
                        List <object> outputNodeList = new List <object>();



                        var mEncoderControl = await mCaptureManager.createEncoderControlAsync();

                        XmlDocument doc = new XmlDocument();

                        string lxmldoc = await mCaptureManager.getCollectionOfEncodersAsync();

                        doc.LoadXml(lxmldoc);

                        var l_VideoEncoderNode = doc.SelectSingleNode("EncoderFactories/Group[@GUID='{73646976-0000-0010-8000-00AA00389B71}']/EncoderFactory[@IsStreaming='TRUE'][1]/@CLSID");

                        if (l_VideoEncoderNode == null)
                        {
                            break;
                        }

                        Guid lCLSIDVideoEncoder;

                        if (!Guid.TryParse(l_VideoEncoderNode.Value, out lCLSIDVideoEncoder))
                        {
                            break;
                        }

                        var lIEncoderNodeFactory = await mEncoderControl.createEncoderNodeFactoryAsync(lCLSIDVideoEncoder);

                        if (lIEncoderNodeFactory != null)
                        {
                            if (mSourceControl == null)
                            {
                                break;
                            }

                            object lVideoSourceOutputMediaType = await mSourceControl.getSourceOutputMediaTypeAsync(
                                lSymbolicLink,
                                lStreamIndex,
                                lMediaTypeIndex);



                            string lxmlDoc = await mEncoderControl.getMediaTypeCollectionOfEncoderAsync(
                                lVideoSourceOutputMediaType,
                                lCLSIDVideoEncoder);

                            doc = new System.Xml.XmlDocument();

                            doc.LoadXml(lxmlDoc);

                            var lGroup = doc.SelectSingleNode("EncoderMediaTypes/Group[@GUID='{8F6FF1B6-534E-49C0-B2A8-16D534EAF135}']");

                            uint lMaxBitRate = 0;

                            if (lGroup != null)
                            {
                                var lAttr = lGroup.SelectSingleNode("@MaxBitRate");

                                if (lAttr != null)
                                {
                                    uint.TryParse(lAttr.Value, out lMaxBitRate);
                                }
                            }

                            lMaxBitRate = 1000000;



                            object lVideoEncoderNode = await lIEncoderNodeFactory.createEncoderNodeAsync(
                                lVideoSourceOutputMediaType,
                                StreamingCBR,
                                lMaxBitRate,
                                0,
                                lSampleGrabberCallNode);

                            object lCompressedMediaType = await lIEncoderNodeFactory.createCompressedMediaTypeAsync(
                                lVideoSourceOutputMediaType,
                                StreamingCBR,
                                lMaxBitRate,
                                0);

                            var spreaderNodeFactory = await streamControl.createSpreaderNodeFactoryAsync();

                            outputNodeList.Add(lEVROutputNode);
                            outputNodeList.Add(lVideoEncoderNode);
                            spreaderNode = await spreaderNodeFactory.createSpreaderNodeAsync(outputNodeList);


                            if (spreaderNode != null)
                            {
                                lOutputNode = spreaderNode;
                            }

                            lMediaType = await mCaptureManager.parseMediaTypeAsync(lCompressedMediaType);
                        }
                    }
                }

                string lextendSymbolicLink = lSymbolicLink + " --options=" +
                                             "<?xml version='1.0' encoding='UTF-8'?>" +
                                             "<Options>" +
                                             "<Option Type='Cursor' Visiblity='True'>" +
                                             "<Option.Extensions>" +
                                             "<Extension Type='BackImage' Height='100' Width='100' Fill='0x7055ff55' />" +
                                             "</Option.Extensions>" +
                                             "</Option>" +
                                             "</Options>";


                lextendSymbolicLink += " --normalize=Landscape";

                result = await mSourceControl.createSourceNodeWithDownStreamConnectionAsync(
                    lextendSymbolicLink,
                    lStreamIndex,
                    lMediaTypeIndex,
                    lOutputNode);

                if (result != null)
                {
                    index = aIndexCount;
                }
            }while (false);

            return(Tuple.Create <object, string, int>(result, lMediaType, index));
        }
コード例 #5
0
        private async Task <Tuple <object, RtspServer.StreamType, int, string> > createVideoStream(ISampleGrabberCallbackSinkFactoryAsync aISampleGrabberCallbackSinkFactory, int aIndexCount)
        {
            object result = null;

            RtspServer.StreamType type = RtspServer.StreamType.Video;

            int index = 0;

            string format = "";

            do
            {
                var lSourceNode = mSourcesComboBox.SelectedItem as XmlNode;

                if (lSourceNode == null)
                {
                    break;
                }

                var lNode = lSourceNode.SelectSingleNode("Source.Attributes/Attribute[@Name='MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK']/SingleValue/@Value");

                if (lNode == null)
                {
                    break;
                }

                string lSymbolicLink = lNode.Value;

                lSourceNode = mStreamsComboBox.SelectedItem as XmlNode;

                if (lSourceNode == null)
                {
                    break;
                }

                lNode = lSourceNode.SelectSingleNode("@Index");

                if (lNode == null)
                {
                    break;
                }

                uint lStreamIndex = 0;

                if (!uint.TryParse(lNode.Value, out lStreamIndex))
                {
                    break;
                }

                lSourceNode = mMediaTypesComboBox.SelectedItem as XmlNode;

                if (lSourceNode == null)
                {
                    break;
                }

                lNode = lSourceNode.SelectSingleNode("@Index");

                if (lNode == null)
                {
                    break;
                }

                uint lMediaTypeIndex = 0;

                if (!uint.TryParse(lNode.Value, out lMediaTypeIndex))
                {
                    break;
                }

                var lSinkControl = await mCaptureManager.createSinkControlAsync();

                var lSinkFactory = await lSinkControl.createEVRSinkFactoryAsync(
                    Guid.Empty);

                object lEVROutputNode = await lSinkFactory.createOutputNodeAsync(
                    mVideoPanel.Handle);

                if (lEVROutputNode == null)
                {
                    break;
                }

                Guid lVideoFormat = Guid.Empty;

                var lVideoCompressedNode = mVideoMediaTypeComboBox.SelectedItem as XmlNode;

                if (lVideoCompressedNode != null)
                {
                    var lGUID = lVideoCompressedNode.SelectSingleNode("MediaTypeItem[@Name='MF_MT_SUBTYPE']/SingleValue/@GUID");

                    if (lGUID != null)
                    {
                        Guid.TryParse(lGUID.Value, out lVideoFormat);
                    }


                    var lvalue = lVideoCompressedNode.SelectSingleNode("MediaTypeItem[@Name='MF_MT_SUBTYPE']/SingleValue/@Value");

                    if (lvalue != null && lvalue.Value != null)
                    {
                        var lsplit = lvalue.Value.Split(new char[] { '_' });

                        if (lsplit != null && lsplit.Length == 2)
                        {
                            format = lsplit[1];
                        }

                        if (format == "HEVC")
                        {
                            format = "H265";
                        }
                    }
                }



                var lSampleGrabberCallback = await aISampleGrabberCallbackSinkFactory.createOutputNodeAsync(
                    MFMediaType_Video,
                    lVideoFormat);

                object lOutputNode = lEVROutputNode;

                if (lSampleGrabberCallback != null)
                {
                    lSampleGrabberCallback.mUpdateFullEvent += delegate
                                                               (uint aSampleFlags, long aSampleTime, long aSampleDuration, byte[] aData, uint aLength)
                    {
                        if (s != null)
                        {
                            lock (s)
                            {
                                currentmillisecond += 1;

                                s.sendData(aIndexCount, (int)type, currentmillisecond * 90, aData);

                                currentmillisecond += 20;
                            }
                        }
                    };

                    var lSampleGrabberCallNode = lSampleGrabberCallback.getTopologyNode();

                    if (lSampleGrabberCallNode != null)
                    {
                        IStreamControl       streamControl       = mCaptureManager.createStreamControl();
                        ISpreaderNodeFactory spreaderNodeFactory = null;
                        object        spreaderNode   = null;
                        List <object> outputNodeList = new List <object>();



                        var mEncoderControl = await mCaptureManager.createEncoderControlAsync();

                        var lEncoderNode = mVideoEncoderComboBox.SelectedItem as XmlNode;

                        if (lEncoderNode == null)
                        {
                            break;
                        }

                        lNode = lEncoderNode.SelectSingleNode("@CLSID");

                        if (lNode == null)
                        {
                            break;
                        }

                        Guid lCLSIDEncoder;

                        if (!Guid.TryParse(lNode.Value, out lCLSIDEncoder))
                        {
                            break;
                        }



                        var lBitRate = (uint)mBitRateComboBox.SelectedItem;



                        var lIEncoderNodeFactory = await mEncoderControl.createEncoderNodeFactoryAsync(lCLSIDEncoder);

                        if (lIEncoderNodeFactory != null)
                        {
                            if (mSourceControl == null)
                            {
                                break;
                            }

                            object lVideoSourceOutputMediaType = await mSourceControl.getSourceOutputMediaTypeAsync(
                                lSymbolicLink,
                                lStreamIndex,
                                lMediaTypeIndex);


                            object lVideoEncoderNode = await lIEncoderNodeFactory.createEncoderNodeAsync(lVideoSourceOutputMediaType,
                                                                                                         StreamingCBR,
                                                                                                         lBitRate,
                                                                                                         0,
                                                                                                         lSampleGrabberCallNode);


                            streamControl.createStreamControlNodeFactory(ref spreaderNodeFactory);
                            outputNodeList.Add(lEVROutputNode);
                            outputNodeList.Add(lVideoEncoderNode);
                            spreaderNodeFactory.createSpreaderNode(outputNodeList,
                                                                   out spreaderNode);


                            if (spreaderNode != null)
                            {
                                lOutputNode = spreaderNode;
                            }
                        }
                    }
                }

                string lextendSymbolicLink = lSymbolicLink + " --options=" +
                                             "<?xml version='1.0' encoding='UTF-8'?>" +
                                             "<Options>" +
                                             "<Option Type='Cursor' Visiblity='True'>" +
                                             "<Option.Extensions>" +
                                             "<Extension Type='BackImage' Height='100' Width='100' Fill='0x7055ff55' />" +
                                             "</Option.Extensions>" +
                                             "</Option>" +
                                             "</Options>";


                lextendSymbolicLink += " --normalize=Landscape";

                result = await mSourceControl.createSourceNodeWithDownStreamConnectionAsync(
                    lextendSymbolicLink,
                    lStreamIndex,
                    lMediaTypeIndex,
                    lOutputNode);

                if (result != null)
                {
                    index = aIndexCount;
                }
            }while (false);

            return(Tuple.Create <object, RtspServer.StreamType, int, string>(result, type, index, format));
        }