internal VideoInfo(Interop.MediaInfoHandle handle) : base(handle) { IntPtr videoHandle = IntPtr.Zero; try { Interop.MediaInfo.GetVideo(handle, out videoHandle).ThrowIfError("Failed to retrieve data"); Debug.Assert(videoHandle != IntPtr.Zero); Album = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetAlbum); Artist = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetArtist); AlbumArtist = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetAlbumArtist); Genre = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetGenre); Composer = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetComposer); Year = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetYear); DateRecorded = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetRecordedDate); Copyright = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetCopyright); TrackNumber = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetTrackNum); BitRate = InteropHelper.GetValue <int>(videoHandle, Interop.VideoInfo.GetBitRate); Duration = InteropHelper.GetValue <int>(videoHandle, Interop.VideoInfo.GetDuration); Width = InteropHelper.GetValue <int>(videoHandle, Interop.VideoInfo.GetWidth); Height = InteropHelper.GetValue <int>(videoHandle, Interop.VideoInfo.GetHeight); } finally { Interop.VideoInfo.Destroy(videoHandle); } }
internal MediaInfo(Interop.MediaInfoHandle handle) { Id = InteropHelper.GetString(handle, Interop.MediaInfo.GetMediaId); Path = InteropHelper.GetString(handle, Interop.MediaInfo.GetFilePath); DisplayName = InteropHelper.GetString(handle, Interop.MediaInfo.GetDisplayName); MediaType = InteropHelper.GetValue <MediaType>(handle, Interop.MediaInfo.GetMediaType); MimeType = InteropHelper.GetString(handle, Interop.MediaInfo.GetMimeType); FileSize = InteropHelper.GetValue <long>(handle, Interop.MediaInfo.GetSize); DateAdded = InteropHelper.GetDateTime(handle, Interop.MediaInfo.GetAddedTime); DateModified = InteropHelper.GetDateTime(handle, Interop.MediaInfo.GetModifiedTime); Timeline = InteropHelper.GetDateTime(handle, Interop.MediaInfo.GetTimeline); ThumbnailPath = InteropHelper.GetString(handle, Interop.MediaInfo.GetThumbnailPath, true); Description = InteropHelper.GetString(handle, Interop.MediaInfo.GetDescription); Longitude = InteropHelper.GetValue <double>(handle, Interop.MediaInfo.GetLongitude); Latitude = InteropHelper.GetValue <double>(handle, Interop.MediaInfo.GetLatitude); Altitude = InteropHelper.GetValue <double>(handle, Interop.MediaInfo.GetAltitude); Rating = InteropHelper.GetValue <int>(handle, Interop.MediaInfo.GetRating); IsFavorite = InteropHelper.GetValue <bool>(handle, Interop.MediaInfo.GetFavorite); Title = InteropHelper.GetString(handle, Interop.MediaInfo.GetTitle); StorageId = InteropHelper.GetString(handle, Interop.MediaInfo.GetStorageId); IsDrm = InteropHelper.GetValue <bool>(handle, Interop.MediaInfo.IsDrm); StorageType = InteropHelper.GetValue <StorageType>(handle, Interop.MediaInfo.GetStorageType); }
internal ImageInfo(Interop.MediaInfoHandle handle) : base(handle) { IntPtr imageHandle = IntPtr.Zero; try { Interop.MediaInfo.GetImage(handle, out imageHandle).ThrowIfError("Failed to retrieve data"); Debug.Assert(imageHandle != IntPtr.Zero); Width = InteropHelper.GetValue <int>(imageHandle, Interop.ImageInfo.GetWidth); Height = InteropHelper.GetValue <int>(imageHandle, Interop.ImageInfo.GetHeight); Orientation = InteropHelper.GetValue <Orientation>(imageHandle, Interop.ImageInfo.GetOrientation); DateTaken = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetDateTaken); ExposureTime = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetExposureTime); FNumber = InteropHelper.GetValue <double>(imageHandle, Interop.ImageInfo.GetFNumber); Iso = InteropHelper.GetValue <int>(imageHandle, Interop.ImageInfo.GetISO); Model = InteropHelper.GetString(imageHandle, Interop.ImageInfo.GetModel); } finally { Interop.ImageInfo.Destroy(imageHandle); } }
internal static TValue GetValue<TValue>(Interop.MediaInfoHandle handle, GetValueFunc<Interop.MediaInfoHandle, TValue> func) { func(handle, out var val).ThrowIfError("Failed to get value"); return val; }
internal static MediaInfo FromHandle(Interop.MediaInfoHandle handle) { if (handle == null || handle.IsInvalid) { return(null); } var type = InteropHelper.GetValue <MediaType>(handle, Interop.MediaInfo.GetMediaType); switch (type) { case MediaType.Image: return(new ImageInfo(handle)); case MediaType.Music: case MediaType.Sound: return(new AudioInfo(handle)); case MediaType.Video: return(new VideoInfo(handle)); case MediaType.Book: return(new BookInfo(handle)); } return(new MediaInfo(handle)); }
internal AudioInfo(Interop.MediaInfoHandle handle) : base(handle) { IntPtr audioHandle = IntPtr.Zero; try { Interop.MediaInfo.GetAudio(handle, out audioHandle).ThrowIfError("Failed to retrieve data"); Debug.Assert(audioHandle != IntPtr.Zero); Album = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbum); Artist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetArtist); AlbumArtist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbumArtist); Genre = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetGenre); Composer = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetComposer); Year = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetYear); DateRecorded = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetRecordedDate); Copyright = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetCopyright); TrackNumber = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetTrackNum); BitRate = InteropHelper.GetValue <int>(audioHandle, Interop.AudioInfo.GetBitRate); BitPerSample = InteropHelper.GetValue <int>(audioHandle, Interop.AudioInfo.GetBitPerSample); SampleRate = InteropHelper.GetValue <int>(audioHandle, Interop.AudioInfo.GetSampleRate); Channels = InteropHelper.GetValue <int>(audioHandle, Interop.AudioInfo.GetChannel); Duration = InteropHelper.GetValue <int>(audioHandle, Interop.AudioInfo.GetDuration); } finally { Interop.AudioInfo.Destroy(audioHandle); } }
internal static MediaInfo FromHandle(IntPtr handle) { var safeHandle = new Interop.MediaInfoHandle(handle); try { return(FromHandle(safeHandle)); } finally { safeHandle.SetHandleAsInvalid(); } }
internal BookInfo(Interop.MediaInfoHandle handle) : base(handle) { IntPtr bookHandle = IntPtr.Zero; try { Interop.MediaInfo.GetBook(handle, out bookHandle).ThrowIfError("Failed to retrieve data"); Debug.Assert(bookHandle != IntPtr.Zero); Subject = InteropHelper.GetString(bookHandle, Interop.BookInfo.GetSubject); Author = InteropHelper.GetString(bookHandle, Interop.BookInfo.GetAuthor); DatePublished = InteropHelper.GetString(bookHandle, Interop.BookInfo.GetDate); Publisher = InteropHelper.GetString(bookHandle, Interop.BookInfo.GetPublisher); } finally { Interop.BookInfo.Destroy(bookHandle).ThrowIfError("Failed to destroy book handle"); } }