[MediaPlayer] fix to set window size properly (#5008)
authornam <36914158+aferin@users.noreply.github.com>
Fri, 17 Feb 2023 09:14:20 +0000 (18:14 +0900)
committerGitHub <noreply@github.com>
Fri, 17 Feb 2023 09:14:20 +0000 (18:14 +0900)
* fix to set window size properly

* update all interfaces

* Update src/Tizen.Multimedia/Common/Display.cs

Co-authored-by: Haesu Gwon <haesu.gwon@samsung.com>
---------

Co-authored-by: Haesu Gwon <haesu.gwon@samsung.com>
src/Tizen.Multimedia.Camera/Camera/Camera.Properties.cs
src/Tizen.Multimedia.MediaPlayer/Player/Player.Properties.cs
src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs
src/Tizen.Multimedia.Remoting/WebRTC/MediaSource.cs
src/Tizen.Multimedia.Remoting/WebRTC/MediaStreamTrack.cs
src/Tizen.Multimedia/Common/Display.cs

index 2b49769..3f62ac6 100644 (file)
@@ -116,7 +116,7 @@ namespace Tizen.Multimedia
             return CameraDisplay.SetDisplay(GetHandle(), type, evasObject);
         }
 
-        CameraError IDisplayable<CameraError>.ApplyEcoreWindow(IntPtr windowHandle)
+        CameraError IDisplayable<CameraError>.ApplyEcoreWindow(IntPtr windowHandle, NUI.Rectangle rect)
         {
             Debug.Assert(_disposed == false);
 
index e180bb5..c256f45 100644 (file)
@@ -377,12 +377,12 @@ namespace Tizen.Multimedia
                 type == DisplayType.Overlay ? PlayerDisplayType.Overlay : PlayerDisplayType.Evas, evasObject);
         }
 
-        PlayerErrorCode IDisplayable<PlayerErrorCode>.ApplyEcoreWindow(IntPtr windowHandle)
+        PlayerErrorCode IDisplayable<PlayerErrorCode>.ApplyEcoreWindow(IntPtr windowHandle, NUI.Rectangle rect)
         {
             Debug.Assert(IsDisposed == false);
 
             return NativeDisplay.SetEcoreDisplay(Handle,
-                _uiSync ? PlayerDisplayType.OverlayUISync : PlayerDisplayType.Overlay, windowHandle);
+                _uiSync ? PlayerDisplayType.OverlayUISync : PlayerDisplayType.Overlay, windowHandle, rect.X, rect.Y, rect.Width, rect.Height);
         }
         #endregion
 
index 900f7e5..a53cd3f 100644 (file)
@@ -134,7 +134,7 @@ namespace Tizen.Multimedia.Remoting
             return Native.SetDisplay(Handle, (int)type, evasObject);
         }
 
-        ScreenMirroringErrorCode IDisplayable<ScreenMirroringErrorCode>.ApplyEcoreWindow(IntPtr windowHandle)
+        ScreenMirroringErrorCode IDisplayable<ScreenMirroringErrorCode>.ApplyEcoreWindow(IntPtr windowHandle, NUI.Rectangle rect)
         {
             return Native.SetEcoreDisplay(Handle, windowHandle);
         }
index a4a2306..df7f9d6 100755 (executable)
@@ -669,7 +669,7 @@ namespace Tizen.Multimedia.Remoting
             return trackId;
         }
 
-        uint IDisplayable<uint>.ApplyEcoreWindow(IntPtr windowHandle)
+        uint IDisplayable<uint>.ApplyEcoreWindow(IntPtr windowHandle, NUI.Rectangle rect)
         {
             NativeWebRTC.SetEcoreVideoLoopback(WebRtc.Handle, SourceId.Value, windowHandle, out uint trackId).
                 ThrowIfFailed("Failed to set ecore video loopback");
@@ -677,4 +677,4 @@ namespace Tizen.Multimedia.Remoting
             return trackId;
         }
     }
-}
\ No newline at end of file
+}
index af49ca2..650ca26 100755 (executable)
@@ -111,7 +111,7 @@ namespace Tizen.Multimedia.Remoting
                 type == DisplayType.Overlay ? WebRTCDisplayType.Overlay : WebRTCDisplayType.Evas, evasObject);
         }
 
-        WebRTCErrorCode IDisplayable<WebRTCErrorCode>.ApplyEcoreWindow(IntPtr windowHandle)
+        WebRTCErrorCode IDisplayable<WebRTCErrorCode>.ApplyEcoreWindow(IntPtr windowHandle, NUI.Rectangle rect)
         {
             return NativeWebRTC.SetEcoreDisplay(_webRtc.Handle, _trackId, windowHandle);
         }
index 0f8357d..a5c81c8 100644 (file)
@@ -39,7 +39,7 @@ namespace Tizen.Multimedia
     internal interface IDisplayable<TError>
     {
         TError ApplyEvasDisplay(DisplayType type, EvasObject evasObject);
-        TError ApplyEcoreWindow(IntPtr windowHandle);
+        TError ApplyEcoreWindow(IntPtr windowHandle, NUI.Rectangle rect);
     }
 
     internal interface IDisplaySetter
@@ -72,15 +72,17 @@ namespace Tizen.Multimedia
     internal class EcoreDisplaySetter : IDisplaySetter
     {
         private readonly IntPtr _windowHandle;
+        private readonly NUI.Rectangle _rect;
 
-        internal EcoreDisplaySetter(IntPtr windowHandle)
+        internal EcoreDisplaySetter(IntPtr windowHandle, NUI.Rectangle rect)
         {
             _windowHandle = windowHandle;
+            _rect = rect;
         }
 
         public TError SetDisplay<TError>(IDisplayable<TError> target)
         {
-            return target.ApplyEcoreWindow(_windowHandle);
+            return target.ApplyEcoreWindow(_windowHandle, _rect);
         }
     }
 
@@ -161,8 +163,7 @@ namespace Tizen.Multimedia
             {
                 throw new ArgumentNullException(nameof(window));
             }
-
-            _setter = new EcoreDisplaySetter(window.GetNativeWindowHandler());
+            _setter = new EcoreDisplaySetter(window.GetNativeWindowHandler(), window.WindowPositionSize);
 
             UiSync = uiSync;
         }