Exemplo n.º 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);
				}
			}
		}
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 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);
		}
Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
			}
		}
Exemplo n.º 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;
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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;
		}
Exemplo n.º 9
0
		public AsfProperties(AsfHeaderObject header) : this(header, ReadStyle.Average)
		{
		}
Exemplo n.º 10
0
 public AsfProperties(AsfHeaderObject header) : this(header, ReadStyle.Average)
 {
 }