Release 4.0.0-preview1-00051
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Camera / Camera / CameraCapabilities.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.Collections.Generic;
19 using NativeCapabilities = Interop.CameraCapabilities;
20 using NativeSettings = Interop.CameraSettings;
21
22 namespace Tizen.Multimedia
23 {
24     /// <summary>
25     /// The CameraCapabilities class provides properties
26     /// to get various capability information of the camera device.
27     /// </summary>
28     public class CameraCapabilities
29     {
30         internal readonly Camera _camera;
31
32         private IList<Size> _previewResolutions;
33         private IList<Size> _cameraResolutions;
34         private IList<CameraPixelFormat> _captureFormats;
35         private IList<CameraPixelFormat> _previewFormats;
36         private IList<CameraFps> _fps;
37         private IList<CameraAutoFocusMode> _autoFocusModes;
38         private IList<CameraExposureMode> _exposureModes;
39         private IList<CameraIsoLevel> _isoLevels;
40         private IList<CameraTheaterMode> _theaterModes;
41         private IList<CameraWhiteBalance> _whitebalances;
42         private IList<CameraFlashMode> _flashModes;
43         private IList<CameraSceneMode> _sceneModes;
44         private IList<CameraEffectMode> _effectModes;
45         private IList<Rotation> _streamRotations;
46         private IList<Flips> _streamFlips;
47         private IList<CameraPtzType> _ptzTypes;
48         private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max);
49         private delegate bool IsSupportedDelegate(IntPtr handle);
50
51         internal CameraCapabilities(Camera camera)
52         {
53             _camera = camera;
54
55             IsFaceDetectionSupported = IsFeatureSupported(NativeCapabilities.IsFaceDetectionSupported);
56             IsMediaPacketPreviewCallbackSupported = IsFeatureSupported(NativeCapabilities.IsMediaPacketPreviewCallbackSupported);
57             IsZeroShutterLagSupported = IsFeatureSupported(NativeCapabilities.IsZeroShutterLagSupported);
58             IsContinuousCaptureSupported = IsFeatureSupported(NativeCapabilities.IsContinuousCaptureSupported);
59             IsHdrCaptureSupported = IsFeatureSupported(NativeCapabilities.IsHdrCaptureSupported);
60             IsAntiShakeSupported = IsFeatureSupported(NativeCapabilities.IsAntiShakeSupported);
61             IsVideoStabilizationSupported = IsFeatureSupported(NativeCapabilities.IsVideoStabilizationSupported);
62             IsAutoContrastSupported = IsFeatureSupported(NativeCapabilities.IsAutoContrastSupported);
63             IsBrigtnessSupported = CheckRangeValid(NativeSettings.GetBrightnessRange);
64             IsExposureSupported = CheckRangeValid(NativeSettings.GetExposureRange);
65             IsZoomSupported = CheckRangeValid(NativeSettings.GetZoomRange);
66             IsPanSupported = CheckRangeValid(NativeSettings.GetPanRange);
67             IsTiltSupported = CheckRangeValid(NativeSettings.GetTiltRange);
68         }
69
70         private bool IsFeatureSupported(IsSupportedDelegate func)
71         {
72             return func(_camera.GetHandle());
73         }
74
75         private bool CheckRangeValid(GetRangeDelegate func)
76         {
77             CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max),
78                 "Failed to check feature is suported or not.");
79
80             return min < max;
81         }
82
83         /// <summary>
84         /// Gets the face detection feature's supported state.
85         /// true if supported, otherwise false.
86         /// </summary>
87         /// <since_tizen> 3 </since_tizen>
88         public bool IsFaceDetectionSupported { get; }
89
90         /// <summary>
91         /// Gets the media packet preview callback feature's supported state.
92         /// true if supported, otherwise false.
93         /// </summary>
94         /// <since_tizen> 3 </since_tizen>
95         public bool IsMediaPacketPreviewCallbackSupported { get; }
96
97         /// <summary>
98         /// Gets the zero shutter lag feature's supported state.
99         /// true if supported, otherwise false.
100         /// </summary>
101         /// <since_tizen> 3 </since_tizen>
102         public bool IsZeroShutterLagSupported { get; }
103
104         /// <summary>
105         /// Gets continuous capture feature's supported state.
106         /// true if supported, otherwise false.
107         /// </summary>
108         /// <since_tizen> 3 </since_tizen>
109         public bool IsContinuousCaptureSupported { get; }
110
111         /// <summary>
112         /// Gets the support state of HDR capture.
113         /// true if supported, otherwise false.
114         /// </summary>
115         /// <since_tizen> 3 </since_tizen>
116         public bool IsHdrCaptureSupported { get; }
117
118         /// <summary>
119         /// Gets the support state of the anti-shake feature.
120         /// true if supported, otherwise false.
121         /// </summary>
122         /// <since_tizen> 3 </since_tizen>
123         public bool IsAntiShakeSupported { get; }
124
125         /// <summary>
126         /// Gets the support state of the video stabilization feature.
127         /// true if supported, otherwise false.
128         /// </summary>
129         /// <since_tizen> 3 </since_tizen>
130         public bool IsVideoStabilizationSupported { get; }
131
132         /// <summary>
133         /// Gets the support state of auto contrast feature.
134         /// true if supported, otherwise false.
135         /// </summary>
136         /// <since_tizen> 3 </since_tizen>
137         public bool IsAutoContrastSupported { get; }
138
139         /// <summary>
140         /// Gets the support state of brightness feature.
141         /// true if supported, otherwise false.
142         /// </summary>
143         /// <since_tizen> 3 </since_tizen>
144         public bool IsBrigtnessSupported { get; }
145
146         /// <summary>
147         /// Gets the support state of exposure feature.
148         /// true if supported, otherwise false.
149         /// </summary>
150         /// <since_tizen> 3 </since_tizen>
151         public bool IsExposureSupported { get; }
152
153         /// <summary>
154         /// Gets the support state of zoom feature.
155         /// true if supported, otherwise false.
156         /// </summary>
157         /// <since_tizen> 3 </since_tizen>
158         public bool IsZoomSupported { get; }
159
160         /// <summary>
161         /// Gets the support state of pan feature.
162         /// true if supported, otherwise false.
163         /// </summary>
164         /// <since_tizen> 3 </since_tizen>
165         public bool IsPanSupported { get; }
166
167         /// <summary>
168         /// Gets the support state of tilt feature.
169         /// true if supported, otherwise false.
170         /// </summary>
171         /// <since_tizen> 3 </since_tizen>
172         public bool IsTiltSupported { get; }
173
174         /// <summary>
175         /// Retrieves all the preview resolutions supported by the camera.
176         /// </summary>
177         /// <since_tizen> 3 </since_tizen>
178         /// <returns>
179         /// It returns a list containing all the supported preview resolutions.
180         /// by recorder.
181         /// </returns>
182         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
183         public IEnumerable<Size> SupportedPreviewResolutions
184         {
185             get
186             {
187                 if (_previewResolutions == null)
188                 {
189                     _previewResolutions = GetSupportedPreviewResolutions();
190                 }
191
192                 return _previewResolutions;
193             }
194         }
195
196         /// <summary>
197         /// Retrieves all the capture resolutions supported by the camera.
198         /// </summary>
199         /// <since_tizen> 3 </since_tizen>
200         /// <returns>
201         /// It returns a list containing all the supported capture resolutions.
202         /// </returns>
203         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
204         public IEnumerable<Size> SupportedCaptureResolutions
205         {
206             get
207             {
208                 if (_cameraResolutions == null)
209                 {
210                     _cameraResolutions = GetSupportedCaptureResolutions();
211                 }
212
213                 return _cameraResolutions;
214             }
215         }
216
217         /// <summary>
218         /// Retrieves all the capture formats supported by the camera.
219         /// </summary>
220         /// <since_tizen> 3 </since_tizen>
221         /// <returns>
222         /// It returns a list containing all the supported <see cref="CameraPixelFormat"/>.
223         /// </returns>
224         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
225         public IEnumerable<CameraPixelFormat> SupportedCapturePixelFormats
226         {
227             get
228             {
229                 if (_captureFormats == null)
230                 {
231                     _captureFormats = GetSupportedCapturePixelFormats();
232                 }
233
234                 return _captureFormats;
235             }
236         }
237
238         /// <summary>
239         /// Retrieves all the preview formats supported by the camera.
240         /// </summary>
241         /// <since_tizen> 3 </since_tizen>
242         /// <returns>
243         /// It returns a list containing all the supported <see cref="CameraPixelFormat"/>.
244         /// </returns>
245         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
246         public IEnumerable<CameraPixelFormat> SupportedPreviewPixelFormats
247         {
248             get
249             {
250                 if (_previewFormats == null)
251                 {
252                     _previewFormats = GetSupportedPreviewPixelFormats();
253                 }
254
255                 return _previewFormats;
256             }
257         }
258
259         /// <summary>
260         /// Retrieves all the fps supported by the camera.
261         /// </summary>
262         /// <since_tizen> 3 </since_tizen>
263         /// <returns>
264         /// It returns a list containing all the supported <see cref="CameraFps"/>.
265         /// </returns>
266         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
267         public IEnumerable<CameraFps> SupportedPreviewFps
268         {
269             get
270             {
271                 if (_fps == null)
272                 {
273                     _fps = GetSupportedPreviewFps();
274                 }
275
276                 return _fps;
277             }
278         }
279
280         /// <summary>
281         /// Retrieves all the fps by resolution supported by the camera.
282         /// </summary>
283         /// <since_tizen> 3 </since_tizen>
284         /// <returns>
285         /// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
286         /// </returns>
287         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
288         public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(int width, int height)
289         {
290             return GetSupportedPreviewFpsByResolutions(width, height);
291         }
292
293         /// <summary>
294         /// Retrieves all the fps by resolution supported by the camera.
295         /// </summary>
296         /// <since_tizen> 3 </since_tizen>
297         /// <returns>
298         /// It returns a list containing all the supported <see cref="CameraFps"/> by resolution.
299         /// </returns>
300         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
301         public IEnumerable<CameraFps> GetSupportedPreviewFpsByResolution(Size size)
302         {
303             return GetSupportedPreviewFpsByResolutions(size.Width, size.Height);
304         }
305
306         /// <summary>
307         /// Retrieves all the auto focus modes supported by the camera.
308         /// </summary>
309         /// <since_tizen> 3 </since_tizen>
310         /// <returns>
311         /// It returns a list containing all the supported <see cref="CameraAutoFocusMode"/>.
312         /// </returns>
313         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
314         public IEnumerable<CameraAutoFocusMode> SupportedAutoFocusModes
315         {
316             get
317             {
318                 if (_autoFocusModes == null)
319                 {
320                     _autoFocusModes = GetSupportedAutoFocusModes();
321                 }
322
323                 return _autoFocusModes;
324             }
325         }
326
327         /// <summary>
328         /// Retrieves all the exposure modes supported by the camera.
329         /// </summary>
330         /// <since_tizen> 3 </since_tizen>
331         /// <returns>
332         /// It returns a list containing all the supported <see cref="CameraExposureMode"/>.
333         /// </returns>
334         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
335         public IEnumerable<CameraExposureMode> SupportedExposureModes
336         {
337             get
338             {
339                 if (_exposureModes == null)
340                 {
341                     _exposureModes = GetSupportedExposureModes();
342                 }
343
344                 return _exposureModes;
345             }
346         }
347
348         /// <summary>
349         /// Retrieves all the Iso level supported by the camera.
350         /// </summary>
351         /// <since_tizen> 3 </since_tizen>
352         /// <returns>
353         /// It returns a list containing all the supported <see cref="CameraIsoLevel"/>.
354         /// </returns>
355         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
356         public IEnumerable<CameraIsoLevel> SupportedIsoLevels
357         {
358             get
359             {
360                 if (_isoLevels == null)
361                 {
362                     _isoLevels = GetSupportedIsoLevels();
363                 }
364
365                 return _isoLevels;
366             }
367         }
368
369         /// <summary>
370         /// Retrieves all the theater modes supported by the camera.
371         /// </summary>
372         /// <since_tizen> 3 </since_tizen>
373         /// <returns>
374         /// It returns a list containing all the supported <see cref="CameraTheaterMode"/>.
375         /// </returns>
376         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
377         public IEnumerable<CameraTheaterMode> SupportedTheaterModes
378         {
379             get
380             {
381                 if (_theaterModes == null)
382                 {
383                     _theaterModes = GetSupportedTheaterModes();
384                 }
385
386                 return _theaterModes;
387             }
388         }
389
390         /// <summary>
391         /// Retrieves all the whitebalance modes supported by the camera.
392         /// </summary>
393         /// <since_tizen> 3 </since_tizen>
394         /// <returns>
395         /// It returns a list containing all the supported <see cref="CameraWhiteBalance"/>.
396         /// </returns>
397         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
398         public IEnumerable<CameraWhiteBalance> SupportedWhiteBalances
399         {
400             get
401             {
402                 if (_whitebalances == null)
403                 {
404                     _whitebalances = GetSupportedWhitebalances();
405                 }
406
407                 return _whitebalances;
408             }
409         }
410
411         /// <summary>
412         /// Retrieves all the flash modes supported by the camera.
413         /// </summary>
414         /// <since_tizen> 3 </since_tizen>
415         /// <returns>
416         /// It returns a list containing all the supported <see cref="CameraFlashMode"/>.
417         /// </returns>
418         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
419         public IEnumerable<CameraFlashMode> SupportedFlashModes
420         {
421             get
422             {
423                 if (_flashModes == null)
424                 {
425                     _flashModes = GetSupportedFlashModes();
426                 }
427
428                 return _flashModes;
429             }
430         }
431
432         /// <summary>
433         /// Retrieves all the scene modes supported by the camera.
434         /// </summary>
435         /// <since_tizen> 3 </since_tizen>
436         /// <returns>
437         /// It returns a list containing all the supported <see cref="CameraSceneMode"/>.
438         /// </returns>
439         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
440         public IEnumerable<CameraSceneMode> SupportedSceneModes
441         {
442             get
443             {
444                 if (_sceneModes == null)
445                 {
446                     _sceneModes = GetSupportedSceneModes();
447                 }
448
449                 return _sceneModes;
450             }
451         }
452
453         /// <summary>
454         /// Retrieves all the effect modes supported by the camera.
455         /// </summary>
456         /// <since_tizen> 3 </since_tizen>
457         /// <returns>
458         /// It returns a list containing all the supported <see cref="CameraEffectMode"/>.
459         /// </returns>
460         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
461         public IEnumerable<CameraEffectMode> SupportedEffects
462         {
463             get
464             {
465                 if (_effectModes == null)
466                 {
467                     _effectModes = GetSupportedEffects();
468                 }
469
470                 return _effectModes;
471             }
472         }
473
474         /// <summary>
475         /// Retrieves all the stream rotation supported by the camera.
476         /// </summary>
477         /// <since_tizen> 3 </since_tizen>
478         /// <returns>
479         /// An IEnumerable containing all the supported <see cref="Rotation"/>.
480         /// </returns>
481         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
482         public IEnumerable<Rotation> SupportedStreamRotations
483         {
484             get
485             {
486                 if (_streamRotations == null)
487                 {
488                     _streamRotations = GetSupportedStreamRotations();
489                 }
490
491                 return _streamRotations;
492             }
493         }
494
495         /// <summary>
496         /// Retrieves all the flips supported by the camera.
497         /// </summary>
498         /// <since_tizen> 3 </since_tizen>
499         /// <returns>
500         /// It returns a list containing all the supported <see cref="CameraFlip"/>.
501         /// </returns>
502         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
503         public IEnumerable<Flips> SupportedStreamFlips
504         {
505             get
506             {
507                 if (_streamFlips == null)
508                 {
509                     _streamFlips = GetSupportedStreamFlips();
510                 }
511
512                 return _streamFlips;
513             }
514         }
515
516         /// <summary>
517         /// Retrieves all the ptz types by the camera.
518         /// </summary>
519         /// <since_tizen> 3 </since_tizen>
520         /// <returns>
521         /// It returns a list containing all the supported <see cref="CameraPtzType"/>.
522         /// </returns>
523         /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
524         public IEnumerable<CameraPtzType> SupportedPtzTypes
525         {
526             get
527             {
528                 if (_ptzTypes.Count == 0)
529                 {
530                     _ptzTypes = GetSupportedPtzTypes();
531                 }
532
533                 return _ptzTypes;
534             }
535         }
536
537         #region Methods for getting supported values
538         private IList<Size> GetSupportedPreviewResolutions()
539         {
540             List<Size> previewResolutions = new List<Size>();
541
542             NativeCapabilities.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) =>
543             {
544                 previewResolutions.Add(new Size(width, height));
545                 return true;
546             };
547             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
548                 "Failed to get the supported preview resolutions");
549
550             return previewResolutions.AsReadOnly();
551         }
552
553         private IList<Size> GetSupportedCaptureResolutions()
554         {
555             List<Size> cameraResolutions = new List<Size>();
556
557             NativeCapabilities.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) =>
558             {
559                 cameraResolutions.Add(new Size(width, height));
560                 return true;
561             };
562             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero),
563                 "Failed to get the supported capture resolutions");
564
565             return cameraResolutions.AsReadOnly();
566         }
567
568         private IList<CameraPixelFormat> GetSupportedCapturePixelFormats()
569         {
570             List<CameraPixelFormat> captureFormats = new List<CameraPixelFormat>();
571
572             NativeCapabilities.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
573             {
574                 captureFormats.Add(format);
575                 return true;
576             };
577             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
578                 "Failed to get the supported capture formats.");
579
580             return captureFormats.AsReadOnly();
581         }
582
583         private IList<CameraPixelFormat> GetSupportedPreviewPixelFormats()
584         {
585             List<CameraPixelFormat> previewFormats = new List<CameraPixelFormat>();
586
587             NativeCapabilities.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) =>
588             {
589                 previewFormats.Add(format);
590                 return true;
591             };
592             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero),
593                 "Failed to get the supported preview formats.");
594
595             return previewFormats.AsReadOnly();
596         }
597
598         private IList<CameraFps> GetSupportedPreviewFps()
599         {
600             List<CameraFps> previewFps = new List<CameraFps>();
601
602             NativeCapabilities.FpsCallback callback = (CameraFps fps, IntPtr userData) =>
603             {
604                 previewFps.Add(fps);
605                 return true;
606             };
607             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero),
608                 "Failed to get the supported camera fps");
609
610             return previewFps.AsReadOnly();
611         }
612
613         private IList<CameraFps> GetSupportedPreviewFpsByResolutions(int width, int height)
614         {
615             List<CameraFps> fpsByResolution = new List<CameraFps>();
616
617             NativeCapabilities.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) =>
618             {
619                 fpsByResolution.Add(fps);
620                 return true;
621             };
622             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFpsByResolution(_camera.GetHandle(),
623                 width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions.");
624
625             return fpsByResolution.AsReadOnly();
626         }
627
628         private IList<CameraAutoFocusMode> GetSupportedAutoFocusModes()
629         {
630             List<CameraAutoFocusMode> autoFocusModes = new List<CameraAutoFocusMode>();
631
632             NativeCapabilities.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) =>
633             {
634                 autoFocusModes.Add(mode);
635                 return true;
636             };
637             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedAutoFocusModes(_camera.GetHandle(), callback, IntPtr.Zero),
638             "Failed to get the supported Auto focus modes.");
639
640             return autoFocusModes.AsReadOnly();
641         }
642
643         private IList<CameraExposureMode> GetSupportedExposureModes()
644         {
645             List<CameraExposureMode> exposureModes = new List<CameraExposureMode>();
646
647             NativeCapabilities.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) =>
648             {
649                 exposureModes.Add(mode);
650                 return true;
651             };
652             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero),
653             "Failed to get the supported Exposure modes.");
654
655             return exposureModes.AsReadOnly();
656         }
657
658         private IList<CameraIsoLevel> GetSupportedIsoLevels()
659         {
660             List<CameraIsoLevel> isoLevels = new List<CameraIsoLevel>();
661
662             NativeCapabilities.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) =>
663             {
664                 isoLevels.Add(iso);
665                 return true;
666             };
667             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero),
668             "Failed to get the supported Iso levels.");
669
670             return isoLevels.AsReadOnly();
671         }
672
673         private IList<CameraTheaterMode> GetSupportedTheaterModes()
674         {
675             List<CameraTheaterMode> theaterModes = new List<CameraTheaterMode>();
676
677             NativeCapabilities.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) =>
678             {
679                 theaterModes.Add(theaterMode);
680                 return true;
681             };
682             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero),
683             "Failed to get the supported theater modes.");
684
685             return theaterModes.AsReadOnly();
686         }
687
688         private IList<CameraWhiteBalance> GetSupportedWhitebalances()
689         {
690             List<CameraWhiteBalance> whitebalances = new List<CameraWhiteBalance>();
691
692             NativeCapabilities.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) =>
693             {
694                 whitebalances.Add(whiteBalance);
695                 return true;
696             };
697             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero),
698             "Failed to get the supported white balance.");
699
700             return whitebalances.AsReadOnly();
701         }
702
703         private IList<CameraFlashMode> GetSupportedFlashModes()
704         {
705             List<CameraFlashMode> flashModes = new List<CameraFlashMode>();
706
707             NativeCapabilities.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) =>
708             {
709                 flashModes.Add(flashMode);
710                 return true;
711             };
712             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero),
713             "Failed to get the supported flash modes.");
714
715             return flashModes.AsReadOnly();
716         }
717
718         private IList<CameraSceneMode> GetSupportedSceneModes()
719         {
720             List<CameraSceneMode> sceneModes = new List<CameraSceneMode>();
721
722             NativeCapabilities.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) =>
723             {
724                 sceneModes.Add(sceneMode);
725                 return true;
726             };
727             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero),
728             "Failed to get the supported scene modes.");
729
730             return sceneModes.AsReadOnly();
731         }
732
733         private IList<CameraEffectMode> GetSupportedEffects()
734         {
735             List<CameraEffectMode> effectModes = new List<CameraEffectMode>();
736
737             NativeCapabilities.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) =>
738             {
739                 effectModes.Add(effect);
740                 return true;
741             };
742             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero),
743             "Failed to get the supported camera effects.");
744
745             return effectModes.AsReadOnly();
746         }
747
748         private IList<Rotation> GetSupportedStreamRotations()
749         {
750             List<Rotation> streamRotations = new List<Rotation>();
751
752             NativeCapabilities.StreamRotationCallback callback = (Rotation streamRotation, IntPtr userData) =>
753             {
754                 streamRotations.Add(streamRotation);
755                 return true;
756             };
757             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero),
758             "Failed to get the supported camera rotations.");
759
760             return streamRotations.AsReadOnly();
761         }
762
763         private IList<Flips> GetSupportedStreamFlips()
764         {
765             List<Flips> streamFlips = new List<Flips>();
766
767             NativeCapabilities.StreamFlipCallback callback = (Flips streamFlip, IntPtr userData) =>
768             {
769                 streamFlips.Add(streamFlip);
770                 return true;
771             };
772             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero),
773             "Failed to get the supported camera flips.");
774
775             return streamFlips.AsReadOnly();
776         }
777
778         private IList<CameraPtzType> GetSupportedPtzTypes()
779         {
780             List<CameraPtzType> ptzTypes = new List<CameraPtzType>();
781
782             NativeCapabilities.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) =>
783             {
784                 ptzTypes.Add(ptzType);
785                 return true;
786             };
787             CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero),
788             "Failed to get the supported Ptz types.");
789
790             return ptzTypes.AsReadOnly();
791         }
792         #endregion Methods for getting supported values
793     }
794 }