public AsfProperties(AsfHeaderObject header, ReadStyle style) : base(style) { duration = TimeSpan.Zero; //codecId = 0; //channels = 0; //sampleRate = 0; //bytesPerSecond = 0; foreach (AsfObject obj in header.Children) { if (obj is AsfFilePropertiesObject) duration = ((AsfFilePropertiesObject)obj).PlayDuration; if (obj is AsfStreamPropertiesObject && bytesPerSecond == 0) { AsfStreamPropertiesObject stream = (AsfStreamPropertiesObject)obj; if (!stream.StreamType.Equals(AsfGuid.AsfAudioMedia)) continue; ByteVector data = stream.TypeSpecificData; codecId = data.Mid(0, 2).ToShort(false); channels = data.Mid(2, 2).ToShort(false); sampleRate = data.Mid(4, 4).ToUInt(false); bytesPerSecond = data.Mid(8, 4).ToUInt(false); } } }
public AsfProperties(AsfHeaderObject header, ReadStyle style) : base(style) { duration = TimeSpan.Zero; //codecId = 0; //channels = 0; //sampleRate = 0; //bytesPerSecond = 0; foreach (AsfObject obj in header.Children) { if (obj is AsfFilePropertiesObject) { duration = ((AsfFilePropertiesObject)obj).PlayDuration; } if (obj is AsfStreamPropertiesObject && bytesPerSecond == 0) { AsfStreamPropertiesObject stream = (AsfStreamPropertiesObject)obj; if (!stream.StreamType.Equals(AsfGuid.AsfAudioMedia)) { continue; } ByteVector data = stream.TypeSpecificData; codecId = data.Mid(0, 2).ToShort(false); channels = data.Mid(2, 2).ToShort(false); sampleRate = data.Mid(4, 4).ToUInt(false); bytesPerSecond = data.Mid(8, 4).ToUInt(false); } } }
private void Read(ReadStyle propertiesStyle) { AsfHeaderObject header = new AsfHeaderObject(this, 0); asfTag = new AsfTag(header); if (propertiesStyle != ReadStyle.None) properties = new AsfProperties(header, propertiesStyle); }
private void Read(ReadStyle propertiesStyle) { AsfHeaderObject header = new AsfHeaderObject(this, 0); asfTag = new AsfTag(header); if (propertiesStyle != ReadStyle.None) { properties = new AsfProperties(header, propertiesStyle); } }
public AsfTag(AsfHeaderObject header) : base() { description = new AsfContentDescriptionObject(); extDescription = new AsfExtendedContentDescriptionObject(); foreach (AsfObject child in header.Children) { if (child is AsfContentDescriptionObject) description = (AsfContentDescriptionObject)child; if (child is AsfExtendedContentDescriptionObject) extDescription = (AsfExtendedContentDescriptionObject)child; } }
public override void Save() { if (IsReadOnly) { throw new ReadOnlyException(); } Mode = FileAccessMode.Write; AsfHeaderObject header = new AsfHeaderObject(this, 0); header.AddUniqueObject(asfTag.ContentDescriptionObject); header.AddUniqueObject(asfTag.ExtendedContentDescriptionObject); Insert(header.Render(), 0, header.OriginalSize); Mode = FileAccessMode.Closed; }
public AsfTag(AsfHeaderObject header) : base() { description = new AsfContentDescriptionObject(); extDescription = new AsfExtendedContentDescriptionObject(); foreach (AsfObject child in header.Children) { if (child is AsfContentDescriptionObject) { description = (AsfContentDescriptionObject)child; } if (child is AsfExtendedContentDescriptionObject) { extDescription = (AsfExtendedContentDescriptionObject)child; } } }
public override void Save() { if (IsReadOnly) throw new ReadOnlyException(); Mode = FileAccessMode.Write; AsfHeaderObject header = new AsfHeaderObject(this, 0); header.AddUniqueObject(asfTag.ContentDescriptionObject); header.AddUniqueObject(asfTag.ExtendedContentDescriptionObject); Insert(header.Render(), 0, header.OriginalSize); Mode = FileAccessMode.Closed; }
public AsfProperties(AsfHeaderObject header) : this(header, ReadStyle.Average) { }