예제 #1
0
        public Representation(Node.Representation repr)
        {
            Id              = repr.Id;
            Profiles        = repr.Profiles ?? repr.AdaptationSet.Profiles;
            Width           = repr.Width ?? repr.AdaptationSet.Width;
            Height          = repr.Height ?? repr.AdaptationSet.Height;
            FrameRate       = repr.FrameRate ?? repr.AdaptationSet.FrameRate;
            MimeType        = repr.MimeType ?? repr.AdaptationSet.MimeType;
            Codecs          = repr.Codecs ?? repr.AdaptationSet.Codecs;
            SegmentProfiles = repr.SegmentProfiles ?? repr.AdaptationSet.SegmentProfiles;

            Bandwidth   = repr.Bandwidth;
            NumChannels = repr.NumChannels;
            SampleRate  = repr.SampleRate;

            Segments = repr.SegmentsStream();

            // Check if repr. is valid - Entries without representation
            // specification are valid too.
            if (NumChannels == null && repr.AudioChannelConfigurations != null)
            {
                string channels = null;
                foreach (Node.Descriptor d in repr.AudioChannelConfigurations)
                {
                    if (!string.IsNullOrEmpty(d.Value))
                    {
                        channels = d.Value;
                        break;
                    }
                }

                if (channels != null)
                {
                    NumChannels = System.Xml.XmlConvert.ToUInt32(channels);
                }
            }

            if (SampleRate == null)
            {
                string sampling = repr.AudioSamplingRate ?? repr.AdaptationSet.AudioSamplingRate;
                if (sampling != null)
                {
                    SampleRate = System.Xml.XmlConvert.ToUInt32(sampling);
                }
            }
        }
예제 #2
0
 private TimeSpan?GuessFromRepresentations(Representation repr)
 {
     return(repr.SegmentsStream()?.Duration);
 }