Пример #1
0
		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);
				}
			}
		}
Пример #2
0
        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);
                }
            }
        }
Пример #3
0
		private void Read(ReadStyle propertiesStyle)
		{
			AsfHeaderObject header = new AsfHeaderObject(this, 0);

			asfTag = new AsfTag(header);

			if (propertiesStyle != ReadStyle.None)
				properties = new AsfProperties(header, propertiesStyle);
		}
Пример #4
0
        private void Read(ReadStyle propertiesStyle)
        {
            AsfHeaderObject header = new AsfHeaderObject(this, 0);

            asfTag = new AsfTag(header);

            if (propertiesStyle != ReadStyle.None)
            {
                properties = new AsfProperties(header, propertiesStyle);
            }
        }
Пример #5
0
		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;
			}
		}
Пример #6
0
        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;
        }
Пример #7
0
        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;
                }
            }
        }
Пример #8
0
		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;
		}
Пример #9
0
		public AsfProperties(AsfHeaderObject header) : this(header, ReadStyle.Average)
		{
		}
Пример #10
0
 public AsfProperties(AsfHeaderObject header) : this(header, ReadStyle.Average)
 {
 }