Merge "Added Rotation and Flip enums for common use." into tizen
[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         //TODO must be removed.
44         /// <summary>
45         /// Not supported.
46         /// </summary>
47         FeatureNotSupported = ErrorCode.NotSupported,
48
49         //TODO must be removed.
50         /// <summary>
51         /// Permission denined.
52         /// </summary>
53         PermissionDenied = ErrorCode.PermissionDenied,
54
55         /// <summary>
56         /// Not enough buffer.
57         /// </summary>
58         BufferSpace = ErrorCode.BufferSpace,
59
60         /// <summary>
61         /// <see cref="Player.SetPlayPositionAsync(int, bool)/> failed.
62         /// </summary>
63         SeekFailed = PlayerErrorCode.SeekFailed,
64
65         /// <summary>
66         /// Invalid state.
67         /// </summary>
68         InvalidState = PlayerErrorCode.InvalidState,
69
70         /// <summary>
71         /// Not supported file.
72         /// </summary>
73         NotSupportedFile = PlayerErrorCode.NotSupportedFile,
74
75         /// <summary>
76         /// Invalid uri.
77         /// </summary>
78         InvalidUri = PlayerErrorCode.InvalidUri,
79
80         //TODO must be removed.
81         /// <summary>
82         /// Sound policy error.
83         /// </summary>
84         SoundPolicy = PlayerErrorCode.SoundPolicyError,
85
86         /// <summary>
87         /// Connection to service failed.
88         /// </summary>
89         ConnectionFailed = PlayerErrorCode.ConnectionFailed,
90
91         // TODO must be removed.
92         /// <summary>
93         /// Capture failed.
94         /// </summary>
95         VideoCaptureFailed = PlayerErrorCode.VideoCaptureFailed,
96
97         // TODO must be removed.
98         /// <summary>
99         /// DRM expired.
100         /// </summary>
101         DrmExpired = PlayerErrorCode.DrmExpired,
102
103         // TODO must be removed.
104         /// <summary>
105         /// No license of DRM.
106         /// </summary>
107         DrmNoLicense = PlayerErrorCode.DrmNoLicense,
108
109         // TODO must be removed.
110         /// <summary>
111         /// Not used.
112         /// </summary>
113         DrmFutureUse = PlayerErrorCode.DrmFutureUse,
114
115         /// <summary>
116         /// Not permitted DRM.
117         /// </summary>
118         DrmNotPermitted = PlayerErrorCode.DrmNotPermitted,
119
120         // TODO must be removed.
121         /// <summary>
122         /// Not enough resource.
123         /// </summary>
124         ResourceLimit = PlayerErrorCode.ResourceLimit,
125
126         /// <summary>
127         /// Service disconnected.
128         /// </summary>
129         ServiceDisconnected = PlayerErrorCode.ServiceDisconnected,
130
131         /// <summary>
132         /// Not supported subtitle file.
133         /// </summary>
134         SubtitleNotSupported = PlayerErrorCode.NotSupportedSubtitle,
135     }
136
137     /// <summary>
138     /// Specifies states that a <see cref="Player"/> can have.
139     /// </summary>
140     public enum PlayerState
141     {
142         /// <summary>
143         /// Initial state, unprepared.
144         /// </summary>
145         /// <seealso cref="Player.Unprepare"/>
146         Idle = 1,
147
148         /// <summary>
149         /// Prepared.
150         /// </summary>
151         /// <seealso cref="Player.PrepareAsync"/>
152         Ready,
153
154         /// <summary>
155         /// Playing.
156         /// </summary>
157         /// <seealso cref="Player.Start"/>
158         Playing,
159
160         /// <summary>
161         /// Paused while playing media.
162         /// </summary>
163         /// <seealso cref="Player.Pause"/>
164         Paused,
165
166         /// <summary>
167         /// Preparing in progress.
168         /// </summary>
169         /// <seealso cref="Player.PrepareAsync"/>/>
170         Preparing,
171     }
172
173     internal static class PlayerStateExtensions
174     {
175         internal static bool IsAnyOf(this PlayerState thisState, params PlayerState[] states)
176         {
177             return Array.IndexOf(states, thisState) != -1;
178         }
179     }
180
181     /// <summary>
182     /// Specifies audio latency modes for <see cref="Player"/> .
183     /// </summary>
184     /// <seealso cref="Player.AudioLatencyMode"/>
185     public enum AudioLatencyMode
186     {
187         /// <summary>
188         /// Low audio latency mode.
189         /// </summary>
190         Low,
191
192         /// <summary>
193         ///  Middle audio latency mode.
194         /// </summary>
195         Mid,
196
197         /// <summary>
198         /// High audio latency mode.
199         /// </summary>
200         High,
201     }
202
203     /// <summary>
204     /// Specifies display modes for <see cref="Player"/>
205     /// </summary>
206     /// <seealso cref="Display.Mode"/>
207     public enum PlayerDisplayMode
208     {
209         /// <summary>
210         /// Letter box.
211         /// </summary>
212         LetterBox,
213
214         /// <summary>
215         /// Original size.
216         /// </summary>
217         OriginalSize,
218
219         /// <summary>
220         /// Full-screen.
221         /// </summary>
222         FullScreen,
223
224         /// <summary>
225         /// Cropped full-screen.
226         /// </summary>
227         CroppedFull,
228
229         /// <summary>
230         /// Origin size (if surface size is larger than video size(width/height)) or
231         /// Letter box (if video size(width/height) is larger than surface size).
232         /// </summary>
233         OriginalOrFull,
234
235         /// <summary>
236         /// Region of interest, See <see cref="Display.SetRoi(Rectangle)"/>.
237         /// </summary>
238         Roi
239     }
240
241     internal enum StreamType
242     {
243         /// <summary>
244         ///  Audio element stream type
245         /// </summary>
246         Audio = 1,
247
248         /// <summary>
249         /// Video element stream type
250         /// </summary>
251         Video,
252
253         /// <summary>
254         /// Text type
255         /// </summary>
256         Text
257     }
258
259     /// <summary>
260     /// Specifies the streaming buffer status.
261     /// </summary>
262     /// <seealso cref="MediaStreamConfiguration.BufferStatusChanged"/>
263     /// <seealso cref="MediaStreamBufferStatusChangedEventArgs"/>
264     public enum MediaStreamBufferStatus
265     {
266         /// <summary>
267         /// Underrun.
268         /// </summary>
269         Underrun,
270
271         /// <summary>
272         ///  Completed.
273         /// </summary>
274         Overflow,
275     }
276
277     /// <summary>
278     /// Specifies the reason for the playback interruption.
279     /// </summary>
280     /// <seealso cref="Player.PlaybackInterrupted"/>
281     public enum PlaybackInterruptionReason
282     {
283         /// <summary>
284         /// Interrupted by a resource conflict and the <see cref="Player"/> will be unprepared, automatically.
285         /// </summary>
286         ResourceConflict = 4
287     }
288
289     /// <summary>
290     /// Specifies keys for the metadata.
291     /// </summary>
292     /// <seealso cref="StreamInfo.GetMetadata(StreamMetadataKey)"/>
293     public enum StreamMetadataKey
294     {
295         /// <summary>
296         /// Album.
297         /// </summary>
298         Album,
299
300         /// <summary>
301         /// Artists.
302         /// </summary>
303         Artist,
304
305         /// <summary>
306         /// Author.
307         /// </summary>
308         Author,
309
310         /// <summary>
311         /// Genre.
312         /// </summary>
313         Genre,
314
315         /// <summary>
316         /// Title.
317         /// </summary>
318         Title,
319
320         /// <summary>
321         /// Year.
322         /// </summary>
323         Year
324     }
325 }