예제 #1
0
        public AsfIndexParametersObjectItem(Stream stream)
            : base("Index Parameters Object", AsfGuid.ASF_Index_Parameters_Object, stream)
        {
            AsfIndexParametersObject asfIndexParametersObject = new AsfIndexParametersObject(stream);

            foreach (var info in asfIndexParametersObject.StreamIndexSpecifiers)
            {
                Dictionary <string, object> streamIndexProperties = new Dictionary <string, object>();
                Subsections.Add(string.Format("Index Parameters [{0}]", info.StreamNumber), streamIndexProperties);
                streamIndexProperties.Add("Stream Number", info.StreamNumber);

                string indexType = info.IndexType.ToString();

                if (info.IndexType == 1)
                {
                    indexType = "Nearest Past Data Packet";
                }
                if (info.IndexType == 2)
                {
                    indexType = "Nearest Past Media Object";
                }
                else if (info.IndexType == 3)
                {
                    indexType = "Nearest Past Cleanpoint";
                }

                streamIndexProperties.Add("Index Type", indexType);
            }
        }
예제 #2
0
        public AsfIndexObjectItem(Stream stream)
            : base("Index Object", AsfGuid.ASF_Index_Object, stream)
        {
            AsfIndexObject asfIndexObject = new AsfIndexObject(stream, Configuration);

            Properties.Add("Interval", TimeSpan.FromMilliseconds(asfIndexObject.IndexEntryTimeInterval / 10000).ToString("mm':'ss\\.fff"));
            Properties.Add("Parameters", asfIndexObject.IndexSpecifiersCount);
            Properties.Add("Blocks", asfIndexObject.BlockCount);

            foreach (var info in asfIndexObject.StreamIndexSpecifiers)
            {
                Dictionary <string, object> streamIndexProperties = new Dictionary <string, object>();
                Subsections.Add(string.Format("Index Parameters [{0}]", info.StreamNumber), streamIndexProperties);
                streamIndexProperties.Add("Stream Number", info.StreamNumber);

                string indexType = info.IndexType.ToString();

                if (info.IndexType == 1)
                {
                    indexType = "Nearest Past Data Packet";
                }
                if (info.IndexType == 2)
                {
                    indexType = "Nearest Past Media Object";
                }
                else if (info.IndexType == 3)
                {
                    indexType = "Nearest Past Cleanpoint";
                }

                streamIndexProperties.Add("Index Type", indexType);
            }
            _streamIndexList = asfIndexObject.StreamIndexList;
        }
예제 #3
0
        public AsfStreamPrioritizationObjectItem(Stream stream)
            : base("Stream Prioritization Object", AsfGuid.ASF_Stream_Prioritization_Object, stream)
        {
            AsfStreamPrioritizationObject asfStreamPrioritizationObject = new AsfStreamPrioritizationObject(stream);

            foreach (var info in asfStreamPrioritizationObject.PrioritizationInfo)
            {
                Dictionary <string, object> streamPrioProperties = new Dictionary <string, object>();
                Subsections.Add(string.Format("Stream Prioritization [{0}]", info.StreamNumber), streamPrioProperties);
                streamPrioProperties.Add("Stream Number", info.StreamNumber);
                streamPrioProperties.Add("Flags", string.Format("{0:x}", info.Flags));
                streamPrioProperties.Add("Mandatory", info.IsMandatory);
            }
        }
예제 #4
0
        public AsfScriptCommandObjectItem(Stream stream)
            : base("Script Command Object", AsfGuid.ASF_Script_Command_Object, stream)
        {
            AsfScriptCommandObject asfScriptCommandObject = new AsfScriptCommandObject(stream);
            int commandIndex = 1;

            foreach (ScriptCommand scriptCommand in asfScriptCommandObject.ScriptCommands)
            {
                var commandProperties = new Dictionary <string, object>();
                Subsections.Add(string.Format("Script Command [{0}]", commandIndex++), commandProperties);
                commandProperties.Add("Type", scriptCommand.Type);
                commandProperties.Add("Presentation Time", TimeSpan.FromMilliseconds(scriptCommand.PresentationTime).ToString("mm':'ss\\.fff"));
                commandProperties.Add("Name", scriptCommand.Name);
            }
        }
예제 #5
0
        public AsfMetadataObjectItem(Stream stream)
            : base("Metadata Object", AsfGuid.ASF_Metadata_Object, stream)
        {
            AsfMetadataObject asfMetadataObject = new AsfMetadataObject(stream);

            Dictionary <string, object> attributeProperties = new Dictionary <string, object>();

            Subsections.Add("Attributes", attributeProperties);

            foreach (var descriptionRecord in asfMetadataObject.DescriptionRecords)
            {
                string name = descriptionRecord.Name + string.Format(" - Stream {0}", descriptionRecord.StreamNumber);
                attributeProperties.Add(name, descriptionRecord.Value);
            }
        }
예제 #6
0
        public AsfCodecListObjectItem(Stream stream)
            : base("Codec List Object", AsfGuid.ASF_Codec_List_Object, stream)
        {
            AsfCodecListObject asfCodecListObject = new AsfCodecListObject(stream);

            Properties.Add("Codec ID", asfCodecListObject.CodecId.ToString());

            int index = 0;

            foreach (var property in asfCodecListObject.CodecProperties)
            {
                Dictionary <string, object> codecProperties = new Dictionary <string, object>();
                Subsections.Add(string.Format("Codec Info [{0}]", ++index), codecProperties);

                foreach (var item in property)
                {
                    codecProperties.Add(item.Key, item.Value);
                }
            }
        }
예제 #7
0
        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);
            }
        }