/* * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an AS IS BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Diagnostics; namespace Tizen.Content.MediaContent { /// /// Represents the audio media information. /// /// 4 public class AudioInfo : MediaInfo { 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(audioHandle, Interop.AudioInfo.GetBitRate); BitPerSample = InteropHelper.GetValue(audioHandle, Interop.AudioInfo.GetBitPerSample); SampleRate = InteropHelper.GetValue(audioHandle, Interop.AudioInfo.GetSampleRate); Channels = InteropHelper.GetValue(audioHandle, Interop.AudioInfo.GetChannel); Duration = InteropHelper.GetValue(audioHandle, Interop.AudioInfo.GetDuration); } finally { Interop.AudioInfo.Destroy(audioHandle); } } /// /// Gets the album name. /// /// The album from the metadata. /// 4 public string Album { get; } /// /// Gets the artist name. /// /// The artist from the metadata. /// 4 public string Artist { get; } /// /// Gets the album artist name. /// /// The album artist from the metadata. /// 4 public string AlbumArtist { get; } /// /// Gets the genre. /// /// The genre from the metadata. /// 4 public string Genre { get; } /// /// Gets the composer. /// /// The composer from the metadata. /// 4 public string Composer { get; } /// /// Gets the year. /// /// The year from the metadata. /// 4 public string Year { get; } /// /// Gets the recorded date. /// /// The recorded date from the metadata. /// 4 public string DateRecorded { get; } /// /// Gets the copyright. /// /// The copyright from the metadata. /// 4 public string Copyright { get; } /// /// Gets the track number. /// /// The track number from the metadata. /// 4 public string TrackNumber { get; } /// /// Gets the bit rate in bit per second. /// /// The bit rate in bit per second. /// 4 public int BitRate { get; } /// /// Gets the bit per sample. /// /// The bit per sample. /// 4 public int BitPerSample { get; } /// /// Gets the sample rate in hertz. /// /// The sample rate in hertz. /// 4 public int SampleRate { get; } /// /// Gets the number of channels. /// /// The number of channels. /// 4 public int Channels { get; } /// /// Gets the track duration in milliseconds. /// /// The track duration in milliseconds. /// 4 public int Duration { get; } } }