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 /// <since_tizen> 4 </since_tizen>
26 public class AudioInfo : MediaInfo
28 internal AudioInfo(Interop.MediaInfoHandle handle) : base(handle)
30 IntPtr audioHandle = IntPtr.Zero;
34 Interop.MediaInfo.GetAudio(handle, out audioHandle).ThrowIfError("Failed to retrieve data");
36 Debug.Assert(audioHandle != IntPtr.Zero);
38 Album = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbum);
39 Artist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetArtist);
40 AlbumArtist = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetAlbumArtist);
41 Genre = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetGenre);
42 Composer = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetComposer); // Deprecated since API12
43 Year = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetYear);
44 DateRecorded = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetRecordedDate); // Deprecated since API12
45 Copyright = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetCopyright); // Deprecated since API12
46 TrackNumber = InteropHelper.GetString(audioHandle, Interop.AudioInfo.GetTrackNum);
48 BitRate = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetBitRate); // Deprecated since API12
49 BitPerSample = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetBitPerSample); // Deprecated since API12
50 SampleRate = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetSampleRate); // Deprecated since API12
51 Channels = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetChannel); // Deprecated since API12
53 Duration = InteropHelper.GetValue<int>(audioHandle, Interop.AudioInfo.GetDuration); // Deprecated since API12
57 Interop.AudioInfo.Destroy(audioHandle);
62 /// Gets the album name.
64 /// <value>The album from the metadata.</value>
65 /// <since_tizen> 4 </since_tizen>
66 public string Album { get; }
69 /// Gets the artist name.
71 /// <value>The artist from the metadata.</value>
72 /// <since_tizen> 4 </since_tizen>
73 public string Artist { get; }
76 /// Gets the album artist name.
78 /// <value>The album artist from the metadata.</value>
79 /// <since_tizen> 4 </since_tizen>
80 public string AlbumArtist { get; }
85 /// <value>The genre from the metadata.</value>
86 /// <since_tizen> 4 </since_tizen>
87 public string Genre { get; }
90 /// Gets the composer.
92 /// <value>The composer from the metadata.</value>
93 /// <since_tizen> 4 </since_tizen>
94 [Obsolete("Deprecated since API12. Will be removed in API14.")]
95 public string Composer { get; }
100 /// <value>The year from the metadata.</value>
101 /// <since_tizen> 4 </since_tizen>
102 public string Year { get; }
105 /// Gets the recorded date.
107 /// <value>The recorded date from the metadata.</value>
108 /// <since_tizen> 4 </since_tizen>
109 [Obsolete("Deprecated since API12. Will be removed in API14.")]
110 public string DateRecorded { get; }
113 /// Gets the copyright.
115 /// <value>The copyright from the metadata.</value>
116 /// <since_tizen> 4 </since_tizen>
117 [Obsolete("Deprecated since API12. Will be removed in API14.")]
118 public string Copyright { get; }
121 /// Gets the track number.
123 /// <value>The track number from the metadata.</value>
124 /// <since_tizen> 4 </since_tizen>
125 public string TrackNumber { get; }
128 /// Gets the bit rate in bit per second.
130 /// <value>The bit rate in bit per second.</value>
131 /// <since_tizen> 4 </since_tizen>
132 [Obsolete("Deprecated since API12. Will be removed in API14.")]
133 public int BitRate { get; }
136 /// Gets the bit per sample.
138 /// <value>The bit per sample.</value>
139 /// <since_tizen> 4 </since_tizen>
140 [Obsolete("Deprecated since API12. Will be removed in API14.")]
141 public int BitPerSample { get; }
144 /// Gets the sample rate in hertz.
146 /// <value>The sample rate in hertz.</value>
147 /// <since_tizen> 4 </since_tizen>
148 [Obsolete("Deprecated since API12. Will be removed in API14.")]
149 public int SampleRate { get; }
152 /// Gets the number of channels.
154 /// <value>The number of channels.</value>
155 /// <since_tizen> 4 </since_tizen>
156 [Obsolete("Deprecated since API12. Will be removed in API14.")]
157 public int Channels { get; }
160 /// Gets the track duration in milliseconds.
162 /// <value>The track duration in milliseconds.</value>
163 /// <since_tizen> 4 </since_tizen>
164 [Obsolete("Deprecated since API12. Will be removed in API14.")]
165 public int Duration { get; }