/// <summary> /// Injects metadata (Cue Points) into a tag. /// </summary> /// <param name="meta">Metadata.</param> /// <param name="tag">Tag.</param> /// <returns></returns> private ITag InjectMetaCue(MetaCue meta, ITag tag) { MemoryStream ms = new MemoryStream(); AMFWriter writer = new AMFWriter(ms); writer.WriteData(ObjectEncoding.AMF0, "onCuePoint"); writer.WriteData(ObjectEncoding.AMF0, meta); byte[] buffer = ms.ToArray(); return(new Tag(IOConstants.TYPE_METADATA, GetTimeInMilliseconds(meta), buffer.Length, buffer, tag.PreviousTagSize)); }
public int CompareTo(object obj) { MetaCue cue = obj as MetaCue; double time = cue.Time; double num2 = this.Time; if (time > num2) { return(-1); } if (time < num2) { return(1); } return(0); }
/// <summary> /// Compares the current instance with another object of MetaCue type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object. /// </summary> /// <param name="obj">A MetaCue object to compare with this instance.</param> /// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns> public int CompareTo(object obj) { MetaCue cp = obj as MetaCue; double cpTime = cp.Time; double time = this.Time; if (cpTime > time) { return(-1); } else if (cpTime < time) { return(1); } return(0); }
/// <summary> /// Returns a timestamp of cue point in milliseconds. /// </summary> /// <param name="metaCue">Cue point.</param> /// <returns>Timestamp of given cue point (in milliseconds).</returns> private int GetTimeInMilliseconds(MetaCue metaCue) { return((int)(metaCue.Time * 1000.00)); }