From 0fe133cc8ea005508bda4eedb6181aed9d73335c Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Thu, 29 May 2025 10:54:46 +0900 Subject: [PATCH] [ScreenMirroring] Add new display and device type APIs (#6864) * [ScreenMirroring] Add new display and device type APIs --- .../Interop/Interop.ScreenMirroring.cs | 14 +++ .../ScreenMirroring/ScreenMirroring.cs | 115 ++++++++++++++++++ .../ScreenMirroring/ScreenMirroringEnums.cs | 59 +++++++++ 3 files changed, 188 insertions(+) diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs index 20a9a4602..9357aceaf 100755 --- a/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs @@ -15,7 +15,9 @@ */ using System; +using System.Drawing; using System.Runtime.InteropServices; +using Tizen.Multimedia; using Tizen.Multimedia.Remoting; internal static partial class Interop @@ -39,12 +41,24 @@ internal static partial class Interop [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_display")] internal static extern ScreenMirroringErrorCode SetDisplay(IntPtr handle, int type, IntPtr display); + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_display_mode")] + internal static extern ScreenMirroringErrorCode SetDisplayMode(IntPtr handle, ScreenMirroringDisplayMode mode); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_display_roi")] + internal static extern ScreenMirroringErrorCode SetDisplayRoi(IntPtr handle, int x, int y, int width, int height); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_display_rotation")] + internal static extern ScreenMirroringErrorCode SetDisplayRotation(IntPtr handle, Rotation rotatjion); + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_ecore_wl_display")] internal static extern ScreenMirroringErrorCode SetEcoreDisplay(IntPtr handle, IntPtr display); [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_resolution")] internal static extern ScreenMirroringErrorCode SetResolution(IntPtr handle, ScreenMirroringResolutions resolution); + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_src_device_type")] + internal static extern ScreenMirroringErrorCode SetSrcDeviceType(IntPtr handle, ScreenMirroringDeviceType type); + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_prepare")] internal static extern ScreenMirroringErrorCode Prepare(IntPtr handle); diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs index 754b546c9..7bfa7efd3 100644 --- a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs @@ -463,6 +463,121 @@ namespace Tizen.Multimedia.Remoting } } + private ScreenMirroringDisplayMode _displayMode; + /// + /// Gets or sets the display mode. + /// + /// The has already been disposed. + /// 13 + public ScreenMirroringDisplayMode DisplayMode + { + get + { + ThrowIfDisposed(); + + return _displayMode; + } + set + { + Native.SetDisplayMode(Handle, value).ThrowIfError("Failed to set display mode"); + _displayMode = value; + } + } + + private Rectangle _displayRoi; + /// + /// Gets or sets the display position and size of the receiver screen view. + /// + /// + /// DisplayRoi will be applied when is . + /// + /// + /// DisplayRoi.X or DisplayRoi.Y is less than 0.
+ /// -or-
+ /// DisplayRoi.Width or DisplayRoi.Height is less than or equal to 0.
+ ///
+ /// The has already been disposed. + /// + /// 13 + public Rectangle DisplayRoi + { + get + { + ThrowIfDisposed(); + + return _displayRoi; + } + set + { + if (value.X < 0) + { + throw new ArgumentOutOfRangeException("X", value.X, + $"The X of the roi can't be less than zero."); + } + if (value.Y < 0) + { + throw new ArgumentOutOfRangeException("Y", value.Y, + $"The Y of the roi can't be less than zero."); + } + if (value.Width <= 0) + { + throw new ArgumentOutOfRangeException("Width", value.Width, + $"The Width of the roi can't be less than or equal to zero."); + } + if (value.Height <= 0) + { + throw new ArgumentOutOfRangeException("Height", value.Height, + $"The Height of the roi can't be less than or equal to zero."); + } + + Native.SetDisplayRoi(Handle, value.X, value.Y, value.Width, value.Height) + .ThrowIfError("Failed to set display ROI"); + _displayRoi = value; + } + } + + private Rotation _displayRotation; + /// + /// Gets or sets the display rotation. + /// + /// The has already been disposed. + /// 13 + public Rotation DisplayRotation + { + get + { + ThrowIfDisposed(); + + return _displayRotation; + } + set + { + Native.SetDisplayRotation(Handle, value).ThrowIfError("Failed to set display rotation"); + _displayRotation = value; + } + } + + private ScreenMirroringDeviceType _srcDeviceType; + /// + /// Gets or sets the source device type. + /// + /// The has already been disposed. + /// 13 + public ScreenMirroringDeviceType SourceDeviceType + { + get + { + ThrowIfDisposed(); + + return _srcDeviceType; + } + set + { + Native.SetSrcDeviceType(Handle, value).ThrowIfError("Failed to set source device type"); + _srcDeviceType = value; + } + } + /// /// Releases all resource used by the object. /// diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs index e4c5aa8fc..b8ea52bdd 100644 --- a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs @@ -150,4 +150,63 @@ namespace Tizen.Multimedia.Remoting /// InvalidOperation = ScreenMirroringErrorCode.InvalidOperation } + + /// + /// Specifies the display mode for . + /// + /// 13 + public enum ScreenMirroringDisplayMode + { + /// + /// Letter box. + /// + LetterBox, + + /// + /// Original size. + /// + OriginSize, + + /// + /// Full screen. + /// + Full, + + /// + /// Cropped full screen. + /// + CroppedFull, + + /// + /// Original size or letter box. + /// + OriginOrLetterBox, + + /// + /// Custom ROI. + /// + CustomRoi + } + + /// + /// Specifies the device type for . + /// + /// 13 + public enum ScreenMirroringDeviceType + { + /// + /// All other devices except TV and Mobile. + /// + Generic, + + /// + /// TV device. + /// + Tv, + + /// + /// Mobile device. + /// + Mobile + } } -- 2.34.1