Esempio n. 1
0
        private async Task ProcessFragment(Stream s, int fragment)
        {
            BoxReader reader = new BoxReader(s);
            string    name;

            while (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                long size = reader.ReadHeader(out name);
                if (name == "abst")
                {
                    reader.ReadBootStrap(bootstrap);
                }
                else if (name == "mdat")
                {
                    long       max  = reader.BaseStream.Position + size;
                    List <Tag> tags = new List <Tag>();
                    while (reader.BaseStream.Position != max)
                    {
                        tags.Add(await GetNextTag(reader.BaseStream));
                    }
                    await QueueTags(tags, fragment);
                }
                else
                {
                    reader.BaseStream.Seek(size, SeekOrigin.Current);
                }
            }
            reader.Dispose();
        }
Esempio n. 2
0
 public void Init()
 {
     foreach (BootstrapInfo b in BootstrapInfos)
     {
         MemoryStream ms     = new MemoryStream(Convert.FromBase64String(b.Text));
         BoxReader    reader = new BoxReader(ms);
         b.Info = new BootStrap();
         string name;
         reader.ReadHeader(out name);
         reader.ReadBootStrap(b.Info);
         reader.Dispose();
     }
     foreach (Media m in Medias)
     {
         MemoryStream ms     = new MemoryStream(Convert.FromBase64String(m.Metadata));
         AmfReader    reader = new AmfReader(ms);
         m.MetadataInfo = reader.ReadObject <Metadata>();
         reader.Dispose();
         m.Info = BootstrapInfos.First(a => a.Id == m.BootstrapInfoId);
     }
 }
 private async Task ProcessFragment(Stream s, int fragment)
 {
     BoxReader reader=new BoxReader(s);
     string name;
     while (reader.BaseStream.Position != reader.BaseStream.Length)
     {
         long size = reader.ReadHeader(out name);
         if (name == "abst")
             reader.ReadBootStrap(bootstrap);
         else if (name == "mdat")
         {
             long max = reader.BaseStream.Position + size;
             List<Tag> tags=new List<Tag>();
             while (reader.BaseStream.Position != max)
             {
                 tags.Add(await GetNextTag(reader.BaseStream));
             }
             await QueueTags(tags, fragment);
         }
         else
             reader.BaseStream.Seek(size, SeekOrigin.Current);
     }
     reader.Dispose();
 }
Esempio n. 4
0
 public void Init()
 {
     foreach (BootstrapInfo b in BootstrapInfos)
     {
         MemoryStream ms=new MemoryStream(Convert.FromBase64String(b.Text));
         BoxReader reader=new BoxReader(ms);
         b.Info=new BootStrap();
         string name;
         reader.ReadHeader(out name);
         reader.ReadBootStrap(b.Info);
         reader.Dispose();
     }
     foreach (Media m in Medias)
     {
         MemoryStream ms=new MemoryStream(Convert.FromBase64String(m.Metadata));
         AmfReader reader=new AmfReader(ms);
         m.MetadataInfo = reader.ReadObject<Metadata>();
         reader.Dispose();
         m.Info = BootstrapInfos.First(a => a.Id == m.BootstrapInfoId);
     }
 }