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;
20 using Native = Interop.RecorderFeatures;
22 namespace Tizen.Multimedia
25 /// The camera setting class provides methods/properties to get and
26 /// set basic camera attributes.
28 public class RecorderFeatures
30 internal readonly Recorder _recorder = null;
32 private List<RecorderFileFormat> _fileFormats;
33 private List<RecorderAudioCodec> _audioCodec;
34 private List<RecorderVideoCodec> _videoCodec;
35 private List<Size> _videoResolution;
37 internal RecorderFeatures(Recorder recorder)
43 /// Retrieves all the file formats supported by the recorder.
45 /// <since_tizen> 3 </since_tizen>
47 /// It returns a list containing all the supported <see cref="RecorderFileFormat"/>.
49 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
50 public IEnumerable<RecorderFileFormat> SupportedFileFormats
54 if (_fileFormats == null)
58 _fileFormats = new List<RecorderFileFormat>();
60 Native.FileFormatCallback callback = (RecorderFileFormat format, IntPtr userData) =>
62 _fileFormats.Add(format);
65 RecorderErrorFactory.ThrowIfError(Native.FileFormats(_recorder.GetHandle(), callback, IntPtr.Zero),
66 "Failed to get the supported fileformats");
80 /// Retrieves all the audio encoders supported by the recorder.
82 /// <since_tizen> 3 </since_tizen>
84 /// It returns a list containing all the supported <see cref="RecorderAudioCodec"/>.
86 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
87 public IEnumerable<RecorderAudioCodec> SupportedAudioEncodings
91 if (_audioCodec == null)
95 _audioCodec = new List<RecorderAudioCodec>();
97 Native.AudioEncoderCallback callback = (RecorderAudioCodec codec, IntPtr userData) =>
99 _audioCodec.Add(codec);
102 RecorderErrorFactory.ThrowIfError(Native.AudioEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
103 "Failed to get the supported audio encoders");
117 /// Retrieves all the video encoders supported by the recorder.
119 /// <since_tizen> 3 </since_tizen>
121 /// It returns a list containing all the supported <see cref="RecorderVideoCodec"/>.
124 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
125 public IEnumerable<RecorderVideoCodec> SupportedVideoEncodings
129 if (_videoCodec == null)
133 _videoCodec = new List<RecorderVideoCodec>();
135 Native.VideoEncoderCallback callback = (RecorderVideoCodec codec, IntPtr userData) =>
137 _videoCodec.Add(codec);
140 RecorderErrorFactory.ThrowIfError(Native.VideoEncoders(_recorder.GetHandle(), callback, IntPtr.Zero),
141 "Failed to get the supported video encoders");
155 /// Retrieves all the video resolutions supported by the recorder.
157 /// <since_tizen> 3 </since_tizen>
159 /// It returns videoresolution list containing the width and height of
160 /// different resolutions supported by recorder.
162 /// <exception cref="ObjectDisposedException">The camera already has been disposed.</exception>
163 public IEnumerable<Size> SupportedVideoResolutions
167 if (_videoResolution == null)
171 _videoResolution = new List<Size>();
173 Native.VideoResolutionCallback callback = (int width, int height, IntPtr userData) =>
175 _videoResolution.Add(new Size(width, height));
178 RecorderErrorFactory.ThrowIfError(Native.VideoResolution(_recorder.GetHandle(), callback, IntPtr.Zero),
179 "Failed to get the supported video resolutions.");
183 _videoResolution = null;
188 return _videoResolution;