Release 4.0.0-preview1-00051
[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         /// Preparing 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="Display.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         /// Origin 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, See <see cref="Display.SetRoi(Rectangle)"/>.
199         /// </summary>
200         Roi
201     }
202
203     internal enum StreamType
204     {
205         /// <summary>
206         ///  Audio element stream type
207         /// </summary>
208         Audio = 1,
209
210         /// <summary>
211         /// Video element stream type
212         /// </summary>
213         Video,
214
215         /// <summary>
216         /// Text type
217         /// </summary>
218         Text
219     }
220
221     /// <summary>
222     /// Specifies the streaming buffer status.
223     /// </summary>
224     /// <seealso cref="MediaStreamConfiguration.BufferStatusChanged"/>
225     /// <seealso cref="MediaStreamBufferStatusChangedEventArgs"/>
226     public enum MediaStreamBufferStatus
227     {
228         /// <summary>
229         /// Underrun.
230         /// </summary>
231         Underrun,
232
233         /// <summary>
234         ///  Completed.
235         /// </summary>
236         Overflow,
237     }
238
239     /// <summary>
240     /// Specifies the reason for the playback interruption.
241     /// </summary>
242     /// <seealso cref="Player.PlaybackInterrupted"/>
243     public enum PlaybackInterruptionReason
244     {
245         /// <summary>
246         /// Interrupted by a resource conflict and the <see cref="Player"/> will be unprepared, automatically.
247         /// </summary>
248         ResourceConflict = 4
249     }
250
251     /// <summary>
252     /// Specifies keys for the metadata.
253     /// </summary>
254     /// <seealso cref="StreamInfo.GetMetadata(StreamMetadataKey)"/>
255     public enum StreamMetadataKey
256     {
257         /// <summary>
258         /// Album.
259         /// </summary>
260         Album,
261
262         /// <summary>
263         /// Artists.
264         /// </summary>
265         Artist,
266
267         /// <summary>
268         /// Author.
269         /// </summary>
270         Author,
271
272         /// <summary>
273         /// Genre.
274         /// </summary>
275         Genre,
276
277         /// <summary>
278         /// Title.
279         /// </summary>
280         Title,
281
282         /// <summary>
283         /// Year.
284         /// </summary>
285         Year
286     }
287 }