Release 4.0.0-preview1-00201
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.MediaPlayer / Player / PlayerEnums.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 using System;
17 using Tizen.Internals.Errors;
18
19 namespace Tizen.Multimedia
20 {
21     /// <summary>
22     /// Specifies errors.
23     /// </summary>
24     /// <seealso cref="Player.ErrorOccurred"/>
25     /// <seealso cref="PlayerErrorOccurredEventArgs"/>
26     public enum PlayerError
27     {
28         /// <summary>
29         /// File does not exists.
30         /// </summary>
31         NoSuchFile = ErrorCode.NoSuchFile,
32
33         /// <summary>
34         /// Internal error.
35         /// </summary>
36         InternalError = ErrorCode.InvalidOperation,
37
38         /// <summary>
39         /// No space.
40         /// </summary>
41         NoSpaceOnDevice = PlayerErrorCode.NoSpaceOnDevice,
42
43         /// <summary>
44         /// Not enough buffer.
45         /// </summary>
46         BufferSpace = ErrorCode.BufferSpace,
47
48         /// <summary>
49         /// <see cref="Player.SetPlayPositionAsync(int, bool)"/> failed.
50         /// </summary>
51         SeekFailed = PlayerErrorCode.SeekFailed,
52
53         /// <summary>
54         /// Invalid state.
55         /// </summary>
56         InvalidState = PlayerErrorCode.InvalidState,
57
58         /// <summary>
59         /// Not supported file.
60         /// </summary>
61         NotSupportedFile = PlayerErrorCode.NotSupportedFile,
62
63         /// <summary>
64         /// Invalid uri.
65         /// </summary>
66         InvalidUri = PlayerErrorCode.InvalidUri,
67
68         /// <summary>
69         /// Connection to service failed.
70         /// </summary>
71         ConnectionFailed = PlayerErrorCode.ConnectionFailed,
72
73         /// <summary>
74         /// Not permitted DRM.
75         /// </summary>
76         DrmNotPermitted = PlayerErrorCode.DrmNotPermitted,
77
78         /// <summary>
79         /// Service disconnected.
80         /// </summary>
81         ServiceDisconnected = PlayerErrorCode.ServiceDisconnected,
82
83         /// <summary>
84         /// Not supported audio codec.
85         /// </summary>
86         AudioCodecNotSupported = PlayerErrorCode.NotSupportedAudioCodec,
87
88         /// <summary>
89         /// Not supported video codec.
90         /// </summary>
91         VideoCodecNotSupported = PlayerErrorCode.NotSupportedVideoCodec,
92
93         /// <summary>
94         /// Not supported subtitle file.
95         /// </summary>
96         SubtitleNotSupported = PlayerErrorCode.NotSupportedSubtitle,
97     }
98
99     /// <summary>
100     /// Specifies states that a <see cref="Player"/> can have.
101     /// </summary>
102     public enum PlayerState
103     {
104         /// <summary>
105         /// Initial state, unprepared.
106         /// </summary>
107         /// <seealso cref="Player.Unprepare"/>
108         Idle = 1,
109
110         /// <summary>
111         /// Prepared.
112         /// </summary>
113         /// <seealso cref="Player.PrepareAsync"/>
114         Ready,
115
116         /// <summary>
117         /// Playing.
118         /// </summary>
119         /// <seealso cref="Player.Start"/>
120         Playing,
121
122         /// <summary>
123         /// Paused while playing media.
124         /// </summary>
125         /// <seealso cref="Player.Pause"/>
126         Paused,
127
128         /// <summary>
129         /// Preparation in progress.
130         /// </summary>
131         /// <seealso cref="Player.PrepareAsync"/>/>
132         Preparing,
133     }
134
135     internal static class PlayerStateExtensions
136     {
137         internal static bool IsAnyOf(this PlayerState thisState, params PlayerState[] states)
138         {
139             return Array.IndexOf(states, thisState) != -1;
140         }
141     }
142
143     /// <summary>
144     /// Specifies audio latency modes for <see cref="Player"/>.
145     /// </summary>
146     /// <seealso cref="Player.AudioLatencyMode"/>
147     public enum AudioLatencyMode
148     {
149         /// <summary>
150         /// Low audio latency mode.
151         /// </summary>
152         Low,
153
154         /// <summary>
155         ///  Middle audio latency mode.
156         /// </summary>
157         Mid,
158
159         /// <summary>
160         /// High audio latency mode.
161         /// </summary>
162         High,
163     }
164
165     /// <summary>
166     /// Specifies display modes for <see cref="Player"/>.
167     /// </summary>
168     /// <seealso cref="PlayerDisplaySettings.Mode"/>
169     public enum PlayerDisplayMode
170     {
171         /// <summary>
172         /// Letter box.
173         /// </summary>
174         LetterBox,
175
176         /// <summary>
177         /// Original size.
178         /// </summary>
179         OriginalSize,
180
181         /// <summary>
182         /// Full-screen.
183         /// </summary>
184         FullScreen,
185
186         /// <summary>
187         /// Cropped full-screen.
188         /// </summary>
189         CroppedFull,
190
191         /// <summary>
192         /// Original size (if surface size is larger than video size(width/height)) or
193         /// letter box (if video size(width/height) is larger than surface size).
194         /// </summary>
195         OriginalOrFull,
196
197         /// <summary>
198         /// Region of interest.
199         /// </summary>
200         /// <seealso cref="PlayerDisplaySettings.SetRoi(Rectangle)"/>
201         Roi
202     }
203
204     internal enum StreamType
205     {
206         /// <summary>
207         ///  Audio element stream type.
208         /// </summary>
209         Audio = 1,
210
211         /// <summary>
212         /// Video element stream type.
213         /// </summary>
214         Video,
215
216         /// <summary>
217         /// Text type.
218         /// </summary>
219         Text
220     }
221
222     /// <summary>
223     /// Specifies the streaming buffer status.
224     /// </summary>
225     /// <seealso cref="MediaStreamConfiguration.BufferStatusChanged"/>
226     /// <seealso cref="MediaStreamBufferStatusChangedEventArgs"/>
227     public enum MediaStreamBufferStatus
228     {
229         /// <summary>
230         /// Underrun.
231         /// </summary>
232         Underrun,
233
234         /// <summary>
235         ///  Completed.
236         /// </summary>
237         Overflow,
238     }
239
240     /// <summary>
241     /// Specifies the reason for the playback interruption.
242     /// </summary>
243     /// <seealso cref="Player.PlaybackInterrupted"/>
244     public enum PlaybackInterruptionReason
245     {
246         /// <summary>
247         /// Interrupted by a resource conflict and the <see cref="Player"/> will be unprepared automatically.
248         /// </summary>
249         ResourceConflict = 4
250     }
251
252     /// <summary>
253     /// Specifies keys for the metadata.
254     /// </summary>
255     /// <seealso cref="StreamInfo.GetMetadata(StreamMetadataKey)"/>
256     public enum StreamMetadataKey
257     {
258         /// <summary>
259         /// Album.
260         /// </summary>
261         Album,
262
263         /// <summary>
264         /// Artists.
265         /// </summary>
266         Artist,
267
268         /// <summary>
269         /// Author.
270         /// </summary>
271         Author,
272
273         /// <summary>
274         /// Genre.
275         /// </summary>
276         Genre,
277
278         /// <summary>
279         /// Title.
280         /// </summary>
281         Title,
282
283         /// <summary>
284         /// Year.
285         /// </summary>
286         Year
287     }
288 }