/// <summary> /// Initializes a new instance of the <see cref="VideoTrackCodecData"/> class. /// </summary> /// <param name="videoInfoHeader">The video info header.</param> public VideoTrackCodecData(VideoInfoHeader2 videoInfoHeader) { this.Bitrate = (uint)videoInfoHeader.BitRate; this.DisplayWidth = (uint)videoInfoHeader.PictureAspectRatioX; this.DisplayHeight = (uint)videoInfoHeader.PictureAspectRatioX; this.FourCodecCode = videoInfoHeader.BitmapInformationHeader.Compression; this.CodecPrivateData = BitConverter.ToString(videoInfoHeader.BitmapInformationHeader.CodecPrivateData).Replace("-", ""); }
/// <summary> /// Initializes a new instance of the <see cref="VideoTrackCodecData"/> class. /// </summary> /// <param name="videoInfoHeader">The video info header.</param> public VideoTrackCodecData(VideoInfoHeader2 videoInfoHeader) { this.Bitrate = (uint)videoInfoHeader.BitRate; this.DisplayWidth = (uint)videoInfoHeader.PictureAspectRatioX; this.DisplayHeight = (uint)videoInfoHeader.PictureAspectRatioX; this.FourCodecCode = videoInfoHeader.BitmapInformationHeader.Compression; this.CodecPrivateData = BitConverter.ToString(videoInfoHeader.BitmapInformationHeader.CodecPrivateData).Replace("-", ""); }
/// <summary> /// Reads the sample entry properties from stream. /// </summary> /// <param name="reader">The stream reader.</param> internal override void ReadSampleEntryPropertiesFromStream(BoxBinaryReader reader) { predefined1 = reader.ReadUInt16(); reserved1 = reader.ReadUInt16(); predefined2 = reader.ReadBytes(12); this.Width = reader.ReadUInt16(); this.Height = reader.ReadUInt16(); this.HorizResolution = reader.ReadUInt32(); this.VertResolution = reader.ReadUInt32(); reserved2 = reader.ReadUInt32(); this.FrameCount = reader.ReadUInt16(); byte[] buffer = new byte[0x20]; reader.Read(buffer, 0, 0x20); int count = buffer[0]; if (count < 0x20) { this.CompressorName = Encoding.UTF8.GetString(buffer, 1, count); } this.Depth = reader.ReadUInt16(); predefined3 = reader.ReadUInt16(); if (reader.PeekNextBoxType() != BoxType.Null) { ReadInnerBoxes(reader, BoxType.Esds, BoxType.Avcc, BoxType.Avc1, BoxType.Dvc1, BoxType.Btrt, BoxType.Sinf); this.VideoCodecData = GetVideoCodecDataFromInnerBoxes(); } else { var videoInfoHeader = new VideoInfoHeader2(reader); this.VideoCodecData = new VideoTrackCodecData(videoInfoHeader); } }