コード例 #1
0
        public void Test_ParsingChannelInfoFromXml()
        {
            StringBuilder stringData = new StringBuilder();

            stringData.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
            stringData.Append("<channel>");
            stringData.Append("   <video-mode>PAL</video-mode>");
            stringData.Append("   <stage/>");
            stringData.Append("   <mixer>");
            stringData.Append("      <mix-time>2</mix-time>");
            stringData.Append("   </mixer>");
            stringData.Append("   <output>");
            stringData.Append("      <consumers>");
            stringData.Append("         <consumer>");
            stringData.Append("            <type>decklink-consumer</type>");
            stringData.Append("            <key-only>false</key-only>");
            stringData.Append("            <device>1</device>");
            stringData.Append("            <low-latency>false</low-latency>");
            stringData.Append("            <embedded-audio>false</embedded-audio>");
            stringData.Append("            <presentation-frame-age>358</presentation-frame-age>");
            stringData.Append("            <index>301</index>");
            stringData.Append("         </consumer>");
            stringData.Append("         <consumer>");
            stringData.Append("            <type>oal-consumer</type>");
            stringData.Append("            <index>500</index>");
            stringData.Append("         </consumer>");
            stringData.Append("         <consumer>");
            stringData.Append("            <type>ogl-consumer</type>");
            stringData.Append("            <key-only>false</key-only>");
            stringData.Append("            <windowed>true</windowed>");
            stringData.Append("            <auto-deinterlace>true</auto-deinterlace>");
            stringData.Append("            <index>600</index>");
            stringData.Append("         </consumer>");
            stringData.Append("      </consumers>");
            stringData.Append("   </output>");
            stringData.Append("   <index>0</index>");
            stringData.Append("</channel>");



            var parser      = new CasparCGDataParser();
            var channelInfo = parser.ParseChannelInfo(stringData.ToString());

            Assert.True(channelInfo.VideoMode == VideoMode.PAL);
            Assert.True(channelInfo.ID == 1);
            Assert.True(channelInfo.Output != null);
            Assert.True(channelInfo.Output.Consumers != null);
            Assert.True(channelInfo.Output.Consumers.Count == 3);

            var consumer = channelInfo.Output.Consumers[2];

            Assert.True(consumer.Type == "ogl-consumer");
            Assert.True(consumer.Keyonly == false);
            Assert.True(consumer.Windowed == true);
            Assert.True(consumer.Autodeinterlace == true);
            Assert.True(consumer.Index == 600);
        }
コード例 #2
0
        public void Test_ParsingChannelInfo()
        {
            var strinData   = "1 PAL PLAYING";
            var parser      = new CasparCGDataParser();
            var channelInfo = parser.ParseChannelInfo(strinData);

            Assert.True(channelInfo.VideoMode == VideoMode.PAL);
            Assert.True(channelInfo.ID == 1);
            Assert.True(channelInfo.Status == ChannelStatus.Playing);
        }