Merge "[Player] Added missing comments." into tizen
authorcoderhyme <jhyo.kim@samsung.com>
Thu, 13 Jul 2017 08:52:28 +0000 (08:52 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 13 Jul 2017 08:52:29 +0000 (08:52 +0000)
src/Tizen.Multimedia.Camera/Camera/Camera.cs
src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs
src/Tizen.Multimedia.MediaPlayer/Player/Player.cs
src/Tizen.Multimedia/Common/Display.cs

index 691f450..2092481 100755 (executable)
@@ -381,15 +381,9 @@ namespace Tizen.Multimedia
 
         private void ReplaceDisplay(Display newDisplay)
         {
-            if (_display != null)
-            {
-                _display.Owner = null;
-            }
+            _display?.SetOwner(null);
             _display = newDisplay;
-            if (_display != null)
-            {
-                _display.Owner = this;
-            }
+            _display?.SetOwner(this);
         }
 
         /// <summary>
@@ -416,17 +410,16 @@ namespace Tizen.Multimedia
             {
                 ValidateState(CameraState.Created);
 
-                if (value != null && value.Owner != null)
+                if (value?.Owner != null)
                 {
                     if (ReferenceEquals(this, value.Owner))
                     {
                         return;
                     }
-                    else
-                    {
-                        throw new ArgumentException("The display has already been assigned to another.");
-                    }
+
+                    throw new ArgumentException("The display has already been assigned to another.");
                 }
+
                 CameraErrorFactory.ThrowIfError(SetDisplay(value), "Failed to set the camera display");
 
                 ReplaceDisplay(value);
index f9a5157..1bd3cac 100644 (file)
@@ -17,7 +17,6 @@ using System.Diagnostics;
 
 namespace Tizen.Multimedia
 {
-    //TODO we need a better name.
     /// <summary>
     /// Represents data for a video frame captured.
     /// </summary>
index 36be442..814636d 100644 (file)
@@ -264,7 +264,6 @@ namespace Tizen.Multimedia
             {
                 ValidateNotDisposed();
 
-                //TODO is this needed?
                 if (IsPreparing())
                 {
                     return PlayerState.Preparing;
@@ -358,7 +357,6 @@ namespace Tizen.Multimedia
 
         private PlayerErrorCode SetDisplay(Display display)
         {
-            Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (display == null)
             {
                 Log.Info(PlayerLog.Tag, "set display to none");
@@ -370,15 +368,9 @@ namespace Tizen.Multimedia
 
         private void ReplaceDisplay(Display newDisplay)
         {
-            if (_display != null)
-            {
-                _display.Owner = null;
-            }
+            _display?.SetOwner(null);
             _display = newDisplay;
-            if (_display != null)
-            {
-                _display.Owner = this;
-            }
+            _display?.SetOwner(this);
         }
 
         /// <summary>
@@ -397,25 +389,20 @@ namespace Tizen.Multimedia
             }
             set
             {
-                Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 ValidatePlayerState(PlayerState.Idle);
 
-                if (value != null && value.Owner != null)
+                if (value?.Owner != null)
                 {
                     if (ReferenceEquals(this, value.Owner))
                     {
                         return;
                     }
-                    else
-                    {
-                        throw new ArgumentException("The display has already been assigned to another.");
-                    }
-                }
 
+                    throw new ArgumentException("The display has already been assigned to another.");
+                }
                 SetDisplay(value).ThrowIfFailed("Failed to set the display to the player");
 
                 ReplaceDisplay(value);
-                Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
             }
         }
 
@@ -816,13 +803,14 @@ namespace Tizen.Multimedia
             _source = null;
         }
 
-        //TODO remarks needs to be updated. see the native reference.
         /// <summary>
         /// Starts or resumes playback.
         /// </summary>
         /// <remarks>
         /// The player must be in the <see cref="PlayerState.Ready"/> or <see cref="PlayerState.Paused"/> state.
-        /// It has no effect if the player is already in the <see cref="PlayerState.Playing"/> state.
+        /// It has no effect if the player is already in the <see cref="PlayerState.Playing"/> state.\n
+        /// \n
+        /// Sound can be mixed with other sounds if you don't control the stream focus using <see cref="ApplyAudioStreamPolicy"/>.
         /// </remarks>
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
         /// <exception cref="InvalidOperationException">The player is not in the valid state.</exception>
@@ -830,6 +818,7 @@ namespace Tizen.Multimedia
         /// <seealso cref="Stop"/>
         /// <seealso cref="Pause"/>
         /// <seealso cref="PlaybackCompleted"/>
+        /// <seealso cref="ApplyAudioStreamPolicy"/>
         public virtual void Start()
         {
             Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
index 5fc22c3..d300c57 100644 (file)
@@ -86,10 +86,18 @@ namespace Tizen.Multimedia
 
         private DisplayType Type { get; }
 
-        internal object Owner
+        private object _owner;
+
+        internal object Owner => _owner;
+
+        internal void SetOwner(object newOwner)
         {
-            get;
-            set;
+            if (_owner != null && newOwner != null)
+            {
+                throw new ArgumentException("The display has already been assigned to another.");
+            }
+
+            _owner = newOwner;
         }
 
         internal ErrorType ApplyTo<ErrorType>(IDisplayable<ErrorType> target)