Example #1
0
File: Cue.cs Project: VoidXH/Cavern
        /// <summary>
        /// Read the cues from the root cue node.
        /// </summary>
        public static Cue[] GetCues(MatroskaSegment segment, Stream reader)
        {
            MatroskaTree cues = segment.GetChildFromSeek(reader, MatroskaTree.Segment_Cues);

            if (cues == null)
            {
                return(new Cue[0]);
            }

            segment.Position(reader);
            long offset = reader.Position;

            MatroskaTree[] sources = cues.GetChildren(reader, MatroskaTree.Segment_Cues_CuePoint);
            Cue[]          results = new Cue[sources.Length];
            for (int i = 0; i < sources.Length; ++i)
            {
                long         time     = sources[i].GetChildValue(reader, MatroskaTree.Segment_Cues_CuePoint_CueTime);
                MatroskaTree position = sources[i].GetChild(reader, MatroskaTree.Segment_Cues_CuePoint_CueTrackPositions);
                results[i] = new Cue(
                    time, position.GetChildValue(reader, MatroskaTree.Segment_Cues_CuePoint_CueTrackPositions_CueTrack),
                    offset +
                    position.GetChildValue(reader, MatroskaTree.Segment_Cues_CuePoint_CueTrackPositions_CueClusterPosition)
                    );
            }
            return(results);
        }
Example #2
0
 /// <summary>
 /// Parse metadata from a cluster.
 /// </summary>
 public Cluster(Stream reader, MatroskaTree source)
 {
     this.source = source;
     TimeStamp   = source.GetChildValue(reader, MatroskaTree.Segment_Cluster_Timestamp);
 }