[Multimedia] Modified a constructor of the Display class not to check the raw video... 99/164399/1 5.0.0-preview1-00416
authorcoderhyme <jhyo.kim@samsung.com>
Tue, 19 Dec 2017 04:03:47 +0000 (13:03 +0900)
committercoderhyme <jhyo.kim@samsung.com>
Tue, 19 Dec 2017 04:03:47 +0000 (13:03 +0900)
It is only valid in the Player and so checking the feature is now placed in the Display property of it.

Change-Id: I539fc1595ab81874a4850a900d5327de1ba70a21
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
src/Tizen.Multimedia.MediaPlayer/Player/Player.Events.cs
src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs
src/Tizen.Multimedia.MediaPlayer/Player/Player.cs
src/Tizen.Multimedia.MediaPlayer/Player/PlayerFeatures.cs [new file with mode: 0644]
src/Tizen.Multimedia/Common.Internal/Features.cs
src/Tizen.Multimedia/Common/Display.cs

index 559bcf4..e3ec8fd 100644 (file)
@@ -181,13 +181,13 @@ namespace Tizen.Multimedia
         {
             add
             {
-                ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
+                ValidationUtil.ValidateFeatureSupported(PlayerFeatures.RawVideo);
 
                 _videoFrameDecoded += value;
             }
             remove
             {
-                ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
+                ValidationUtil.ValidateFeatureSupported(PlayerFeatures.RawVideo);
 
                 _videoFrameDecoded -= value;
             }
index 70e66fa..0ea4cdd 100644 (file)
@@ -241,10 +241,15 @@ namespace Tizen.Multimedia
         /// Gets or sets the display.
         /// </summary>
         /// <value>A <see cref="Multimedia.Display"/> that specifies the display.</value>
-        /// <remarks>The player must be in the <see cref="PlayerState.Idle"/> state.</remarks>
+        /// <remarks>
+        ///     The player must be in the <see cref="PlayerState.Idle"/> state.<br/>
+        ///     The raw video feature(http://tizen.org/feature/multimedia.raw_video) is required if
+        ///     the display is created with <see cref="MediaView"/>.
+        /// </remarks>
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
         /// <exception cref="ArgumentException">The value has already been assigned to another player.</exception>
         /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
+        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <since_tizen> 3 </since_tizen>
         public Display Display
         {
@@ -256,6 +261,11 @@ namespace Tizen.Multimedia
             {
                 ValidatePlayerState(PlayerState.Idle);
 
+                if (value != null && value.HasMediaView)
+                {
+                    ValidationUtil.ValidateFeatureSupported(PlayerFeatures.RawVideo);
+                }
+
                 if (value?.Owner != null)
                 {
                     if (ReferenceEquals(this, value.Owner))
@@ -360,7 +370,7 @@ namespace Tizen.Multimedia
             {
                 if (_audioEffect == null)
                 {
-                    throw new NotSupportedException($"The feature({Features.AudioEffect}) is not supported.");
+                    throw new NotSupportedException($"The feature({PlayerFeatures.AudioEffect}) is not supported.");
                 }
 
                 return _audioEffect;
index ffb066b..c1670ac 100644 (file)
@@ -53,12 +53,12 @@ namespace Tizen.Multimedia
 
             RetrieveProperties();
 
-            if (Features.IsSupported(Features.AudioEffect))
+            if (Features.IsSupported(PlayerFeatures.AudioEffect))
             {
                 _audioEffect = new AudioEffect(this);
             }
 
-            if (Features.IsSupported(Features.RawVideo))
+            if (Features.IsSupported(PlayerFeatures.RawVideo))
             {
                 RegisterVideoFrameDecodedCallback();
             }
@@ -457,7 +457,7 @@ namespace Tizen.Multimedia
         /// <since_tizen> 3 </since_tizen>
         public async Task<CapturedFrame> CaptureVideoAsync()
         {
-            ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
+            ValidationUtil.ValidateFeatureSupported(PlayerFeatures.RawVideo);
 
             ValidatePlayerState(PlayerState.Playing, PlayerState.Paused);
 
diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerFeatures.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerFeatures.cs
new file mode 100644 (file)
index 0000000..a554d4d
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2016 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 PlayerFeatures
+    {
+        internal const string AudioEffect = "http://tizen.org/feature/multimedia.custom_audio_effect";
+        internal const string RawVideo = "http://tizen.org/feature/multimedia.raw_video";
+    }
+}
index 58b1ec6..e131789 100755 (executable)
@@ -20,14 +20,9 @@ namespace Tizen.Multimedia
 {
     internal static class Features
     {
-        internal const string AudioEffect = "http://tizen.org/feature/multimedia.custom_audio_effect";
-        internal const string RawVideo = "http://tizen.org/feature/multimedia.raw_video";
-
         internal static bool IsSupported(string featureKey)
         {
-            bool supported = false;
-            Information.TryGetValue(featureKey, out supported);
-            return supported;
+            return Information.TryGetValue(featureKey, out bool supported) && supported;
         }
 
     }
index dc1b0a3..3424027 100644 (file)
@@ -99,19 +99,17 @@ namespace Tizen.Multimedia
         /// Initializes a new instance of the <see cref="Display"/> class with a <see cref="MediaView"/> class.
         /// </summary>
         /// <param name="mediaView">A <see cref="MediaView"/> to display.</param>
-        /// <feature>http://tizen.org/feature/multimedia.raw_video</feature>
-        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
         /// <since_tizen> 3 </since_tizen>
         public Display(MediaView mediaView)
         {
-            ValidationUtil.ValidateFeatureSupported(Features.RawVideo);
-
             if (mediaView == null)
             {
                 throw new ArgumentNullException(nameof(mediaView));
             }
 
             _setter = new EvasDisplaySetter(DisplayType.Surface, mediaView);
+
+            HasMediaView = true;
         }
 
         /// <summary>
@@ -154,6 +152,8 @@ namespace Tizen.Multimedia
 
         private object _owner;
 
+        internal bool HasMediaView { get; } = false;
+
         internal object Owner => _owner;
 
         internal void SetOwner(object newOwner)