Merge "[ThumbnailExtractor] redesigned apis." into tizen
authorcoderhyme <jhyo.kim@samsung.com>
Thu, 20 Jul 2017 07:05:51 +0000 (07:05 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 20 Jul 2017 07:05:51 +0000 (07:05 +0000)
24 files changed:
build/dependencies.props
src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs
src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs
src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj
src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs
src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerError.cs [moved from src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerErrorFactory.cs with 54% similarity]
src/Tizen.Multimedia.AudioIO/TonePlayer/ToneType.cs [moved from src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerEnums.cs with 99% similarity]
src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayer.cs
src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerError.cs [new file with mode: 0644]
src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerErrorFactory.cs [deleted file]
src/Tizen.Multimedia.Camera/Camera/Camera.cs
src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs
src/Tizen.Multimedia.MediaPlayer/Player/BufferingProgressChangedEventArgs.cs
src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs
src/Tizen.Multimedia.MediaPlayer/Player/Player.cs
src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs
src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs
src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs
src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs
src/Tizen.Multimedia.Util/ImageUtil/ImageDecoder.cs
src/Tizen.Multimedia.Util/ImageUtil/ImageEncoder.cs
src/Tizen.Multimedia.Util/ImageUtil/ImageTransformer.cs
src/Tizen.Multimedia.Util/ImageUtil/ImageUtil.cs
src/Tizen.Multimedia/Common/Display.cs

index 63364f7..4e3b829 100644 (file)
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TizenVersion>1.0.5</TizenVersion>
-    <ElmSharpVersion>1.2.0</ElmSharpVersion>
+    <ElmSharpVersion>1.2.1</ElmSharpVersion>
     <ApplicationsVersion>1.5.8</ApplicationsVersion>
     <SystemInfoVersion>1.0.4</SystemInfoVersion>
   </PropertyGroup>
index 17f8f0a..076a703 100644 (file)
@@ -23,10 +23,11 @@ internal static partial class Interop
     internal static partial class TonePlayer
     {
         [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_start_new")]
-        internal static extern int Start(ToneType tone, IntPtr streamInfoHandle, int durationMs, out int playerId);
+        internal static extern TonePlayerError Start(ToneType tone, IntPtr streamInfoHandle,
+            int durationMs, out int id);
 
         [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_stop")]
-        internal static extern int Stop(int PlayerId);
+        internal static extern TonePlayerError Stop(int id);
     }
 }
 
index 933b1de..a7f7a6e 100644 (file)
@@ -16,6 +16,7 @@
 
 using System;
 using System.Runtime.InteropServices;
+using Tizen.Multimedia;
 
 internal static partial class Interop
 {
@@ -25,10 +26,11 @@ internal static partial class Interop
         internal delegate void WavPlayerCompletedCallback(int playerId, IntPtr userData);
 
         [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_start_new")]
-        internal static extern int WavPlayerStart(string filePath, IntPtr streamInfoHandle, WavPlayerCompletedCallback completedCallback,
-                                                     IntPtr userData, out int playerId);
+        internal static extern WavPlayerError Start(string filePath, IntPtr streamInfoHandle,
+            WavPlayerCompletedCallback completedCallback, IntPtr userData, out int id);
 
         [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_stop")]
-        internal static extern int WavPlayerStop(int PlayerId);
+        internal static extern WavPlayerError Stop(int id);
     }
 }
+
index 79e0607..c2a17e2 100644 (file)
@@ -3,7 +3,7 @@
   <Import Project="../build/build.props" />
 
   <PropertyGroup>
-    <Version>1.0.0</Version>
+    <Version>1.0.1</Version>
     <Description>Provides the Multimedia AudioIO API for Tizen .NET</Description>
   </PropertyGroup>
 
index 091ba9c..51c92b4 100644 (file)
  */
 
 using System;
-using System.Runtime.InteropServices;
 using System.Threading;
 using System.Threading.Tasks;
 
 namespace Tizen.Multimedia
 {
-    static internal class TonePlayerLog
-    {
-        internal const string LogTag = "Tizen.Multimedia.TonePlayer";
-    }
-
     /// <summary>
-    /// The TonePlayer class allows you to play and stop playing the tone. To play a particular
-    /// type of tone <see cref="Tizen.Multimedia.ToneType"/>,
-    /// use <see cref="Tizen.Multimedia.TonePlayer.StartAsync"/>.
+    /// Provides the ability to play a tone.
     /// </summary>
     public static class TonePlayer
     {
         /// <summary>
         /// Plays a tone, asynchronously.
         /// </summary>
-        /// <param name="tone">The tone type to play.</param>
-        /// <param name="streamPolicy">The Audiostream policy object.</param>
-        /// <param name="durationMs">The tone duration in milliseconds. -1 indicates an infinite duration.</param>
+        /// <param name="tone">A <see cref="ToneType"/> to play.</param>
+        /// <param name="streamPolicy">A <see cref="AudioStreamPolicy"/>.</param>
+        /// <param name="durationMilliseconds">The tone duration in milliseconds. -1 indicates an infinite duration.</param>
+        /// <returns>A task that represents the asynchronous operation.</returns>
+        /// <exception cref="ArgumentException"><paramref name="tone"/> is invalid.</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="streamPolicy"/> is null.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="durationMilliseconds"/> is less than -1.</exception>
+        /// <exception cref="InvalidOperationException">Any invalid operations occurred.</exception>
+        /// <exception cref="NotSupportedException"><paramref name="tone"/> is not a supported type.</exception>
+        /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed.</exception>
+        public static Task StartAsync(ToneType tone, AudioStreamPolicy streamPolicy,
+            int durationMilliseconds)
+        {
+            return StartAsync(tone, streamPolicy, durationMilliseconds, CancellationToken.None);
+        }
+
+        /// <summary>
+        /// Plays a tone, asynchronously.
+        /// </summary>
+        /// <param name="tone">A <see cref="ToneType"/> to play.</param>
+        /// <param name="streamPolicy">A <see cref="AudioStreamPolicy"/>.</param>
+        /// <param name="durationMilliseconds">The tone duration in milliseconds. -1 indicates an infinite duration.</param>
         /// <param name="cancellationToken">The cancellation token which can be used to stop playing the tone.</param>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
-        /// <exception cref="ArgumentNullException">In case of null parameters</exception>
-        /// <exception cref="ArgumentOutOfRangeException">In case of play duration less than -1.</exception>
-        /// <exception cref="InvalidOperationException">In case of any invalid operations</exception>
-        /// <exception cref="NotSupportedException">In case of tone type not supported.</exception>
-        public static async Task StartAsync(ToneType tone, AudioStreamPolicy streamPolicy, int durationMs, CancellationToken cancellationToken = default(CancellationToken))
+        /// <returns>A task that represents the asynchronous operation.</returns>
+        /// <exception cref="ArgumentException"><paramref name="tone"/> is invalid.</exception>
+        /// <exception cref="ArgumentNullException"><paramref name="streamPolicy"/> is null.</exception>
+        /// <exception cref="ArgumentOutOfRangeException"><paramref name="durationMilliseconds"/> is less than -1.</exception>
+        /// <exception cref="InvalidOperationException">Any invalid operations occurred.</exception>
+        /// <exception cref="NotSupportedException"><paramref name="tone"/> is not a supported type.</exception>
+        /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed.</exception>
+        public static Task StartAsync(ToneType tone, AudioStreamPolicy streamPolicy,
+            int durationMilliseconds, CancellationToken cancellationToken)
         {
-            if (durationMs < -1)
+            if (durationMilliseconds < -1)
             {
-                throw new ArgumentOutOfRangeException(nameof(durationMs));
+                throw new ArgumentOutOfRangeException(nameof(durationMilliseconds), durationMilliseconds,
+                    $"{nameof(durationMilliseconds)} can't be less than -1.");
             }
 
             if (streamPolicy == null)
             {
                 throw new ArgumentNullException(nameof(streamPolicy));
+            }
+
+            ValidationUtil.ValidateEnum(typeof(ToneType), tone, nameof(tone));
 
+            if (cancellationToken.IsCancellationRequested)
+            {
+                return Task.FromCanceled(cancellationToken);
             }
 
-            if (Enum.IsDefined(typeof(ToneType), tone) == false)
+            return StartAsyncCore(tone, streamPolicy, durationMilliseconds, cancellationToken);
+        }
+
+        private static async Task StartAsyncCore(ToneType tone, AudioStreamPolicy streamPolicy,
+            int durationMilliseconds, CancellationToken cancellationToken)
+        {
+
+            var tcs = new TaskCompletionSource<bool>();
+
+            Interop.TonePlayer.Start(tone, streamPolicy.Handle, durationMilliseconds, out var id).
+                Validate("Failed to play tone.");
+
+            using (RegisterCancellationAction(tcs, cancellationToken, id))
             {
-                throw new ArgumentException("Invalid ToneType provided : " + tone);
+                await WaitForDuration(tcs, cancellationToken, durationMilliseconds);
+
+                await tcs.Task;
             }
+        }
 
-            int id;
-            var task = new TaskCompletionSource<int>();
-            int ret = Interop.TonePlayer.Start(tone, streamPolicy.Handle, durationMs, out id);
-            if (ret != (int)TonePlayerError.None)
+        private static async Task WaitForDuration(TaskCompletionSource<bool> tcs,
+            CancellationToken cancellationToken, int durationMilliseconds)
+        {
+            if (durationMilliseconds == -1)
             {
-                Log.Error(TonePlayerLog.LogTag, "Error Occured with error code: " + (TonePlayerError)ret);
-                throw TonePlayerErrorFactory.CreateException(ret, "Failed to play tone.");
+                return;
             }
 
-            if (cancellationToken != CancellationToken.None)
+            try
             {
-                cancellationToken.Register((playerId) =>
-                {
-                    int resultCancel = Interop.TonePlayer.Stop((int)playerId);
-                    if ((TonePlayerError)resultCancel != TonePlayerError.None)
-                    {
-                        Log.Error(TonePlayerLog.LogTag, "Failed to stop tone Player with error code: " + (TonePlayerError)resultCancel);
-                    }
-                    task.TrySetCanceled();
-                }, id);
+                await Task.Delay(durationMilliseconds, cancellationToken);
+                tcs.TrySetResult(true);
             }
+            catch (TaskCanceledException)
+            {
+            }
+        }
 
-            if (durationMs != -1)
+        private static IDisposable RegisterCancellationAction(TaskCompletionSource<bool> tcs,
+            CancellationToken cancellationToken, int id)
+        {
+            if (cancellationToken.CanBeCanceled == false)
             {
-                Task delayTask = Task.Delay(durationMs, cancellationToken);
-                await delayTask;
-                if (delayTask.IsCompleted)
-                {
-                    task.TrySetResult(id);
-                }
+                return null;
             }
-            await task.Task;
+
+            return cancellationToken.Register(() =>
+            {
+                Interop.TonePlayer.Stop(id).Validate("Failed to cancel");
+                tcs.TrySetCanceled();
+            });
         }
     }
 }
@@ -1,4 +1,4 @@
-/*
+/*
  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
@@ -28,43 +28,30 @@ namespace Tizen.Multimedia
         TypeNotSupported = TizenErrorTonePlayer | 0x01
     }
 
-    internal static class TonePlayerErrorFactory
+    internal static class TonePlayerErrorExtensions
     {
-        internal static Exception CreateException(int errorCode, string errorMessage)
+        internal static void Validate(this TonePlayerError error, string message)
         {
-            TonePlayerError err = (TonePlayerError)errorCode;
-            Exception exp;
-            if (string.IsNullOrEmpty(errorMessage))
+            if (error == TonePlayerError.None)
             {
-                errorMessage = err.ToString();
+                return;
             }
 
-            switch ((TonePlayerError)errorCode)
+            switch (error)
             {
                 case TonePlayerError.InvalidParameter:
-                    {
-                        exp = new ArgumentException(errorMessage + "Invalid parameters provided");
-                        break;
-                    }
+                    throw new ArgumentException(message);
 
                 case TonePlayerError.TypeNotSupported:
-                    {
-                        exp = new NotSupportedException(errorMessage + "Not Supported");
-                        break;
-                    }
+                    throw new NotSupportedException(message);
 
                 case TonePlayerError.InvalidOperation:
-                    {
-                        exp = new InvalidOperationException(errorMessage + "Invalid Operation");
-                        break;
-                    }
+                    throw new InvalidOperationException(message);
+
                 default:
-                    {
-                        exp = new InvalidOperationException(errorMessage);
-                        break;
-                    }
+                    throw new InvalidOperationException(message);
+
             }
-            return exp;
         }
     }
 }
@@ -14,8 +14,6 @@
  * limitations under the License.
  */
 
-using System;
-
 namespace Tizen.Multimedia
 {
     /// <summary>
@@ -72,7 +70,7 @@ namespace Tizen.Multimedia
         /// </summary>
         DtmfS,
         /// <summary>
-        /// Predefined DTMF sharP (#).
+        /// Predefined DTMF sharp (#).
         /// </summary>
         DtmfP,
         /// <summary>
index ad27fce..954d6f3 100644 (file)
  */
 
 using System;
-using System.Runtime.InteropServices;
+using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
 
 namespace Tizen.Multimedia
 {
-    static internal class WavPlayerLog
-    {
-        internal const string LogTag = "Tizen.Multimedia.WavPlayer";
-    }
-
     /// <summary>
-    /// The WavPlayer class allows you to simply play and stop a wav file. To play a certain
-    /// wav file, call <see cref="Tizen.Multimedia.WavPlayer.StartAsync"/> with
-    /// a path to the .wav file.
+    /// Provides the ability to play a wav file.
     /// </summary>
     public static class WavPlayer
     {
         /// <summary>
-        /// Plays a WAV file with the stream information of AudioManager, asynchronously.
+        /// Plays a wav file based on the specified <see cref="AudioStreamPolicy"/>.
         /// </summary>
-        /// <param name="inputFilePath">The file path to play.</param>
-        /// <param name="streamPolicy">The Audiostream policy object.</param>
-        /// <param name="cancellationToken">The cancellation token which can be used to stop the Wav Player.</param>
-        /// <returns>The WAV player ID.</returns>
-        /// <exception cref="ArgumentException">In case of invalid parameters</exception>
-        /// <exception cref="ArgumentNullException">In case of null parameters</exception>
-        /// <exception cref="InvalidOperationException">In case of any invalid operations</exception>
-        /// <exception cref="NotSupportedException">In case of format not supported.</exception>
-        public static async Task StartAsync(string inputFilePath, AudioStreamPolicy streamPolicy, CancellationToken cancellationToken = default(CancellationToken))
+        /// <returns>A task that represents the asynchronous operation.</returns>
+        /// <param name="path">A file path to play.</param>
+        /// <param name="streamPolicy">A <see cref="AudioStreamPolicy"/>.</param>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="path"/> is null.
+        ///     <para>-or-</para>
+        ///     <paramref name="streamPolicy"/> is null.
+        /// </exception>
+        /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+        /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exists.</exception>
+        /// <exception cref="FileFormatException">The format of <paramref name=""/> is not supported.</exception>
+        /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed of.</exception>
+        public static Task StartAsync(string path, AudioStreamPolicy streamPolicy)
         {
-            int id;
-            var task = new TaskCompletionSource<int>();
+            return StartAsync(path, streamPolicy, CancellationToken.None);
+        }
 
-            if (String.IsNullOrEmpty(inputFilePath))
+        /// <summary>
+        /// Plays a wav file based on the specified <see cref="AudioStreamPolicy"/>.
+        /// </summary>
+        /// <returns>A task that represents the asynchronous operation.</returns>
+        /// <param name="path">A file path to play.</param>
+        /// <param name="streamPolicy">A <see cref="AudioStreamPolicy"/>.</param>
+        /// <param name="cancellationToken">A cancellation token which can be used to stop.</param>
+        /// <exception cref="ArgumentNullException">
+        ///     <paramref name="path"/> is null.
+        ///     <para>-or-</para>
+        ///     <paramref name="streamPolicy"/> is null.
+        /// </exception>
+        /// <exception cref="InvalidOperationException">An internal error occurs.</exception>
+        /// <exception cref="FileNotFoundException"><paramref name="path"/> does not exists.</exception>
+        /// <exception cref="FileFormatException">The format of <paramref name=""/> is not supported.</exception>
+        /// <exception cref="ObjectDisposedException"><paramref name="streamPolicy"/> has already been disposed.</exception>
+        public static Task StartAsync(string path, AudioStreamPolicy streamPolicy,
+            CancellationToken cancellationToken)
+        {
+            if (path == null)
             {
-                throw new ArgumentNullException(nameof(inputFilePath));
+                throw new ArgumentNullException(nameof(path));
             }
 
             if (streamPolicy == null)
@@ -59,34 +75,44 @@ namespace Tizen.Multimedia
                 throw new ArgumentNullException(nameof(streamPolicy));
             }
 
-            Interop.WavPlayer.WavPlayerCompletedCallback _playerCompletedCallback = (int playerId, IntPtr userData) =>
+            if (File.Exists(path) == false)
             {
-                task.TrySetResult(playerId);
-            };
-            GCHandle callbackHandle = GCHandle.Alloc(_playerCompletedCallback);
+                throw new FileNotFoundException("File does not exists.", path);
+            }
 
-            int ret = Interop.WavPlayer.WavPlayerStart(inputFilePath, streamPolicy.Handle, _playerCompletedCallback, IntPtr.Zero, out id);
-            if (ret != (int)WavPlayerError.None)
+            return cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) :
+                StartAsyncCore(path, streamPolicy, cancellationToken);
+        }
+
+        private static async Task StartAsyncCore(string path, AudioStreamPolicy streamPolicy,
+            CancellationToken cancellationToken)
+        {
+            var tcs = new TaskCompletionSource<bool>();
+
+            Interop.WavPlayer.WavPlayerCompletedCallback cb = (id_, _) => tcs.TrySetResult(true);
+
+            Interop.WavPlayer.Start(path, streamPolicy.Handle, cb, IntPtr.Zero, out var id).
+                Validate("Failed to play.");
+
+            using (RegisterCancellationAction(tcs, cancellationToken, id))
             {
-                Log.Error(WavPlayerLog.LogTag, "Error Occured with error code: " + (WavPlayerError)ret);
-                task.TrySetException(WavPlayerErrorFactory.CreateException(ret, "Failed to play Wav file."));
+                await tcs.Task;
             }
+        }
 
-            if (cancellationToken != CancellationToken.None)
+        private static IDisposable RegisterCancellationAction(TaskCompletionSource<bool> tcs,
+            CancellationToken cancellationToken, int id)
+        {
+            if (cancellationToken.CanBeCanceled == false)
             {
-                cancellationToken.Register((playerId) =>
-                {
-                    int resultCancel = Interop.WavPlayer.WavPlayerStop((int)playerId);
-                    if ((WavPlayerError)resultCancel != WavPlayerError.None)
-                    {
-                        Log.Error(WavPlayerLog.LogTag, "Failed to stop Wav Player with error code: " + (WavPlayerError)resultCancel);
-                    }
-                    task.TrySetCanceled();
-                }, id);
+                return null;
             }
 
-            await task.Task;
-            callbackHandle.Free();
+            return cancellationToken.Register(() =>
+            {
+                Interop.WavPlayer.Stop(id).Validate("Failed to cancel");
+                tcs.TrySetCanceled();
+            });
         }
     }
 }
diff --git a/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerError.cs b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerError.cs
new file mode 100644 (file)
index 0000000..cde5fd3
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+using System;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+    internal enum WavPlayerError
+    {
+        None = ErrorCode.None,
+        InvalidParameter = ErrorCode.InvalidParameter,
+        InvalidOperation = ErrorCode.InvalidOperation,
+        TizenErrorWavPlayer = -0x01990000,
+        FormatNotSupported = TizenErrorWavPlayer | 0x01,
+        NotSupportedType = TizenErrorWavPlayer | 0x02
+    }
+
+    internal static class WavPlayerErrorExtensions
+    {
+        internal static void Validate(this WavPlayerError error, string message)
+        {
+            if (error == WavPlayerError.None)
+            {
+                return;
+            }
+
+            switch (error)
+            {
+                case WavPlayerError.InvalidParameter:
+                    throw new ArgumentException(message);
+
+                case WavPlayerError.FormatNotSupported:
+
+                case WavPlayerError.NotSupportedType:
+                    throw new NotSupportedException(message);
+
+                case WavPlayerError.InvalidOperation:
+                    throw new InvalidOperationException(message);
+            }
+        }
+    }
+
+}
diff --git a/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerErrorFactory.cs b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerErrorFactory.cs
deleted file mode 100644 (file)
index 435a127..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Tizen.Internals.Errors;
-
-namespace Tizen.Multimedia
-{
-    internal enum WavPlayerError
-    {
-        None = ErrorCode.None,
-        InvalidParameter = ErrorCode.InvalidParameter,
-        InvalidOperation = ErrorCode.InvalidOperation,
-        TizenErrorWavPlayer = -0x01990000,
-        FormatNotSupported = TizenErrorWavPlayer | 0x01,
-        NotSupportedType = TizenErrorWavPlayer | 0x02
-    }
-
-    internal static class WavPlayerErrorFactory
-    {
-        internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null)
-        {
-            WavPlayerError err = (WavPlayerError)errorCode;
-            if (string.IsNullOrEmpty(errorMessage))
-            {
-                errorMessage = err.ToString();
-            }
-
-            switch ((WavPlayerError)errorCode)
-            {
-                case WavPlayerError.InvalidParameter:
-                    throw new ArgumentException(errorMessage, paramName);
-
-                case WavPlayerError.FormatNotSupported:
-                case WavPlayerError.NotSupportedType:
-                    throw new NotSupportedException(errorMessage);
-
-                case WavPlayerError.InvalidOperation:
-                    throw new InvalidOperationException(errorMessage);
-            }
-        }
-
-        internal static Exception CreateException(int errorCode, string errorMessage)
-        {
-            WavPlayerError err = (WavPlayerError)errorCode;
-            Exception exp;
-            if (string.IsNullOrEmpty(errorMessage))
-            {
-                errorMessage = err.ToString();
-            }
-
-            switch ((WavPlayerError)errorCode)
-            {
-                case WavPlayerError.InvalidParameter:
-                    {
-                        exp = new ArgumentException(errorMessage + "Invalid parameters provided");
-                        break;
-                    }
-
-                case WavPlayerError.FormatNotSupported:
-                case WavPlayerError.NotSupportedType:
-                    {
-                        exp = new NotSupportedException(errorMessage + "Not Supported");
-                        break;
-                    }
-
-                case WavPlayerError.InvalidOperation:
-                    {
-                        exp = new InvalidOperationException(errorMessage + "Invalid Operation");
-                        break;
-                    }
-                default:
-                    {
-                        exp = new InvalidOperationException(errorMessage);
-                        break;
-                    }
-            }
-            return exp;
-        }
-    }
-}
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 a9ca7e9..9890398 100644 (file)
@@ -103,7 +103,10 @@ namespace Tizen.Multimedia
             Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
         }
 
-        public int Count{ get; }
+        /// <summary>
+        /// Get the number of items.
+        /// </summary>
+        public int Count { get; }
 
         /// <summary>
         /// Get the band level range of the bands in dB.
index 57c6e15..d7d88a8 100644 (file)
@@ -22,6 +22,10 @@ namespace Tizen.Multimedia
     /// </summary>
     public class BufferingProgressChangedEventArgs : EventArgs
     {
+        /// <summary>
+        /// Initializes a new instance of the BufferingProgressChangedEventArgs class.
+        /// </summary>
+        /// <param name="percent">The value indicating the buffering percentage.</param>
         public BufferingProgressChangedEventArgs(int percent)
         {
             Percent = percent;
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 ea85757..814636d 100644 (file)
@@ -151,6 +151,11 @@ namespace Tizen.Multimedia
             _callbackRegistered = true;
         }
 
+        /// <summary>
+        /// Gets the native handle of the player.
+        /// </summary>
+        /// <value>An IntPtr that contains the native handle of the player.</value>
+        /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
         public IntPtr Handle
         {
             get
@@ -259,7 +264,6 @@ namespace Tizen.Multimedia
             {
                 ValidateNotDisposed();
 
-                //TODO is this needed?
                 if (IsPreparing())
                 {
                     return PlayerState.Preparing;
@@ -353,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");
@@ -365,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>
@@ -392,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);
             }
         }
 
@@ -506,6 +498,9 @@ namespace Tizen.Multimedia
         #region Dispose support
         private bool _disposed;
 
+        /// <summary>
+        /// Releases all resources used by the current instance.
+        /// </summary>
         public void Dispose()
         {
             Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
@@ -578,8 +573,9 @@ namespace Tizen.Multimedia
         }
 
         /// <summary>
-        /// Get Streaming download Progress.
+        /// Gets the streaming download Progress.
         /// </summary>
+        /// <returns>The <see cref="DownloadProgress"/> containing current download progress.</returns>
         /// <remarks>The player must be in the <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="InvalidOperationException">
         ///     The player is not streaming.\n
@@ -693,6 +689,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Sets the offset for the subtitle.
         /// </summary>
+        /// <param name="offset">The value indicating a desired offset in milliseconds.</param>
         /// <remarks>The player must be in the <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
         /// <exception cref="InvalidOperationException">
@@ -731,6 +728,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Prepares the media player for playback, asynchronously.
         /// </summary>
+        /// <returns>A task that represents the asynchronous prepare operation.</returns>
         /// <remarks>To prepare the player, the player must be in the <see cref="PlayerState.Idle"/> state,
         ///     and a source must be set.</remarks>
         /// <exception cref="InvalidOperationException">No source is set.</exception>
@@ -805,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>
@@ -819,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);
@@ -919,6 +919,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Captures a video frame asynchronously.
         /// </summary>
+        /// <returns>A task that represents the asynchronous capture operation.</returns>
         /// <feature>http://tizen.org/feature/multimedia.raw_video</feature>
         /// <remarks>The player must be in the <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
index 9b25a5f..9b5faae 100644 (file)
@@ -76,7 +76,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets or sets the value indicating whether the display is visible.
         /// </summary>
-        /// <value></value>
+        /// <value>true if the display is visible; otherwise false.</value>
         /// <exception cref="InvalidOperationException">
         ///     The display is not assigned.\n
         ///     -or-\n
@@ -144,6 +144,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Sets the roi(region of interest).
         /// </summary>
+        /// <param name="roi">The region.</param>
         /// <remarks>
         /// To set roi, <see cref="Mode"/> must be set to <see cref="PlayerDisplayMode.Roi"/> first.
         /// </remarks>
index 9ebdcf6..18ad88e 100644 (file)
@@ -25,25 +25,112 @@ namespace Tizen.Multimedia
     /// <seealso cref="PlayerErrorOccurredEventArgs"/>
     public enum PlayerError
     {
+        /// <summary>
+        /// File does not exists.
+        /// </summary>
         NoSuchFile = ErrorCode.NoSuchFile,
+
+        /// <summary>
+        /// Internal error.
+        /// </summary>
         InternalError = ErrorCode.InvalidOperation,
+
+        /// <summary>
+        /// No space.
+        /// </summary>
         NoSpaceOnDevice = PlayerErrorCode.NoSpaceOnDevice,
+
+        //TODO must be removed.
+        /// <summary>
+        /// Not supported.
+        /// </summary>
         FeatureNotSupported = ErrorCode.NotSupported,
+
+        //TODO must be removed.
+        /// <summary>
+        /// Permission denined.
+        /// </summary>
         PermissionDenied = ErrorCode.PermissionDenied,
+
+        /// <summary>
+        /// Not enough buffer.
+        /// </summary>
         BufferSpace = ErrorCode.BufferSpace,
+
+        /// <summary>
+        /// <see cref="Player.SetPlayPositionAsync(int, bool)/> failed.
+        /// </summary>
         SeekFailed = PlayerErrorCode.SeekFailed,
+
+        /// <summary>
+        /// Invalid state.
+        /// </summary>
         InvalidState = PlayerErrorCode.InvalidState,
+
+        /// <summary>
+        /// Not supported file.
+        /// </summary>
         NotSupportedFile = PlayerErrorCode.NotSupportedFile,
+
+        /// <summary>
+        /// Invalid uri.
+        /// </summary>
         InvalidUri = PlayerErrorCode.InvalidUri,
+
+        //TODO must be removed.
+        /// <summary>
+        /// Sound policy error.
+        /// </summary>
         SoundPolicy = PlayerErrorCode.SoundPolicyError,
+
+        /// <summary>
+        /// Connection to service failed.
+        /// </summary>
         ConnectionFailed = PlayerErrorCode.ConnectionFailed,
+
+        // TODO must be removed.
+        /// <summary>
+        /// Capture failed.
+        /// </summary>
         VideoCaptureFailed = PlayerErrorCode.VideoCaptureFailed,
+
+        // TODO must be removed.
+        /// <summary>
+        /// DRM expired.
+        /// </summary>
         DrmExpired = PlayerErrorCode.DrmExpired,
+
+        // TODO must be removed.
+        /// <summary>
+        /// No license of DRM.
+        /// </summary>
         DrmNoLicense = PlayerErrorCode.DrmNoLicense,
+
+        // TODO must be removed.
+        /// <summary>
+        /// Not used.
+        /// </summary>
         DrmFutureUse = PlayerErrorCode.DrmFutureUse,
+
+        /// <summary>
+        /// Not permitted DRM.
+        /// </summary>
         DrmNotPermitted = PlayerErrorCode.DrmNotPermitted,
+
+        // TODO must be removed.
+        /// <summary>
+        /// Not enough resource.
+        /// </summary>
         ResourceLimit = PlayerErrorCode.ResourceLimit,
+
+        /// <summary>
+        /// Service disconnected.
+        /// </summary>
         ServiceDisconnected = PlayerErrorCode.ServiceDisconnected,
+
+        /// <summary>
+        /// Not supported subtitle file.
+        /// </summary>
         SubtitleNotSupported = PlayerErrorCode.NotSupportedSubtitle,
     }
 
index 26da7d0..daa33bd 100644 (file)
@@ -27,6 +27,9 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Initialize a new instance of the AudioStreamProperties struct with the specified sample rate, channels and bit rate.
         /// </summary>
+        /// <param name="sampleRate">The sample rate of the stream.</param>
+        /// <param name="channels">The number of channels of the stream.</param>
+        /// <param name="bitRate">The bit rate of the stream.</param>
         public AudioStreamProperties(int sampleRate, int channels, int bitRate)
         {
             SampleRate = sampleRate;
@@ -76,6 +79,9 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Initialize a new instance of the VideoStreamProperties struct with the specified fps, bit rate and size.
         /// </summary>
+        /// <param name="fps">The fps of the stream.</param>
+        /// <param name="bitRate">The bit rate of the stream.</param>
+        /// <param name="size">The size of the stream.</param>
         public VideoStreamProperties(int fps, int bitRate, Size size)
         {
             Fps = fps;
@@ -87,6 +93,10 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Initialize a new instance of the VideoStreamProperties struct with the specified fps, bit rate, width and height.
         /// </summary>
+        /// <param name="fps">The fps of the stream.</param>
+        /// <param name="bitRate">The bit rate of the stream.</param>
+        /// <param name="width">The width of the stream.</param>
+        /// <param name="height">The height of the stream.</param>
         public VideoStreamProperties(int fps, int bitRate, int width, int height)
         {
             Fps = fps;
@@ -141,6 +151,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Retrieves the album art of the stream or null if there is no album art data.
         /// </summary>
+        /// <returns>Raw byte array if album art exists; otherwise null.</returns>
         /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
         /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
@@ -194,6 +205,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Retrieves the codec name of audio or null if there is no audio.
         /// </summary>
+        /// <returns>A string that represents codec name.</returns>
         public string GetAudioCodec()
         {
             return GetCodecInfo(true);
@@ -202,6 +214,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Retrieves the codec name of video or null if there is no video.
         /// </summary>
+        /// <returns>A string that represents codec name.</returns>
         public string GetVideoCodec()
         {
             return GetCodecInfo(false);
@@ -210,6 +223,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets the duration.
         /// </summary>
+        /// <returns>The duration of the stream.</returns>
         /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
         /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
@@ -228,6 +242,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets the properties of audio.
         /// </summary>
+        /// <returns>A <see cref="AudioStreamProperties"/> that contains audio stream information.</returns>
         /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
         /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
@@ -250,6 +265,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets the properties of video.
         /// </summary>
+        /// <returns>A <see cref="VideoStreamProperties"/> that contains video stream information.</returns>
         /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
         /// <exception cref="InvalidOperationException">The <see cref="Multimedia.Player"/> that this instance belongs to is not in the valid state.</exception>
@@ -284,6 +300,7 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Gets the metadata with the specified key.
         /// </summary>
+        /// <returns>A string that represents the value of the specified key.</returns>
         /// <param name="key">The key to query.</param>
         /// <remarks>The <see cref="Multimedia.Player"/> that owns this instance must be in the <see cref="PlayerState.Ready"/>, <see cref="PlayerState.Playing"/> or <see cref="PlayerState.Paused"/> state.</remarks>
         /// <exception cref="ObjectDisposedException">The <see cref="Multimedia.Player"/> that this instance belongs to has been disposed.</exception>
index 9ef7bd3..63fee48 100644 (file)
@@ -163,15 +163,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>
index ce0b612..26ff7ce 100644 (file)
@@ -64,6 +64,7 @@ namespace Tizen.Multimedia.Util
         /// <summary>
         /// Sets the color-space to decode into. The default is <see cref="ColorSpace.Rgba8888"/>.
         /// </summary>
+        /// <param name="colorSpace">The value indicating color-space to decode into.</param>
         /// <exception cref="ArgumentException"><paramref name="colorSpace"/> is invalid.</exception>
         /// <exception cref="NotSupportedException"><paramref name="colorSpace"/> is not supported by the decoder.</exception>
         /// <seealso cref="ImageUtil.GetSupportedColorspace(ImageFormat)"/>
@@ -249,6 +250,10 @@ namespace Tizen.Multimedia.Util
         #region IDisposable Support
         private bool _disposed = false;
 
+        /// <summary>
+        /// Releases the unmanaged resources used by the ImageDecoder.
+        /// </summary>
+        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (!_disposed)
@@ -261,15 +266,12 @@ namespace Tizen.Multimedia.Util
             }
         }
 
-        ~ImageDecoder()
-        {
-            Dispose(false);
-        }
-
+        /// <summary>
+        /// Releases all resources used by the ImageDecoder.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
-            GC.SuppressFinalize(this);
         }
         #endregion
     }
index 03534a2..0c53f9b 100644 (file)
@@ -91,9 +91,9 @@ namespace Tizen.Multimedia.Util
         }
 
         /// <summary>
-        /// Sets the colorspace of the output image.
+        /// Sets the color-space of the output image.
         /// </summary>
-        /// <param name="colorSpace">The target colorspace.</param>
+        /// <param name="colorSpace">The target color-space.</param>
         /// <exception cref="ArgumentException"><paramref name="colorSpace"/> is invalid.</exception>
         /// <exception cref="NotSupportedException"><paramref name="colorSpace"/> is not supported by the encoder.</exception>
         /// <seealso cref="ImageUtil.GetSupportedColorspace(ImageFormat)"/>
@@ -217,6 +217,10 @@ namespace Tizen.Multimedia.Util
         #region IDisposable Support
         private bool _disposed = false;
 
+        /// <summary>
+        /// Releases the unmanaged resources used by the ImageEncoder.
+        /// </summary>
+        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (!_disposed)
@@ -229,6 +233,9 @@ namespace Tizen.Multimedia.Util
             }
         }
 
+        /// <summary>
+        /// Releases all resources used by the ImageEncoder.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
@@ -337,9 +344,10 @@ namespace Tizen.Multimedia.Util
         /// <summary>
         /// Initialize a new instance of the <see cref="JpegEncoder"/> class with initial quality value.
         /// </summary>
+        /// <param name="quality">The quality for JPEG image encoding; from 1(lowest quality) to 100(highest quality).</param>
         /// <remarks><see cref="ImageEncoder.OutputFormat"/> will be the <see cref="ImageFormat.Jpeg"/>.</remarks>
         /// <exception cref="ArgumentOutOfRangeException">
-        ///     <paramref name="quality"/> is less than 0.\n
+        ///     <paramref name="quality"/> is less than or equal to 0.\n
         ///     - or -\n
         ///     <paramref name="quality"/> is greater than 100.
         /// </exception>
@@ -352,9 +360,12 @@ namespace Tizen.Multimedia.Util
         /// <summary>
         /// Gets or sets the quality of the encoded image.
         /// </summary>
-        /// <value>The quality of the output image. The default is 75.</value>
+        /// <value>
+        /// The quality of the output image. The default is 75.\n
+        /// Valid value is from 1(lowest quality) to 100(highest quality).
+        /// </value>
         /// <exception cref="ArgumentOutOfRangeException">
-        ///     <paramref name="value"/> is less than 0.\n
+        ///     <paramref name="value"/> is less than or equal to 0.\n
         ///     - or -\n
         ///     <paramref name="value"/> is greater than 100.
         /// </exception>
@@ -363,7 +374,7 @@ namespace Tizen.Multimedia.Util
             get { return _quality ?? DefaultQuality; }
             set
             {
-                if (value < 0 || value > 100)
+                if (value <= 0 || value > 100)
                 {
                     throw new ArgumentOutOfRangeException(nameof(Quality), value,
                         "Valid range is from 1 to 100, inclusive.");
@@ -402,7 +413,7 @@ namespace Tizen.Multimedia.Util
         /// <summary>
         /// Encodes a Graphics Interchange Format (GIF) image from multiple raw image buffers to a specified <see cref="Stream"/>.
         /// </summary>
-        /// <param name="inputBuffer">The image buffer to encode.</param>
+        /// <param name="frames">The image frames to encode.</param>
         /// <param name="outStream">The stream that the image is encoded to.</param>
         /// <returns>A task that represents the asynchronous encoding operation.</returns>
         /// <exception cref="ArgumentNullException">
index c591ee7..d0f81ad 100644 (file)
@@ -67,6 +67,10 @@ namespace Tizen.Multimedia.Util
         #region IDisposable Support
         private bool _disposed = false;
 
+        /// <summary>
+        /// Releases the unmanaged resources used by the ImageTransformer.
+        /// </summary>
+        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (!_disposed)
@@ -75,6 +79,9 @@ namespace Tizen.Multimedia.Util
             }
         }
 
+        /// <summary>
+        /// Releases all resources used by the ImageTransformer.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
index e2db5b2..a7d171c 100644 (file)
@@ -29,7 +29,8 @@ namespace Tizen.Multimedia.Util
         /// <summary>
         /// Retrieves supported colorspaces for a <see cref="ImageFormat"/> that represents formats for <see cref="ImageEncoder"/> and <see cref="ImageDecoder"/>.
         /// </summary>
-        /// <param name="format"><see cref="ImageFormat"/>.</param>
+        /// <returns>An IEnumerable of <see="ColorSpace"/> representing the supported color-spaces.</returns>
+        /// <param name="format">The <see cref="ImageFormat"/>.</param>
         /// <exception cref="ArgumentException"><paramref name="format"/> is invalid.</exception>
         public static IEnumerable<ColorSpace> GetSupportedColorSpaces(ImageFormat format)
         {
@@ -47,9 +48,9 @@ namespace Tizen.Multimedia.Util
         /// <summary>
         /// Calculates the size of the image buffer for the specified resolution and color-space.
         /// </summary>
-        /// <param name="size">Resolution of the image.</param>
+        /// <param name="resolution">The resolution of the image.</param>
         /// <param name="colorSpace"><see cref="ColorSpace"/> of the image.</param>
-        /// <returns>Buffer size.</returns>
+        /// <returns>The buffer size.</returns>
         /// <exception cref="ArgumentOutOfRangeException">
         ///     width of <paramref name="resolution"/> is less than or equal to zero.\n
         ///     - or -\n
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)