public void ReusesNextFiller()
        {
            var stream = new MemoryStream();
            var writer = new EbmlWriter(stream);

            writer.Write(VInt.MakeId(122), 321);
            using (var segment = writer.StartMasterElement(MatroskaDtd.Segment.Identifier))
            {
                using (var segmentInfo = segment.StartMasterElement(MatroskaDtd.Segment.Info.Identifier))
                {
                    segmentInfo.WriteUtf(MatroskaDtd.Segment.Info.Title.Identifier, "Test data");
                }

                // write some dummy data
                segment.Write(StandardDtd.Void.Identifier, new byte[1000]);
                segment.Write(VInt.MakeId(123), 123);	// marker
            }

            stream.Position = 0;

            // act
            var infoReader = new SegmentInfoUpdater();
            infoReader.Open(stream);
            infoReader.Title = new string('a', 500);
            infoReader.Write();

            // verify the stream is correct
            stream.Position = 0;
            var reader = new EbmlReader(stream);

            reader.ReadNext();
            Assert.AreEqual(122, reader.ElementId.Value, "start marker");
            Assert.AreEqual(321, reader.ReadInt());

            reader.ReadNext();
            Assert.AreEqual(MatroskaDtd.Segment.Identifier, reader.ElementId);
            reader.EnterContainer();

            reader.ReadNext();
            Assert.AreEqual(MatroskaDtd.Segment.Info.Identifier, reader.ElementId);
            Assert.Greater(reader.ElementSize, 500);

            reader.ReadNext();
            Assert.AreEqual(StandardDtd.Void.Identifier, reader.ElementId);

            reader.ReadNext();
            Assert.AreEqual(123, reader.ElementId.Value, "end data marker");
            Assert.AreEqual(123, reader.ReadInt());
        }
        public void SimpleUseCase()
        {
            var file = new FileInfo(@"Z:\!\t.mkv");

            var segmentInfo = new SegmentInfoUpdater();
            segmentInfo.Open(file);

            Debug.Print("Duration:   {0}", segmentInfo.Duration);
            Debug.Print("MuxingApp:  {0}", segmentInfo.MuxingApp);
            Debug.Print("WritingApp: {0}", segmentInfo.WritingApp);
            Debug.Print("Title:      {0}", segmentInfo.Title);

            segmentInfo.Title = "s4e16 The Cohabitation Formulation";
            segmentInfo.WritingApp = "NEbml.Viewer 0.1";

            segmentInfo.Write();
            segmentInfo.Close();
        }