Beispiel #1
0
        internal Metadata(MetadataExtractor extractor)
        {
            Debug.Assert(extractor != null);

            Video = VideoMetadata.From(extractor);
            Audio = AudioMetadata.From(extractor);

            Duration        = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.Duration));
            Artist          = extractor.GetMetadata(MetadataExtractorAttr.Artist);
            Title           = extractor.GetMetadata(MetadataExtractorAttr.Title);
            Album           = extractor.GetMetadata(MetadataExtractorAttr.Album);
            AlbumArtist     = extractor.GetMetadata(MetadataExtractorAttr.AlbumArtist);
            Genre           = extractor.GetMetadata(MetadataExtractorAttr.Genre);
            Author          = extractor.GetMetadata(MetadataExtractorAttr.Composer);
            Composer        = extractor.GetMetadata(MetadataExtractorAttr.Composer);
            Copyright       = extractor.GetMetadata(MetadataExtractorAttr.Copyright);
            DateReleased    = extractor.GetMetadata(MetadataExtractorAttr.ReleaseDate);
            Description     = extractor.GetMetadata(MetadataExtractorAttr.Description);
            Comment         = extractor.GetMetadata(MetadataExtractorAttr.Comment);
            TrackNumber     = extractor.GetMetadata(MetadataExtractorAttr.TrackNum);
            Classification  = extractor.GetMetadata(MetadataExtractorAttr.Classification);
            Rating          = extractor.GetMetadata(MetadataExtractorAttr.Rating);
            Longitude       = ValueConverter.ToNullableDouble(extractor.GetMetadata(MetadataExtractorAttr.Longitude));
            Latitude        = ValueConverter.ToNullableDouble(extractor.GetMetadata(MetadataExtractorAttr.Latitude));
            Altitude        = ValueConverter.ToNullableDouble(extractor.GetMetadata(MetadataExtractorAttr.Altitude));
            Conductor       = extractor.GetMetadata(MetadataExtractorAttr.Conductor);
            UnsyncLyrics    = extractor.GetMetadata(MetadataExtractorAttr.UnSyncLyrics);
            SyncLyricsCount = ValueConverter.ToInt(extractor.GetMetadata(MetadataExtractorAttr.SyncLyricsNum));
            DateRecorded    = extractor.GetMetadata(MetadataExtractorAttr.RecordingDate);
            Rotation        = extractor.GetMetadata(MetadataExtractorAttr.Rotate);
            Content360      = extractor.GetMetadata(MetadataExtractorAttr.ContentFor360);

            _description = new Lazy <string>(() => ObjectDescriptionBuilder.BuildWithProperties(this));
        }
Beispiel #2
0
        private VideoMetadata(int streamCount, MetadataExtractor extractor)
        {
            Debug.Assert(streamCount > 0);

            StreamCount = streamCount;
            BitRate     = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.VideoBitrate));
            Fps         = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.VideoFps));
            Width       = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.VideoWidth));
            Height      = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.VideoHeight));
            Codec       = extractor.GetMetadata(MetadataExtractorAttr.VideoCodec);

            _description = new Lazy <string>(() => ObjectDescriptionBuilder.BuildWithProperties(this));
        }
Beispiel #3
0
        private AudioMetadata(int streamCount, MetadataExtractor extractor)
        {
            Debug.Assert(streamCount > 0);

            StreamCount  = streamCount;
            BitRate      = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.AudioBitrate));
            Channels     = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.AudioChannels));
            SampleRate   = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.AudioSamplerate));
            BitPerSample = ValueConverter.ToNullableInt(extractor.GetMetadata(MetadataExtractorAttr.AudioBitPerSample));
            Codec        = extractor.GetMetadata(MetadataExtractorAttr.AudioCodec);

            _description = new Lazy <string>(() => ObjectDescriptionBuilder.BuildWithProperties(this));
        }
Beispiel #4
0
        internal static string GetMetadata(this MetadataExtractor extractor, MetadataExtractorAttr attr)
        {
            Debug.Assert(extractor != null);

            IntPtr valuePtr = IntPtr.Zero;

            try
            {
                var ret = Native.GetMetadata(extractor.Handle, attr, out valuePtr);
                MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value for " + attr);
                return(Marshal.PtrToStringAnsi(valuePtr));
            }
            finally
            {
                Libc.Free(valuePtr);
            }
        }
Beispiel #5
0
        internal static VideoMetadata From(MetadataExtractor extractor)
        {
            var streamCount = ValueConverter.ToInt(extractor.GetMetadata(MetadataExtractorAttr.VideoStreamCount));

            return(streamCount > 0 ? new VideoMetadata(streamCount, extractor) : null);
        }