public override FileFormat Match(FileFormatScanJob job) { if (!ValidateStartBytes(job)) { return(null); } var fingerprint = new MatroskaFormat(); return(fingerprint); }
/// <summary> /// This method gets MKV file format metadata /// This method is supported by version 19.1 or greater /// </summary> public static void GetMetadata() { using (MatroskaFormat format = new MatroskaFormat(Common.MapSourceFilePath(filePath))) { Console.WriteLine("DocType: {0}", format.EbmlHeader.DocType); Console.WriteLine("DocTypeReadVersion: {0}", format.EbmlHeader.DocTypeReadVersion); Console.WriteLine("DocTypeVersion: {0}", format.EbmlHeader.DocTypeVersion); Console.WriteLine("ReadVersion: {0}", format.EbmlHeader.ReadVersion); Console.WriteLine("Version: {0}", format.EbmlHeader.Version); } }
/// <summary> /// This method gets Matroska Tag Metadata /// This method is supported by version 19.1 or greater /// </summary> public static void MatroskaTagMetadata() { using (MatroskaFormat format = new MatroskaFormat(Common.MapSourceFilePath(filePath))) { foreach (MatroskaTagMetadata tag in format.Tags) { Console.WriteLine("TargetType: {0}", tag.TargetType); Console.WriteLine("TargetTypeValue: {0}", tag.TargetTypeValue); Console.WriteLine("TagTrackUid: {0}", tag.TagTrackUid); foreach (MetadataProperty simpleTag in tag.SimpleTags) { Console.WriteLine("GetFormattedValue: {0}", simpleTag.GetFormattedValue()); } } } }
/// <summary> /// This method gets Matroska Segment Info Metadata /// This method is supported by version 19.1 or greater /// </summary> public static void MatroskaSegmentInfoMetadata() { using (MatroskaFormat format = new MatroskaFormat(Common.MapSourceFilePath(filePath))) { foreach (MatroskaSegmentInfoMetadata segment in format.Segments) { Console.WriteLine("DateUtc: {0}", segment.DateUtc); Console.WriteLine("Duration: {0}", segment.Duration); Console.WriteLine("MuxingApp: {0}", segment.MuxingApp); Console.WriteLine("SegmentFilename: {0}", segment.SegmentFilename); Console.WriteLine("SegmentUid: {0}", segment.SegmentUid); Console.WriteLine("TimecodeScale: {0}", segment.TimecodeScale); Console.WriteLine("Title: {0}", segment.Title); Console.WriteLine("WritingApp: {0}", segment.WritingApp); } } }
/// <summary> /// This method gets Matroska Track Metadata /// This method is supported by version 19.1 or greater /// </summary> public static void MatroskaTrackMetadata() { using (MatroskaFormat format = new MatroskaFormat(Common.MapSourceFilePath(filePath))) { foreach (MatroskaTrackMetadata track in format.Tracks) { Console.WriteLine("CodecId: {0}", track.CodecId); Console.WriteLine("CodecName: {0}", track.CodecName); Console.WriteLine("DefaultDuration: {0}", track.DefaultDuration); Console.WriteLine("FlagEnabled: {0}", track.FlagEnabled); Console.WriteLine("Language: {0}", track.Language); Console.WriteLine("LanguageIetf: {0}", track.LanguageIetf); Console.WriteLine("Name: {0}", track.Name); Console.WriteLine("TrackNumber: {0}", track.TrackNumber); Console.WriteLine("TrackType: {0}", track.TrackType); Console.WriteLine("TrackUid: {0}", track.TrackUid); MatroskaAudioTrackMetadata audioTrack = track as MatroskaAudioTrackMetadata; if (audioTrack != null) { Console.WriteLine("SamplingFrequency: {0}", audioTrack.SamplingFrequency); Console.WriteLine("OutputSamplingFrequency: {0}", audioTrack.OutputSamplingFrequency); Console.WriteLine("Channels: {0}", audioTrack.Channels); Console.WriteLine("BitDepth: {0}", audioTrack.BitDepth); } MatroskaVideoTrackMetadata videoTrack = track as MatroskaVideoTrackMetadata; if (videoTrack != null) { Console.WriteLine("FlagInterlaced: {0}", videoTrack.FlagInterlaced); Console.WriteLine("FieldOrder: {0}", videoTrack.FieldOrder); Console.WriteLine("StereoMode: {0}", videoTrack.StereoMode); Console.WriteLine("AlphaMode: {0}", videoTrack.AlphaMode); Console.WriteLine("PixelWidth: {0}", videoTrack.PixelWidth); Console.WriteLine("PixelHeight: {0}", videoTrack.PixelHeight); Console.WriteLine("PixelCropBottom: {0}", videoTrack.PixelCropBottom); Console.WriteLine("PixelCropTop: {0}", videoTrack.PixelCropTop); Console.WriteLine("PixelCropLeft: {0}", videoTrack.PixelCropLeft); Console.WriteLine("PixelCropRight: {0}", videoTrack.PixelCropRight); Console.WriteLine("DisplayWidth: {0}", videoTrack.DisplayWidth); Console.WriteLine("DisplayHeight: {0}", videoTrack.DisplayHeight); Console.WriteLine("DisplayUnit: {0}", videoTrack.DisplayUnit); } } } }