[Recorder] Change recorder feature (#32)
authorhsgwon <haesu.gwon@samsung.com>
Tue, 16 Jan 2018 08:40:52 +0000 (17:40 +0900)
committerGitHub <noreply@github.com>
Tue, 16 Jan 2018 08:40:52 +0000 (17:40 +0900)
src/Tizen.Multimedia.Recorder/Recorder/AudioRecorder.cs
src/Tizen.Multimedia.Recorder/Recorder/Recorder.Capabilities.cs
src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs [new file with mode: 0644]
src/Tizen.Multimedia.Recorder/Recorder/VideoRecorder.Capabilities.cs
src/Tizen.Multimedia.Recorder/Recorder/VideoRecorder.cs [changed mode: 0755->0644]

index d265440..41d154a 100644 (file)
@@ -28,6 +28,11 @@ namespace Tizen.Multimedia
     {
         private static NativeHandle CreateHandle()
         {
+            if (!Features.IsSupported(RecorderFeatures.AudioRecorder))
+            {
+                throw new NotSupportedException("Audio Recorder is not supported.");
+            }
+
             Native.Create(out var handle).ThrowIfError("Failed to create Audio recorder");
 
             return handle;
@@ -49,7 +54,7 @@ namespace Tizen.Multimedia
         /// </summary>
         /// <param name="audioCodec">The codec for audio encoding.</param>
         /// <param name="fileFormat">The format of result file.</param>
-        /// <feature>http://tizen.org/feature/microphone</feature>
+        /// <feature>http://tizen.org/feature/media.audio_recording</feature>
         /// <exception cref="InvalidOperationException">An internal error occurred.</exception>
         /// <exception cref="NotSupportedException">
         ///     A required feature is not supported.<br/>
index acd39c3..629c3c7 100644 (file)
@@ -69,6 +69,11 @@ namespace Tizen.Multimedia
 
         private static Capabilities LoadCapabilities()
         {
+            if (!Features.IsSupported(RecorderFeatures.AudioRecorder))
+            {
+                throw new NotSupportedException("Audio Recorder is not supported.");
+            }
+
             var ret = Native.Create(out var handle);
 
             if (ret == RecorderErrorCode.NotSupported)
@@ -87,12 +92,16 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets the file formats that the current device supports.
         /// </summary>
+        /// <feature>http://tizen.org/feature/media.audio_recording</feature>
+        /// <exception cref="NotSupportedException">A required feature is not supported.</exception>
         /// <since_tizen> 4 </since_tizen>
         public static IEnumerable<RecorderFileFormat> GetSupportedFileFormats() => Capabilities.Value.SupportedFileFormats;
 
         /// <summary>
         /// Gets the audio encoders that the current device supports.
         /// </summary>
+        /// <feature>http://tizen.org/feature/media.audio_recording</feature>
+        /// <exception cref="NotSupportedException">A required feature is not supported.</exception>
         /// <since_tizen> 4 </since_tizen>
         public static IEnumerable<RecorderAudioCodec> GetSupportedAudioCodecs() => Capabilities.Value.SupportedAudioCodecs;
 
diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs
new file mode 100644 (file)
index 0000000..4bb25cd
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Tizen.Multimedia
+{
+    internal static class RecorderFeatures
+    {
+        internal const string AudioRecorder = "http://tizen.org/feature/media.audio_recording";
+        internal const string VideoRecorder = "http://tizen.org/feature/media.video_recording";
+    }
+}
index 8932237..0194cf5 100644 (file)
@@ -47,6 +47,11 @@ namespace Tizen.Multimedia
 
         private static IEnumerable<Size> LoadVideoResolutions(CameraDevice device)
         {
+            if (!Features.IsSupported(RecorderFeatures.VideoRecorder))
+            {
+                throw new NotSupportedException("Video Recorder is not supported.");
+            }
+
             using (var camera = new Camera(device))
             {
                 Native.CreateVideo(camera.Handle, out var handle).ThrowIfError("Failed to get the resolutions");
@@ -61,7 +66,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets the video resolutions that the current device supports.
         /// </summary>
-        /// <feature>http://tizen.org/feature/camera</feature>
+        /// <feature>http://tizen.org/feature/media.video_recording</feature>
         /// <param name="device">The camera device to retrieve the supported resolutions.</param>
         /// <exception cref="NotSupportedException">A required feature is not supported.</exception>
         /// <exception cref="ArgumentException"><paramref name="device"/> is invalid.</exception>
@@ -88,7 +93,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets the video encoders that the current device supports.
         /// </summary>
-        /// <feature>http://tizen.org/feature/camera</feature>
+        /// <feature>http://tizen.org/feature/media.video_recording</feature>
         /// <exception cref="NotSupportedException">A required feature is not supported.</exception>
         /// <since_tizen> 4 </since_tizen>
         public static IEnumerable<RecorderVideoCodec> GetSupportedVideoCodecs()
old mode 100755 (executable)
new mode 100644 (file)
index ffe646b..bce649d
@@ -33,6 +33,11 @@ namespace Tizen.Multimedia
                 throw new ArgumentNullException(nameof(camera));
             }
 
+            if (!Features.IsSupported(RecorderFeatures.VideoRecorder))
+            {
+                throw new NotSupportedException("Video Recorder is not supported.");
+            }
+
             Native.CreateVideo(camera.Handle, out var handle).
                 ThrowIfError("Failed to create video recorder.");
 
@@ -64,7 +69,7 @@ namespace Tizen.Multimedia
         /// <param name="camera">The camera object.</param>
         /// <param name="videoCodec">The codec for video encoding.</param>
         /// <param name="fileFormat">The format of result file.</param>
-        /// <feature>http://tizen.org/feature/camera</feature>
+        /// <feature>http://tizen.org/feature/media.video_recording</feature>
         /// <exception cref="InvalidOperationException">An internal error occurred.</exception>
         /// <exception cref="NotSupportedException">
         ///     A required feature is not supported.<br/>
@@ -108,7 +113,7 @@ namespace Tizen.Multimedia
         /// <param name="videoCodec">The codec for video encoding.</param>
         /// <param name="audioCodec">The codec for audio encoding.</param>
         /// <param name="fileFormat">The format of result file.</param>
-        /// <feature>http://tizen.org/feature/camera</feature>
+        /// <feature>http://tizen.org/feature/media.video_recording</feature>
         /// <exception cref="InvalidOperationException">An internal error occurred.</exception>
         /// <exception cref="NotSupportedException">
         ///     A required feature is not supported.<br/>