2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Diagnostics;
20 namespace Tizen.Content.MediaContent
23 /// Represents the audio media information.
25 public class AudioInfo : MediaInfo
27 internal AudioInfo(Interop.MediaInfoHandle handle) : base(handle)
29 IntPtr audioHandle = IntPtr.Zero;
33 Interop.MediaInfo.GetAudio(handle, out audioHandle).ThrowIfError("Failed to retrieve data");
35 Debug.Assert(audioHandle != IntPtr.Zero);
37 Album = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbum);
38 Artist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetArtist);
39 AlbumArtist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbumArtist);
40 Genre = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetGenre);
41 Composer = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetComposer);
42 Year = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetYear);
43 DateRecorded = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetRecordedDate);
44 Copyright = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetCopyright);
45 TrackNumber = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetTrackNum);
47 BitRate = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetBitRate);
48 BitPerSample = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetBitPerSample);
49 SampleRate = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetSampleRate);
50 Channels = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetChannel);
52 Duration = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetDuration);
56 Interop.AudioInfo.Destroy(audioHandle);
61 /// Gets the album name.
63 /// <value>The album from the metadata.</value>
64 public string Album { get; }
67 /// Gets the artist name.
69 /// <value>The artist from the metadata.</value>
70 public string Artist { get; }
73 /// Gets the album artist name.
75 /// <value>The album artist from the metadata.</value>
76 public string AlbumArtist { get; }
81 /// <value>The genre from the metadata.</value>
82 public string Genre { get; }
85 /// Gets the composer.
87 /// <value>The composer from the metadata.</value>
88 public string Composer { get; }
93 /// <value>The year from the metadata.</value>
94 public string Year { get; }
97 /// Gets the recorded date.
99 /// <value>The recorded date from the metadata.</value>
100 public string DateRecorded { get; }
103 /// Gets the copyright.
105 /// <value>The copyright from the metadata.</value>
106 public string Copyright { get; }
109 /// Gets the track number.
111 /// <value>The track number from the metadata.</value>
112 public string TrackNumber { get; }
115 /// Gets the bit rate in bit per second.
117 /// <value>The bit rate in bit per second.</value>
118 public int BitRate { get; }
121 /// Gets the bit per sample.
123 /// <value>The bit per sample.</value>
124 public int BitPerSample { get; }
127 /// Gets the sample rate in hertz.
129 /// <value>The sample rate in hertz.</value>
130 public int SampleRate { get; }
133 /// Gets the number of channels.
135 /// <value>The number of channels.</value>
136 public int Channels { get; }
139 /// Gets the track duration in milliseconds.
141 /// <value>The track duration in milliseconds.</value>
142 public int Duration { get; }