946b5ad4b82f2b7a8842f805fb7ee58337c2143e
[platform/core/csapi/tizenfx.git] / src / Tizen.Content.MediaContent / Tizen.Content.MediaContent / VideoInfo.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Diagnostics;
19
20 namespace Tizen.Content.MediaContent
21 {
22     /// <summary>
23     /// Represents a video media information.
24     /// </summary>
25     /// <since_tizen> 4 </since_tizen>
26     public class VideoInfo : MediaInfo
27     {
28         internal VideoInfo(Interop.MediaInfoHandle handle) : base(handle)
29         {
30             IntPtr videoHandle = IntPtr.Zero;
31
32             try
33             {
34                 Interop.MediaInfo.GetVideo(handle, out videoHandle).ThrowIfError("Failed to retrieve data"); // Deprecated since API12
35
36                 Debug.Assert(videoHandle != IntPtr.Zero);
37
38                 Album = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetAlbum); // Deprecated since API12
39                 Artist = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetArtist); // Deprecated since API12
40                 AlbumArtist = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetAlbumArtist); // Deprecated since API12
41                 Genre = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetGenre); // Deprecated since API12
42                 Composer = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetComposer); // Deprecated since API12
43                 Year = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetYear); // Deprecated since API12
44                 DateRecorded = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetRecordedDate); // Deprecated since API12
45                 Copyright = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetCopyright); // Deprecated since API12
46                 TrackNumber = InteropHelper.GetString(videoHandle, Interop.VideoInfo.GetTrackNum); // Deprecated since API12
47
48                 BitRate = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetBitRate); // Deprecated since API12
49                 Duration = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetDuration); // Deprecated since API12
50                 Width = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetWidth); // Deprecated since API12
51                 Height = InteropHelper.GetValue<int>(videoHandle, Interop.VideoInfo.GetHeight); // Deprecated since API12
52             }
53             finally
54             {
55                 Interop.VideoInfo.Destroy(videoHandle); // Deprecated since API12
56             }
57         }
58
59         /// <summary>
60         /// Gets the album name.
61         /// </summary>
62         /// <value>The album name from the metadata.</value>
63         /// <since_tizen> 4 </since_tizen>
64         [Obsolete("Deprecated since API12; Will be removed in API14.")]
65         public string Album { get; }
66
67         /// <summary>
68         /// Gets the artist name.
69         /// </summary>
70         /// <value>The artist name from the metadata.</value>
71         /// <since_tizen> 4 </since_tizen>
72         [Obsolete("Deprecated since API12; Will be removed in API14.")]
73         public string Artist { get; }
74
75         /// <summary>
76         /// Gets the album artist name.
77         /// </summary>
78         /// <value>The album artist name from the metadata.</value>
79         /// <since_tizen> 4 </since_tizen>
80         [Obsolete("Deprecated since API12; Will be removed in API14.")]
81         public string AlbumArtist { get; }
82
83         /// <summary>
84         /// Gets the genre.
85         /// </summary>
86         /// <value>The genre name from the metadata.</value>
87         /// <since_tizen> 4 </since_tizen>
88         [Obsolete("Deprecated since API12; Will be removed in API14.")]
89         public string Genre { get; }
90
91         /// <summary>
92         /// Gets the composer name.
93         /// </summary>
94         /// <value>The composer name from the metadata.</value>
95         /// <since_tizen> 4 </since_tizen>
96         [Obsolete("Deprecated since API12; Will be removed in API14.")]
97         public string Composer { get; }
98
99         /// <summary>
100         /// Gets the year.
101         /// </summary>
102         /// <value>The year from the metadata.</value>
103         /// <since_tizen> 4 </since_tizen>
104         [Obsolete("Deprecated since API12; Will be removed in API14.")]
105         public string Year { get; }
106
107         /// <summary>
108         /// Gets the recorded date.
109         /// </summary>
110         /// <value>The recorded date information from the metadata if exists; otherwise, the modified date of the file.</value>
111         /// <since_tizen> 4 </since_tizen>
112         [Obsolete("Deprecated since API12; Will be removed in API14.")]
113         public string DateRecorded { get; }
114
115         /// <summary>
116         /// Gets the copyright notice.
117         /// </summary>
118         /// <value>The copyright notice from the metadata.</value>
119         /// <since_tizen> 4 </since_tizen>
120         [Obsolete("Deprecated since API12; Will be removed in API14.")]
121         public string Copyright { get; }
122
123         /// <summary>
124         /// Gets the track number.
125         /// </summary>
126         /// <value>The track number from the metadata.</value>
127         /// <since_tizen> 4 </since_tizen>
128         [Obsolete("Deprecated since API12; Will be removed in API14.")]
129         public string TrackNumber { get; }
130
131         /// <summary>
132         /// Gets the bitrate in bit per second.
133         /// </summary>
134         /// <value>The bit rate of the video.</value>
135         /// <since_tizen> 4 </since_tizen>
136         [Obsolete("Deprecated since API12; Will be removed in API14.")]
137         public int BitRate { get; }
138
139         /// <summary>
140         /// Gets the track duration in milliseconds.
141         /// </summary>
142         /// <value>The track duration of the video in milliseconds.</value>
143         /// <since_tizen> 4 </since_tizen>
144         [Obsolete("Deprecated since API12; Will be removed in API14.")]
145         public int Duration { get; }
146
147         /// <summary>
148         /// Gets the video width in pixels.
149         /// </summary>
150         /// <value>The width of the video in pixels.</value>
151         /// <since_tizen> 4 </since_tizen>
152         [Obsolete("Deprecated since API12; Will be removed in API14.")]
153         public int Width { get; }
154
155         /// <summary>
156         /// Gets the video height in pixels.
157         /// </summary>
158         /// <value>The height of the video in pixels.</value>
159         /// <since_tizen> 4 </since_tizen>
160         [Obsolete("Deprecated since API12; Will be removed in API14.")]
161         public int Height { get; }
162
163     }
164 }