Defined common display type and modified related apis.
authorcoderhyme <jhyo.kim@samsung.com>
Thu, 13 Apr 2017 02:43:57 +0000 (11:43 +0900)
committercoderhyme <jhyo.kim@samsung.com>
Mon, 1 May 2017 21:10:40 +0000 (06:10 +0900)
There is a certain requirement that the display needs to be extensible.
Some api has been modified to make apis consistent.

Change-Id: I766fdeb2d7bba0a891c46862fe64e826da60b26d
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
13 files changed:
packaging/csapi-multimedia.spec
src/Tizen.Multimedia/Camera/Camera.cs
src/Tizen.Multimedia/Camera/CameraDisplaySettings.cs [moved from src/Tizen.Multimedia/Camera/CameraDisplay.cs with 77% similarity, mode: 0644]
src/Tizen.Multimedia/Camera/CameraEnums.cs
src/Tizen.Multimedia/Common/Display.cs [new file with mode: 0644]
src/Tizen.Multimedia/Interop/Interop.CameraDisplay.cs
src/Tizen.Multimedia/Interop/Interop.Player.cs
src/Tizen.Multimedia/Player/Player.cs
src/Tizen.Multimedia/Player/PlayerDisplaySettings.cs [moved from src/Tizen.Multimedia/Player/PlayerDisplay.cs with 78% similarity]
src/Tizen.Multimedia/Player/PlayerEnums.cs
src/Tizen.Multimedia/ScreenMirroring/ScreenMirroring.cs
src/Tizen.Multimedia/ScreenMirroring/ScreenMirroringEnumerations.cs
src/Tizen.Multimedia/Tizen.Multimedia.csproj

index 968f288..f306319 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       csapi-multimedia
 Summary:    Tizen Multimedia API for C#
-Version:    1.0.54
+Version:    1.0.55
 Release:    0
 Group:      Development/Libraries
 License:    Apache-2.0
index 34da30f..f39c581 100755 (executable)
@@ -20,7 +20,7 @@ using System.Diagnostics;
 using System.Linq;
 using System.Runtime.InteropServices;
 using System.Threading;
-using System.Collections;
+
 namespace Tizen.Multimedia
 {
     static internal class CameraLog
@@ -39,7 +39,7 @@ namespace Tizen.Multimedia
     /// <privilege>
     /// http://tizen.org/privilege/camera
     /// </privilege>
-    public class Camera : IDisposable
+    public class Camera : IDisposable, IDisplayable<CameraError>
     {
         private IntPtr _handle = IntPtr.Zero;
         private bool _disposed = false;
@@ -60,7 +60,7 @@ namespace Tizen.Multimedia
 
             Feature = new CameraFeatures(this);
             Setting = new CameraSettings(this);
-            Display = new CameraDisplay(this);
+            DisplaySettings = new CameraDisplaySettings(this);
 
             RegisterCallbacks();
 
@@ -350,7 +350,80 @@ namespace Tizen.Multimedia
         /// <summary>
         /// Get/set various camera display properties.
         /// </summary>
-        public CameraDisplay Display { get; }
+        public CameraDisplaySettings DisplaySettings{ get; }
+
+        private Display _display;
+
+        private CameraError SetDisplay(Display display)
+        {
+            if (display == null)
+            {
+                return Interop.CameraDisplay.SetTarget(GetHandle(), DisplayType.None, IntPtr.Zero);
+            }
+
+            return display.ApplyTo(this);
+        }
+
+        private void ReplaceDisplay(Display newDisplay)
+        {
+            if (_display != null)
+            {
+                _display.Owner = null;
+            }
+            _display = newDisplay;
+            if (_display != null)
+            {
+                _display.Owner = this;
+            }
+        }
+
+        /// <summary>
+        /// Sets or gets the display type and handle to show preview images.
+        /// The camera must be in the <see cref="CameraState.Created"/> state.
+        /// </summary>
+        /// <remarks>
+        /// This must be set before StartPreview() method.
+        /// In Custom ROI display mode, DisplayRoiArea property must be set before calling this method.
+        /// </remarks>
+        /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
+        /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
+        /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
+        /// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
+        public Display Display
+        {
+            get
+            {
+                return _display;
+            }
+            set
+            {
+                ValidateState(CameraState.Created);
+
+                if (value != null && value.Owner != null)
+                {
+                    if (ReferenceEquals(this, value.Owner))
+                    {
+                        return;
+                    }
+                    else
+                    {
+                        throw new ArgumentException("The display has already been assigned to another.");
+                    }
+                }
+                CameraErrorFactory.ThrowIfError(SetDisplay(value), "Failed to set the camera display");
+
+                ReplaceDisplay(value);
+            }
+        }
+
+        CameraError IDisplayable<CameraError>.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject)
+        {
+            Debug.Assert(_disposed == false);
+
+            Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
+
+            return Interop.CameraDisplay.SetTarget(GetHandle(), type, evasObject);
+        }
 
         /// <summary>
         /// Gets the state of the camera.
@@ -514,7 +587,7 @@ namespace Tizen.Multimedia
 
         /// <summary>
         /// Starts capturing and drawing preview frames on the screen.
-        /// The display handle must be set using <see cref="CameraDisplay.SetInfo"/>
+        /// The display handle must be set using <see cref="CameraDisplaySettings.SetInfo"/>
         /// before using this method.
         /// If needed set fps <see cref="CameraSettings.PreviewFps"/>, preview resolution
         /// <see cref="CameraSettings.PreviewResolution"/>, or preview format <see cref="CameraSettings.PreviewPixelFormat"/>
old mode 100755 (executable)
new mode 100644 (file)
similarity index 77%
rename from src/Tizen.Multimedia/Camera/CameraDisplay.cs
rename to src/Tizen.Multimedia/Camera/CameraDisplaySettings.cs
index 877deb0..c0ab7fa
@@ -23,11 +23,11 @@ namespace Tizen.Multimedia
     /// It allows to set and get various display properties such as
     /// rotation, display visibility and display mode.
     /// </summary>
-    public class CameraDisplay
+    public class CameraDisplaySettings
     {
         internal readonly Camera _camera;
 
-        internal CameraDisplay(Camera camera)
+        internal CameraDisplaySettings(Camera camera)
         {
             _camera = camera;
         }
@@ -159,31 +159,6 @@ namespace Tizen.Multimedia
                     value.X, value.Y, value.Width, value.Height), "Failed to set display roi area.");
             }
         }
-
-        /// <summary>
-        /// Sets the display type and handle to show preview images.
-        /// The camera must be in the <see cref="CameraState.Created"/> state.
-        /// </summary>
-        /// <param name="displayType">Display type.</param>
-        /// <param name="preview">MediaView object to display preview.</param>
-        /// <remarks>
-        /// This method must be called before StartPreview() method.
-        /// In Custom ROI display mode, DisplayRoiArea property must be set before calling this method.
-        /// </remarks>
-        /// <exception cref="ArgumentException">In case of invalid parameters.</exception>
-        /// <exception cref="InvalidOperationException">In case of any invalid operations.</exception>
-        /// <exception cref="NotSupportedException">In case of this feature is not supported.</exception>
-        /// <exception cref="ObjectDisposedException" > The camera already has been disposed.</exception>
-        /// <exception cref="UnauthorizedAccessException">In case of access to the resources cannot be granted.</exception>
-        public void SetInfo(CameraDisplayType displayType, MediaView displayHandle)
-        {
-            _camera.ValidateState(CameraState.Created);
-
-            ValidationUtil.ValidateEnum(typeof(CameraDisplayType), displayType);
-
-            CameraErrorFactory.ThrowIfError(Interop.CameraDisplay.SetInfo(_camera.GetHandle(), displayType, displayHandle),
-                "Failed to set the camera display.");
-        }
     }
 }
 
index 789cdc2..a4ce761 100755 (executable)
@@ -53,25 +53,6 @@ namespace Tizen.Multimedia
     }
 
     /// <summary>
-    /// Enumeration for Camera display type.
-    /// </summary>
-    public enum CameraDisplayType
-    {
-        /// <summary>
-        /// Overlay surface display.
-        /// </summary>
-        Overlay,
-        /// <summary>
-        /// Evas object surface display.
-        /// </summary>
-        Evas,
-        /// <summary>
-        /// This disposes off buffers.
-        /// </summary>
-        None
-    }
-
-    /// <summary>
     /// Enumeration for the facing direction of camera module .
     /// </summary>
     public enum CameraFacingDirection
diff --git a/src/Tizen.Multimedia/Common/Display.cs b/src/Tizen.Multimedia/Common/Display.cs
new file mode 100644 (file)
index 0000000..cb86dbe
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * 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 ElmSharp;
+
+namespace Tizen.Multimedia
+{
+    internal enum DisplayType
+    {
+        /// <summary>
+        /// Overlay surface display
+        /// </summary>
+        Overlay,
+
+        /// <summary>
+        ///  Evas image object surface display
+        /// </summary>
+        Surface,
+
+        /// <summary>
+        /// This disposes off buffers
+        /// </summary>
+        None,
+    }
+
+    internal interface IDisplayable<ErrorType>
+    {
+        ErrorType ApplyEvasDisplay(DisplayType type, EvasObject evasObject);
+    }
+
+    /// <summary>
+    /// Provides means to wrap various display types.
+    /// </summary>
+    /// <seealso cref="Player"/>
+    /// <seealso cref="Camera"/>
+    /// <seealso cref="ScreenMirroring"/>
+    public class Display
+    {
+        private Display(DisplayType type, EvasObject target)
+        {
+            if (target == null)
+            {
+                throw new ArgumentNullException(nameof(target));
+            }
+
+            if (target == IntPtr.Zero)
+            {
+                throw new ArgumentException("The evas object is not realized.");
+            }
+
+            Type = type;
+            EvasObject = target;
+        }
+
+        /// <summary>
+        /// Initialize a new instance of the <see cref="Display"/> class with a <see cref="MediaView"/> class.
+        /// </summary>
+        public Display(MediaView mediaView) : this(DisplayType.Surface, mediaView)
+        {
+        }
+
+        /// <summary>
+        /// Initialize a new instance of the <see cref="Display"/> class with a <see cref="Window"/> class.
+        /// </summary>
+        public Display(Window window) : this(DisplayType.Overlay, window)
+        {
+        }
+
+        private EvasObject EvasObject { get; }
+
+        private DisplayType Type { get; }
+
+        internal object Owner
+        {
+            get;
+            set;
+        }
+
+        internal ErrorType ApplyTo<ErrorType>(IDisplayable<ErrorType> target)
+        {
+            return target.ApplyEvasDisplay(Type, EvasObject);
+        }
+    }
+}
index 94a20af..edf6a90 100755 (executable)
@@ -38,7 +38,7 @@ namespace Tizen.Multimedia
             internal static extern CameraError SetRoiArea(IntPtr handle, int x, int y, int width, int height);
 
             [DllImport(Libraries.Camera, EntryPoint = "camera_set_display")]
-            internal static extern CameraError SetInfo(IntPtr handle, CameraDisplayType displayType, IntPtr displayHandle);
+            internal static extern CameraError SetTarget(IntPtr handle, DisplayType displayType, IntPtr displayHandle);
         }
     }
-}
\ No newline at end of file
+}
index 01f58b4..0037124 100644 (file)
@@ -61,7 +61,7 @@ namespace Tizen.Multimedia
             internal static extern PlayerErrorCode SetUri(IntPtr player, string uri);
 
             [DllImport(Libraries.Player, EntryPoint = "player_set_display")]
-            internal static extern PlayerErrorCode SetDisplay(IntPtr player, PlayerDisplayType type, IntPtr display);
+            internal static extern PlayerErrorCode SetDisplay(IntPtr player, DisplayType type, IntPtr display);
 
             [DllImport(Libraries.Player, EntryPoint = "player_start")]
             internal static extern PlayerErrorCode Start(IntPtr player);
index 48cbb53..baad7b9 100755 (executable)
@@ -38,7 +38,7 @@ namespace Tizen.Multimedia
     /// It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc.
     /// Note that only one video player can be played at one time.
     /// </remarks>
-    public class Player : IDisposable
+    public class Player : IDisposable, IDisplayable<PlayerErrorCode>
     {
         private PlayerHandle _handle;
 
@@ -118,6 +118,9 @@ namespace Tizen.Multimedia
             RetrieveProperties();
 
             AudioEffect = new AudioEffect(this);
+            DisplaySettings = new PlayerDisplaySettings(this);
+
+            RegisterVideoFrameDecodedCallback();
         }
 
         private void RetrieveProperties()
@@ -152,7 +155,6 @@ namespace Tizen.Multimedia
             RegisterMediaStreamBufferStatusCallback();
             RegisterMediaStreamSeekCallback();
             RegisterPlaybackCompletedCallback();
-            RegisterVideoFrameDecodedCallback();
 
             _callbackRegistered = true;
         }
@@ -350,47 +352,48 @@ namespace Tizen.Multimedia
         }
 
         #region Display methods
-        private PlayerDisplay _display;
+        /// <summary>
+        /// Gets the display settings.
+        /// </summary>
+        /// <value>A <see cref="PlayerDisplaySettings"/> that specifies the display settings.</value>
+        public PlayerDisplaySettings DisplaySettings { get; }
+
+        private Display _display;
 
-        private PlayerErrorCode SetDisplay(PlayerDisplay display)
+        private PlayerErrorCode SetDisplay(Display display)
         {
             Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
             if (display == null)
             {
                 Log.Info(PlayerLog.Tag, "set display to none");
-                return Interop.Player.SetDisplay(Handle, PlayerDisplayType.None, IntPtr.Zero);
+                return Interop.Player.SetDisplay(Handle, DisplayType.None, IntPtr.Zero);
             }
-            Log.Info(PlayerLog.Tag, "set display to " + display.Type + " (" + display.EvasObject + ")");
-
-            Debug.Assert(Enum.IsDefined(typeof(PlayerDisplayType), display.Type));
-            Debug.Assert(display.EvasObject != null);
 
-            return Interop.Player.SetDisplay(Handle, display.Type, display.EvasObject);
+            return display.ApplyTo(this);
         }
 
-        private void ReplaceDisplay(PlayerDisplay newDisplay)
+        private void ReplaceDisplay(Display newDisplay)
         {
             if (_display != null)
             {
-                _display.Player = null;
+                _display.Owner = null;
             }
             _display = newDisplay;
             if (_display != null)
             {
-                _display.Player = this;
-                Log.Info(PlayerLog.Tag, "replace display to " + newDisplay.Type + " (" + newDisplay.EvasObject + ")");
+                _display.Owner = this;
             }
         }
 
         /// <summary>
         /// Gets or sets the display.
         /// </summary>
-        /// <value>A <see cref="PlayerDisplay"/> that specifies the display configurations.</value>
+        /// <value>A <see cref="Multimedia.Display"/> that specifies the display.</value>
         /// <remarks>The player must be in the <see cref="PlayerState.Idle"/> state.</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>
-        public PlayerDisplay Display
+        public Display Display
         {
             get
             {
@@ -401,15 +404,15 @@ namespace Tizen.Multimedia
                 Log.Debug(PlayerLog.Tag, PlayerLog.Enter);
                 ValidatePlayerState(PlayerState.Idle);
 
-                if (value != null && value.Player != null)
+                if (value != null && value.Owner != null)
                 {
-                    if (ReferenceEquals(this, value.Player))
+                    if (ReferenceEquals(this, value.Owner))
                     {
                         return;
                     }
                     else
                     {
-                        throw new ArgumentException("The display has already been assigned to another player.");
+                        throw new ArgumentException("The display has already been assigned to another.");
                     }
                 }
 
@@ -419,6 +422,15 @@ namespace Tizen.Multimedia
                 Log.Debug(PlayerLog.Tag, PlayerLog.Leave);
             }
         }
+
+        PlayerErrorCode IDisplayable<PlayerErrorCode>.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject)
+        {
+            Debug.Assert(IsDisposed == false);
+
+            Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
+
+            return Interop.Player.SetDisplay(Handle, type, evasObject);
+        }
         #endregion
 
         private PlayerTrackInfo _audioTrack;
@@ -1263,6 +1275,7 @@ namespace Tizen.Multimedia
         {
             Interlocked.Exchange(ref _isPreparing, 0);
         }
+
         #endregion
     }
 }
  * limitations under the License.
  */
 using System;
-using ElmSharp;
+using System.Diagnostics;
 
 namespace Tizen.Multimedia
 {
-    //TODO reimplementation needed
     /// <summary>
     /// Provides means to configure display settings for video <see cref="Player"/>.
     /// </summary>
-    public class PlayerDisplay
+    public class PlayerDisplaySettings
     {
-        private PlayerDisplay(PlayerDisplayType type, EvasObject target)
+        internal PlayerDisplaySettings(Player player)
         {
-            if (target == null)
-            {
-                Log.Error(PlayerLog.Tag, "evas object is null");
-                throw new ArgumentNullException(nameof(target));
-            }
+            Debug.Assert(player != null);
 
-            if (target == IntPtr.Zero)
-            {
-                Log.Error(PlayerLog.Tag, "The evas object is not realized.");
-                throw new ArgumentException("The evas object is not realized.");
-            }
-
-            Type = type;
-            EvasObject = target;
+            Player = player;
         }
 
-        public PlayerDisplay(Window window) : this(PlayerDisplayType.Overlay, window)
-        {
-        }
-
-        public PlayerDisplay(Image image) : this(PlayerDisplayType.Surface, image)
-        {
-        }
-
-        public EvasObject EvasObject { get; }
-
-        internal PlayerDisplayType Type { get; }
-
-        /// <summary>
-        /// Gets the player that the display is assigned to.
-        /// </summary>
-        public Player Player
+        private Player Player
         {
             get;
-            internal set;
-        }
-
-        private void ValidatePlayer()
-        {
-            if (Player == null)
-            {
-                Log.Error(PlayerLog.Tag, "The display is not assigned, yet.");
-                throw new InvalidOperationException("The display is not assigned, yet.");
-            }
-
-            Player.ValidateNotDisposed();
         }
 
         private PlayerDisplayMode _displayMode = PlayerDisplayMode.LetterBox;
@@ -94,8 +55,6 @@ namespace Tizen.Multimedia
             }
             set
             {
-                ValidatePlayer();
-
                 if (_displayMode == value)
                 {
                     return;
@@ -130,8 +89,6 @@ namespace Tizen.Multimedia
             }
             set
             {
-                ValidatePlayer();
-
                 if (_isVisible == value)
                 {
                     return;
@@ -165,8 +122,6 @@ namespace Tizen.Multimedia
             }
             set
             {
-                ValidatePlayer();
-
                 if (_rotation == value)
                 {
                     return;
@@ -198,8 +153,6 @@ namespace Tizen.Multimedia
         /// <exception cref="ArgumentOutOfRangeException">width or height is less than or equal to zero.</exception>
         public void SetRoi(Rectangle roi)
         {
-            ValidatePlayer();
-
             if (_displayMode != PlayerDisplayMode.Roi)
             {
                 throw new InvalidOperationException("Mode is not set to Roi");
index f6d9054..7d1e9d2 100644 (file)
@@ -90,24 +90,6 @@ namespace Tizen.Multimedia
         }
     }
 
-    internal enum PlayerDisplayType
-    {
-        /// <summary>
-        /// Overlay surface display
-        /// </summary>
-        Overlay,
-
-        /// <summary>
-        ///  Evas image object surface display
-        /// </summary>
-        Surface,
-
-        /// <summary>
-        /// This disposes off buffers
-        /// </summary>
-        None,
-    }
-
     /// <summary>
     /// Specifies audio latency modes for <see cref="Player"/> .
     /// </summary>
@@ -134,7 +116,7 @@ namespace Tizen.Multimedia
     /// <summary>
     /// Specifies display rotation modes for <see cref="Player"/>.
     /// </summary>
-    /// <seealso cref="PlayerDisplay.Rotation"/>
+    /// <seealso cref="Display.Rotation"/>
     public enum PlayerDisplayRotation
     {
         /// <summary>
@@ -162,7 +144,7 @@ namespace Tizen.Multimedia
     /// <summary>
     /// Specifies display modes for <see cref="Player"/>
     /// </summary>
-    /// <seealso cref="PlayerDisplay.Mode"/>
+    /// <seealso cref="Display.Mode"/>
     public enum PlayerDisplayMode
     {
         /// <summary>
@@ -192,7 +174,7 @@ namespace Tizen.Multimedia
         OriginalOrFull,
 
         /// <summary>
-        /// Region of interest, See <see cref="PlayerDisplay.SetRoi(Rectangle)"/>.
+        /// Region of interest, See <see cref="Display.SetRoi(Rectangle)"/>.
         /// </summary>
         Roi
     }
index aa5568a..3d2669e 100755 (executable)
@@ -14,6 +14,7 @@
  * limitations under the License.
  */
 using System;
+using System.Diagnostics;
 using System.Threading.Tasks;
 
 namespace Tizen.Multimedia
@@ -29,15 +30,13 @@ namespace Tizen.Multimedia
     /// start, pause, and resume the screen mirroring sink, set the resolution or display,
     /// register state change callback function.
     /// </summary>
-    public class ScreenMirroring : IDisposable
+    public class ScreenMirroring : IDisposable, IDisplayable<int>
     {
         internal VideoInformation _videoInfo;
         internal AudioInformation _audioInfo;
         internal IntPtr _handle;
         internal string _ip;
         internal string _port;
-        internal SurfaceType _type;
-        internal MediaView _display;
 
         private bool _disposed = false;
         private EventHandler<StateChangedEventArgs> _stateChanged;
@@ -53,7 +52,7 @@ namespace Tizen.Multimedia
         /// <param name="ip">Ip.</param>
         /// <param name="port">Port.</param>
         /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
-        public ScreenMirroring(SurfaceType type, MediaView display, string ip, string port)
+        public ScreenMirroring(Display display, string ip, string port)
         {
             int ret = Interop.ScreenMirroring.Create(out _handle);
             if (ret != (int)ScreenMirroringError.None)
@@ -64,8 +63,6 @@ namespace Tizen.Multimedia
             // initiate values
             _ip = ip;
             _port = port;
-            _type = type;
-            _display = display;
 
             // Set ip and port
             int ret1 = Interop.ScreenMirroring.SetIpAndPort(_handle, _ip, _port);
@@ -75,13 +72,7 @@ namespace Tizen.Multimedia
                 ScreenMirroringErrorFactory.ThrowException(ret, "set ip and port failed");
             }
 
-            // Set display
-            int ret2 = Interop.ScreenMirroring.SetDisplay(_handle, (int)_type, _display);
-            if (ret2 != (int)ScreenMirroringError.None)
-            {
-                Log.Error(ScreenMirroringLog.LogTag, "Set display failed" + (ScreenMirroringError)ret2);
-                ScreenMirroringErrorFactory.ThrowException(ret, "set display failed");
-            }
+            Display = display;
 
             // AudioInfo
             _audioInfo = new AudioInformation();
@@ -163,25 +154,63 @@ namespace Tizen.Multimedia
             }
         }
 
+        private Display _display;
+
+        private int ApplyDisplay(Display display)
+        {
+            return display.ApplyTo(this);
+        }
+
+        private void ReplaceDisplay(Display newDisplay)
+        {
+            if (_display != null)
+            {
+                _display.Owner = null;
+            }
+            _display = newDisplay;
+            if (_display != null)
+            {
+                _display.Owner = this;
+            }
+        }
+
         /// <summary>
         /// Sets the display.
         /// This must be called before prepare() and after create().
         /// </summary>
         /// <example> If only one handle is used for toggling between more than two source devices,
-        /// then this API ahould be used to assign the parameters to the handle.
+        /// then this API should be used to assign the parameters to the handle.
         /// </example>
-        /// <param name="type">Type.</param>
-        /// <param name="display">Display.</param>
-        /// <remarks> Display Handle creates using mediaview class </remarks>
         /// <exception cref="ArgumentException">Thrown when method fail due to an invalid parameter</exception>
-        public void SetDisplay(SurfaceType type, MediaView display)
+        public Display Display
         {
-            int ret = Interop.ScreenMirroring.SetDisplay(_handle, (int)type, display);
-            if (ret != (int)ScreenMirroringError.None)
+            get
             {
-                Log.Error(ScreenMirroringLog.LogTag, "Set display failed" + (ScreenMirroringError)ret);
-                ScreenMirroringErrorFactory.ThrowException(ret, "set display failed");
+                return _display;
             }
+            set
+            {
+                if (value == null)
+                {
+                    throw new ArgumentNullException(nameof(Display));
+                }
+
+                int ret = ApplyDisplay(value);
+                if (ret != (int)ScreenMirroringError.None)
+                {
+                    Log.Error(ScreenMirroringLog.LogTag, "Set display failed" + (ScreenMirroringError)ret);
+                    ScreenMirroringErrorFactory.ThrowException(ret, "set display failed");
+                }
+            }
+        }
+
+        int IDisplayable<int>.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject)
+        {
+            Debug.Assert(_disposed == false);
+
+            Debug.Assert(Enum.IsDefined(typeof(DisplayType), type));
+
+            return Interop.ScreenMirroring.SetDisplay(_handle, (int)type, evasObject);
         }
 
         /// <summary>
index b84cd5b..4689538 100755 (executable)
@@ -52,20 +52,6 @@ namespace Tizen.Multimedia
         /// </summary>
         H264
     }
-    /// <summary>
-    /// Enumeration for display surface type.
-    /// </summary>
-    public enum SurfaceType
-    {
-        /// <summary>
-        /// Use overlay surface to display streaming multimedia data
-        /// </summary>
-        Overlay,
-        /// <summary>
-        /// Use Evas pixmap surface to display streaming multimedia data
-        /// </summary>
-        Evas
-    }
 
     /// <summary>
     /// Enumeration for screen mirroring resolution.
@@ -151,4 +137,4 @@ namespace Tizen.Multimedia
         /// </summary>
         InvalidOperation = ScreenMirroringError.InvalidOperation
     }
-}
\ No newline at end of file
+}
index acba88c..85feb4b 100755 (executable)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -65,7 +65,7 @@
     <Compile Include="Camera\Camera.cs" />
     <Compile Include="Camera\CameraCapturingEventArgs.cs" />
     <Compile Include="Camera\CameraDeviceStateChangedEventArgs.cs" />
-    <Compile Include="Camera\CameraDisplay.cs" />
+    <Compile Include="Camera\CameraDisplaySettings.cs" />
     <Compile Include="Camera\CameraEnums.cs" />
     <Compile Include="Camera\CameraErrorFactory.cs" />
     <Compile Include="Camera\CameraErrorOccurredEventArgs.cs" />
@@ -88,6 +88,7 @@
     <Compile Include="Camera\PreviewEventArgs.cs" />
     <Compile Include="Camera\SinglePlane.cs" />
     <Compile Include="Camera\TriplePlane.cs" />
+    <Compile Include="Common\Display.cs" />
     <Compile Include="Common\IBufferOwner.cs" />
     <Compile Include="Common\IMediaBuffer.cs" />
     <Compile Include="Common\MultimediaDebug.cs" />
     <Compile Include="Player\MediaUriSource.cs" />
     <Compile Include="Player\PlaybackInterruptedEventArgs.cs" />
     <Compile Include="Player\Player.cs" />
-    <Compile Include="Player\PlayerDisplay.cs" />
+    <Compile Include="Player\PlayerDisplaySettings.cs" />
     <Compile Include="Player\PlayerEnums.cs" />
     <Compile Include="Player\PlayerError.cs" />
     <Compile Include="Player\PlayerErrorOccurredEventArgs.cs" />