2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 using System.Collections.Generic;
21 namespace Tizen.Multimedia
24 /// The camera setting class provides methods/properties to get and
25 /// set basic camera attributes.
27 public class RecorderFeatures
29 internal readonly Recorder _recorder = null;
31 private List<RecorderFileFormat> _fileFormats;
32 private List<RecorderAudioCodec> _audioCodec;
33 private List<RecorderVideoCodec> _videoCodec;
34 private List<Size> _videoResolution;
36 internal RecorderFeatures(Recorder recorder)
42 /// Retrieves all the file formats supported by the recorder.
45 /// It returns a list containing all the supported <see cref="RecorderFileFormat"/>.
47 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
48 public IEnumerable<RecorderFileFormat> SupportedFileFormats
52 if (_fileFormats == null)
56 _fileFormats = new List<RecorderFileFormat>();
58 Interop.RecorderFeatures.FileFormatCallback callback = (RecorderFileFormat format, IntPtr userData) =>
60 _fileFormats.Add(format);
63 RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.FileFormats(_recorder.GetHandle(), callback, IntPtr.Zero),
64 "Failed to get the supported fileformats");
78 /// Retrieves all the audio encoders supported by the recorder.
81 /// It returns a list containing all the supported <see cref="RecorderAudioCodec"/>.
83 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
84 public IEnumerable<RecorderAudioCodec> SupportedAudioEncodings
88 if (_audioCodec == null)
92 _audioCodec = new List<RecorderAudioCodec>();
94 Interop.RecorderFeatures.AudioEncoderCallback callback = (RecorderAudioCodec codec, IntPtr userData) =>
96 _audioCodec.Add(codec);
99 RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.AudioEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
100 "Failed to get the supported audio encoders");
114 /// Retrieves all the video encoders supported by the recorder.
117 /// It returns a list containing all the supported <see cref="RecorderVideoCodec"/>.
120 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
121 public IEnumerable<RecorderVideoCodec> SupportedVideoEncodings
125 if (_videoCodec == null)
129 _videoCodec = new List<RecorderVideoCodec>();
131 Interop.RecorderFeatures.VideoEncoderCallback callback = (RecorderVideoCodec codec, IntPtr userData) =>
133 _videoCodec.Add(codec);
136 RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
137 "Failed to get the supported video encoders");
151 /// Retrieves all the video resolutions supported by the recorder.
154 /// It returns videoresolution list containing the width and height of
155 /// different resolutions supported by recorder.
157 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
158 public IEnumerable<Size> SupportedVideoResolutions
162 if (_videoResolution == null)
166 _videoResolution = new List<Size>();
168 Interop.RecorderFeatures.VideoResolutionCallback callback = (int width, int height, IntPtr userData) =>
170 _videoResolution.Add(new Size(width, height));
173 RecorderErrorFactory.ThrowIfError(Interop.RecorderFeatures.VideoResolution(_recorder.GetHandle(), callback, IntPtr.Zero),
174 "Failed to get the supported video resolutions.");
178 _videoResolution = null;
183 return _videoResolution;