private AsfStreamPropertiesObject parseAsfStreamPropertiesObject(Stream inStream, long currentOffset) { AsfStreamPropertiesObject streamProperties = new AsfStreamPropertiesObject(); streamProperties.ObjectGuid = new Guid(ParseFile.ParseSimpleOffset(inStream, currentOffset, 0x10)); streamProperties.ObjectSize = BitConverter.ToUInt64(ParseFile.ParseSimpleOffset(inStream, (currentOffset + 0x10), 8), 0); streamProperties.StreamType = new Guid(ParseFile.ParseSimpleOffset(inStream, currentOffset + 0x18, 0x10)); streamProperties.StreamId = (byte)(ParseFile.ParseSimpleOffset(inStream, currentOffset + 0x48, 1)[0] & 0x7F); streamProperties.RawBlock = ParseFile.ParseSimpleOffset(inStream, currentOffset, (int)streamProperties.ObjectSize); return(streamProperties); }
public AsfStreamPropertiesObjectItem(Stream stream) : base("Stream Properties Object", AsfGuid.ASF_Stream_Properties_Object, stream) { AsfStreamPropertiesObject asfStreamPropertiesObject = new AsfStreamPropertiesObject(stream); Name = string.Format("Stream Properties Object [{0}]", asfStreamPropertiesObject.StreamNumber); Properties.Add("Stream Number", asfStreamPropertiesObject.StreamNumber); Properties.Add("Encrypted", asfStreamPropertiesObject.IsEncrypted); Dictionary <string, object> streamSectionProperties = new Dictionary <string, object>(); Subsections.Add("Stream Type Specific", streamSectionProperties); if (asfStreamPropertiesObject.StreamType == AsfGuid.ASF_Audio_Media) { AsfMojoAudioStreamProperties asfAudioStreamProperties = (AsfMojoAudioStreamProperties)asfStreamPropertiesObject.StreamProperties["AudioStreamProperties"]; streamSectionProperties.Add("Stream Type", "Audio Media"); Configuration.AsfAudioStreamId = (uint)asfStreamPropertiesObject.StreamNumber; Configuration.AudioChannels = asfAudioStreamProperties.number_channels; Configuration.AudioSampleRate = asfAudioStreamProperties.samples_per_second; Configuration.AudioBitsPerSample = asfAudioStreamProperties.bits_per_sample; streamSectionProperties.Add("Format Tag", asfAudioStreamProperties.format_tag); streamSectionProperties.Add("Channels", asfAudioStreamProperties.number_channels); streamSectionProperties.Add("Samples / Second", asfAudioStreamProperties.samples_per_second); streamSectionProperties.Add("Average Bytes / Second", asfAudioStreamProperties.average_bytes_per_second); streamSectionProperties.Add("Average Bitrate (bits/sec)", 8 * asfAudioStreamProperties.average_bytes_per_second); //same info.. streamSectionProperties.Add("Block Align", asfAudioStreamProperties.block_alignment); streamSectionProperties.Add("Bits / Sample", asfAudioStreamProperties.bits_per_sample); streamSectionProperties.Add("Extra Data Size", asfAudioStreamProperties.codec_specific_data_size); } else if (asfStreamPropertiesObject.StreamType == AsfGuid.ASF_Video_Media) { AsfMojoVideoStreamProperties asfVideoStreamProperties = (AsfMojoVideoStreamProperties)asfStreamPropertiesObject.StreamProperties["VideoStreamProperties"]; streamSectionProperties.Add("Stream Type", "Video Media"); streamSectionProperties.Add("Width", asfVideoStreamProperties.encoded_image_width); streamSectionProperties.Add("Height", asfVideoStreamProperties.encoded_image_height); streamSectionProperties.Add("Flags", asfVideoStreamProperties.reserved_flags); AsfMojoVideoStreamFormatData asfVideoStreamFormatData = (AsfMojoVideoStreamFormatData)asfStreamPropertiesObject.StreamProperties["VideoStreamFormatData"]; Dictionary <string, object> streamSectionVideoBitmapProperties = new Dictionary <string, object>(); Subsections.Add("Bitmap Info Header", streamSectionVideoBitmapProperties); streamSectionVideoBitmapProperties.Add("biSize", asfVideoStreamFormatData.format_data_size); streamSectionVideoBitmapProperties.Add("Width", asfVideoStreamFormatData.image_width); streamSectionVideoBitmapProperties.Add("Height", asfVideoStreamFormatData.image_height); Configuration.ImageWidth = (int)asfVideoStreamFormatData.image_width; Configuration.ImageHeight = (int)asfVideoStreamFormatData.image_height; streamSectionVideoBitmapProperties.Add("Planes", asfVideoStreamFormatData.reserved); streamSectionVideoBitmapProperties.Add("Bits", asfVideoStreamFormatData.bits_per_pixel_count); streamSectionVideoBitmapProperties.Add("Compression", System.Text.ASCIIEncoding.ASCII.GetString(asfVideoStreamFormatData.compression_id)); streamSectionVideoBitmapProperties.Add("Image Size", asfVideoStreamFormatData.image_size); streamSectionVideoBitmapProperties.Add("X Pixels / Meter", asfVideoStreamFormatData.horizontal_pixels_per_meter); streamSectionVideoBitmapProperties.Add("Y Pixels / Meter", asfVideoStreamFormatData.vertical_pixels_per_meter); streamSectionVideoBitmapProperties.Add("Colors Used", asfVideoStreamFormatData.used_colors_count); streamSectionVideoBitmapProperties.Add("Colors Important", asfVideoStreamFormatData.important_colors_count); } }