ac58ce4d22bd93023da291c7e5edc924b5602ad3
[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 System.Threading;
18 using Tizen.Internals.Errors;
19
20 namespace Tizen.Multimedia
21 {
22     /// <summary>
23     /// Specifies errors.
24     /// </summary>
25     /// <seealso cref="Player.ErrorOccurred"/>
26     /// <seealso cref="PlayerErrorOccurredEventArgs"/>
27     /// <since_tizen> 3 </since_tizen>
28     public enum PlayerError
29     {
30         /// <summary>
31         /// File does not exists.
32         /// </summary>
33         NoSuchFile = ErrorCode.NoSuchFile,
34
35         /// <summary>
36         /// Internal error.
37         /// </summary>
38         InternalError = ErrorCode.InvalidOperation,
39
40         /// <summary>
41         /// No space.
42         /// </summary>
43         NoSpaceOnDevice = PlayerErrorCode.NoSpaceOnDevice,
44
45         /// <summary>
46         /// Not enough buffer.
47         /// </summary>
48         BufferSpace = ErrorCode.BufferSpace,
49
50         /// <summary>
51         /// <see cref="Player.SetPlayPositionAsync(int, bool)"/> failed.
52         /// </summary>
53         SeekFailed = PlayerErrorCode.SeekFailed,
54
55         /// <summary>
56         /// Invalid state.
57         /// </summary>
58         InvalidState = PlayerErrorCode.InvalidState,
59
60         /// <summary>
61         /// Not supported file.
62         /// </summary>
63         NotSupportedFile = PlayerErrorCode.NotSupportedFile,
64
65         /// <summary>
66         /// Invalid uri.
67         /// </summary>
68         InvalidUri = PlayerErrorCode.InvalidUri,
69
70         /// <summary>
71         /// Connection to service failed.
72         /// </summary>
73         ConnectionFailed = PlayerErrorCode.ConnectionFailed,
74
75         /// <summary>
76         /// Not permitted DRM.
77         /// </summary>
78         DrmNotPermitted = PlayerErrorCode.DrmNotPermitted,
79
80         /// <summary>
81         /// Service disconnected.
82         /// </summary>
83         ServiceDisconnected = PlayerErrorCode.ServiceDisconnected,
84
85         /// <summary>
86         /// Not supported audio codec.
87         /// </summary>
88         /// <since_tizen> 4 </since_tizen>
89         AudioCodecNotSupported = PlayerErrorCode.NotSupportedAudioCodec,
90
91         /// <summary>
92         /// Not supported video codec.
93         /// </summary>
94         /// <since_tizen> 4 </since_tizen>
95         VideoCodecNotSupported = PlayerErrorCode.NotSupportedVideoCodec,
96
97         /// <summary>
98         /// Not supported subtitle file.
99         /// </summary>
100         SubtitleNotSupported = PlayerErrorCode.NotSupportedSubtitle,
101     }
102
103     /// <summary>
104     /// Specifies states that a <see cref="Player"/> can have.
105     /// </summary>
106     /// <since_tizen> 3 </since_tizen>
107     public enum PlayerState
108     {
109         /// <summary>
110         /// Initial state, unprepared.
111         /// </summary>
112         /// <seealso cref="Player.Unprepare"/>
113         Idle = 1,
114
115         /// <summary>
116         /// Prepared.
117         /// </summary>
118         /// <seealso cref="Player.PrepareAsync()"/>
119         /// <seealso cref="Player.PrepareAsync(CancellationToken)"/>
120         Ready,
121
122         /// <summary>
123         /// Playing.
124         /// </summary>
125         /// <seealso cref="Player.Start"/>
126         Playing,
127
128         /// <summary>
129         /// Paused while playing media.
130         /// </summary>
131         /// <seealso cref="Player.Pause"/>
132         Paused,
133
134         /// <summary>
135         /// Preparation in progress.
136         /// </summary>
137         /// <remarks>In this state, other methods and properties cannot be set.</remarks>
138         /// <seealso cref="Player.PrepareAsync()"/>
139         /// <seealso cref="Player.PrepareAsync(CancellationToken)"/>
140         Preparing,
141     }
142
143     internal static class PlayerStateExtensions
144     {
145         internal static bool IsAnyOf(this PlayerState thisState, params PlayerState[] states)
146         {
147             return Array.IndexOf(states, thisState) != -1;
148         }
149     }
150
151     /// <summary>
152     /// Specifies audio latency modes for <see cref="Player"/>.
153     /// </summary>
154     /// <seealso cref="Player.AudioLatencyMode"/>
155     /// <since_tizen> 3 </since_tizen>
156     public enum AudioLatencyMode
157     {
158         /// <summary>
159         /// Low audio latency mode.
160         /// </summary>
161         Low,
162
163         /// <summary>
164         ///  Middle audio latency mode.
165         /// </summary>
166         Mid,
167
168         /// <summary>
169         /// High audio latency mode.
170         /// </summary>
171         High,
172     }
173
174     /// <summary>
175     /// Specifies display modes for <see cref="Player"/>.
176     /// </summary>
177     /// <seealso cref="PlayerDisplaySettings.Mode"/>
178     /// <since_tizen> 3 </since_tizen>
179     public enum PlayerDisplayMode
180     {
181         /// <summary>
182         /// Letter box.
183         /// </summary>
184         LetterBox,
185
186         /// <summary>
187         /// Original size.
188         /// </summary>
189         OriginalSize,
190
191         /// <summary>
192         /// Full-screen.
193         /// </summary>
194         FullScreen,
195
196         /// <summary>
197         /// Cropped full-screen.
198         /// </summary>
199         CroppedFull,
200
201         /// <summary>
202         /// Original size (if surface size is larger than video size(width/height)) or
203         /// letter box (if video size(width/height) is larger than surface size).
204         /// </summary>
205         OriginalOrFull,
206
207         /// <summary>
208         /// Region of interest.
209         /// </summary>
210         /// <seealso cref="PlayerDisplaySettings.SetRoi(Rectangle)"/>
211         Roi
212     }
213
214     internal enum StreamType
215     {
216         /// <summary>
217         ///  Audio element stream type.
218         /// </summary>
219         Audio = 1,
220
221         /// <summary>
222         /// Video element stream type.
223         /// </summary>
224         Video,
225
226         /// <summary>
227         /// Text type.
228         /// </summary>
229         Text
230     }
231
232     /// <summary>
233     /// Specifies the streaming buffer status.
234     /// </summary>
235     /// <seealso cref="MediaStreamConfiguration.BufferStatusChanged"/>
236     /// <seealso cref="MediaStreamBufferStatusChangedEventArgs"/>
237     /// <since_tizen> 3 </since_tizen>
238     public enum MediaStreamBufferStatus
239     {
240         /// <summary>
241         /// Underrun.
242         /// </summary>
243         Underrun,
244
245         /// <summary>
246         ///  Completed.
247         /// </summary>
248         Overflow,
249     }
250
251     /// <summary>
252     /// Specifies the reason for the playback interruption.
253     /// </summary>
254     /// <seealso cref="Player.PlaybackInterrupted"/>
255     /// <since_tizen> 3 </since_tizen>
256     public enum PlaybackInterruptionReason
257     {
258         /// <summary>
259         /// Interrupted by a resource conflict and the <see cref="Player"/> will be unprepared automatically.
260         /// </summary>
261         ResourceConflict = 4
262     }
263
264     /// <summary>
265     /// Specifies keys for the metadata.
266     /// </summary>
267     /// <seealso cref="StreamInfo.GetMetadata(StreamMetadataKey)"/>
268     /// <since_tizen> 3 </since_tizen>
269     public enum StreamMetadataKey
270     {
271         /// <summary>
272         /// Album.
273         /// </summary>
274         Album,
275
276         /// <summary>
277         /// Artists.
278         /// </summary>
279         Artist,
280
281         /// <summary>
282         /// Author.
283         /// </summary>
284         Author,
285
286         /// <summary>
287         /// Genre.
288         /// </summary>
289         Genre,
290
291         /// <summary>
292         /// Title.
293         /// </summary>
294         Title,
295
296         /// <summary>
297         /// Year.
298         /// </summary>
299         Year
300     }
301
302     /// <summary>
303     /// Enumeration of audio extract option.
304     /// </summary>
305     /// <seealso cref="Player.EnableExportingAudioData"/>
306     /// <since_tizen> 6 </since_tizen>
307     public enum PlayerAudioExtractOption
308     {
309         /// <summary>
310         /// Sync multi-channel audio stream with the playback clock.
311         /// </summary>
312         Default = 0x00,
313
314         /// <summary>
315         /// No sync with the playback clock.
316         /// </summary>
317         NoSyncWithClock = 0x01,
318
319         /// <summary>
320         /// Splits one interleaved multi-channel audio stream into several mono audio streams.
321         /// </summary>
322         Deinterleave = 0x02,
323
324         /// <summary>
325         /// Doesn't sync with clock and doesn't split multi-channel audio stream into several mono audio streams.
326         /// </summary>
327         NoSyncAndDeinterleave = 0x03,
328     }
329
330
331     /// <summary>
332     /// Specifies the types of a codec for <see cref="Player"/>.
333     /// </summary>
334     /// <seealso cref="Player.AudioCodecType"/>
335     /// <since_tizen> 6 </since_tizen>
336     public enum CodecType
337     {
338         /// <summary>
339         /// An optional flag for using the H/W codec.
340         /// </summary>
341         Hardware,
342
343         /// <summary>
344         ///  An optional flag for using the S/W codec
345         /// </summary>
346         Software,
347     }
348 }