From eead620ee8bb72b88ec954c37fa0df9f7fcdc4bb Mon Sep 17 00:00:00 2001 From: nam <36914158+kqjy777@users.noreply.github.com> Date: Fri, 13 Jul 2018 11:59:59 +0900 Subject: [PATCH] [MediaPlayer] add API to set zoom with field of view for spherical video (#329) * [MediaPlayer] add API to set zoom with field of view for spherical video and modify the wrong descriptions * fix descriptions --- .../Interop/Interop.Player.cs | 3 + src/Tizen.Multimedia.MediaPlayer/Player/Player.cs | 2 +- .../Player/SphericalVideo.cs | 87 ++++++++++++++++++---- 3 files changed, 77 insertions(+), 15 deletions(-) diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs index 6c50537..d0eeab1 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs @@ -310,6 +310,9 @@ internal static partial class Interop [DllImport(Libraries.Player, EntryPoint = "player_360_get_field_of_view")] internal static extern PlayerErrorCode GetFieldOfView(IntPtr player, out int horizontalDegrees, out int verticalDegrees); + [DllImport(Libraries.Player, EntryPoint = "player_360_set_zoom_with_field_of_view")] + internal static extern PlayerErrorCode SetZoomWithFieldOfView(IntPtr player, float level, int horizontalDegrees, int verticalDegrees); + [DllImport(Libraries.Player, EntryPoint = "player_foreach_adaptive_variant")] internal static extern PlayerErrorCode ForeachAdaptiveVariants(IntPtr player, AdaptiveVariantCallback callback, IntPtr userData); diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs index ea24ff6..092e124 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs @@ -621,7 +621,7 @@ namespace Tizen.Multimedia /// Streaming playback. /// /// - /// is less than 5.0.
+ /// is less than -5.0.
/// -or-
/// is greater than 5.0.
/// -or-
diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/SphericalVideo.cs b/src/Tizen.Multimedia.MediaPlayer/Player/SphericalVideo.cs index 86f60f5..d876399 100644 --- a/src/Tizen.Multimedia.MediaPlayer/Player/SphericalVideo.cs +++ b/src/Tizen.Multimedia.MediaPlayer/Player/SphericalVideo.cs @@ -186,7 +186,6 @@ namespace Tizen.Multimedia /// http://tizen.org/feature/multimedia.player.spherical_video /// The required feature is not supported. /// The player has already been disposed of. - /// The player is not in the valid state. /// /// 5 public float GetZoom() @@ -210,7 +209,11 @@ namespace Tizen.Multimedia /// http://tizen.org/feature/multimedia.player.spherical_video /// The required feature is not supported. /// The player has already been disposed of. - /// The player is not in the valid state. + /// + /// is less than 1.0. + /// -or-
+ /// is greater than 10.0.
+ ///
/// /// 5 public void SetZoom(float level) @@ -231,8 +234,6 @@ namespace Tizen.Multimedia /// /// Gets or sets the spherical mode. /// - /// The player must be in the , , - /// or state. /// http://tizen.org/feature/opengles.version.2_0 /// http://tizen.org/feature/multimedia.player.spherical_video /// The required feature is not supported. @@ -274,9 +275,6 @@ namespace Tizen.Multimedia /// /// The that this instance belongs to has been disposed of. /// - /// - /// The that this instance belongs to is not in the valid state. - /// /// 5 public DirectionOfView GetDirectionOfView() { @@ -301,8 +299,10 @@ namespace Tizen.Multimedia /// /// The that this instance belongs to has been disposed of. /// - /// - /// The that this instance belongs to is not in the valid state. + /// + /// should be in range of [-3.141593, 3.141593].
+ /// -or-
+ /// should be in range of [-1.570796, 1.570796].
///
/// /// 5 @@ -339,9 +339,6 @@ namespace Tizen.Multimedia /// /// The that this instance belongs to has been disposed of. /// - /// - /// The that this instance belongs to is not in the valid state. - /// /// 5 public FieldOfView GetFieldOfView() { @@ -366,8 +363,14 @@ namespace Tizen.Multimedia /// /// The that this instance belongs to has been disposed of. /// - /// - /// The that this instance belongs to is not in the valid state. + /// + /// is less than 1.
+ /// -or-
+ /// is greater than 360.
+ /// -or-
+ /// is less than 1.
+ /// -or-
+ /// is greater than 180.
///
/// /// 5 @@ -393,5 +396,61 @@ namespace Tizen.Multimedia NativePlayer.SetFieldOfView(Player.Handle, fieldOfView.HorizontalDegrees, fieldOfView.VerticalDegrees). ThrowIfFailed(Player, "Failed to set the field of the view."); } + + /// + /// Sets the zoom with the field of view for spherical video. + /// + /// The zoom level. + /// The degree values to display. + /// http://tizen.org/feature/opengles.version.2_0 + /// http://tizen.org/feature/multimedia.player.spherical_video + /// The required feature is not supported. + /// + /// The that this instance belongs to has been disposed of. + /// + /// + /// is less than 1.0. + /// -or-
+ /// is greater than 10.0.
+ /// -or-
+ /// is less than 1.
+ /// -or-
+ /// is greater than 360.
+ /// -or-
+ /// is less than 1.
+ /// -or-
+ /// is greater than 180.
+ ///
+ /// + /// + /// + /// 5 + public void SetZoomWithFieldOfView(float level, FieldOfView fieldOfView) + { + ValidationUtil.ValidateFeatureSupported(PlayerFeatures.OpenGl); + ValidationUtil.ValidateFeatureSupported(PlayerFeatures.SphericalVideo); + + Player.ValidateNotDisposed(); + + if (level < 1.0F || 10.0F < level) + { + throw new ArgumentOutOfRangeException(nameof(level), level, "Valid level is 1.0 to 10.0"); + } + + if (fieldOfView.HorizontalDegrees < 1 || fieldOfView.HorizontalDegrees > 360) + { + throw new ArgumentOutOfRangeException(nameof(fieldOfView.HorizontalDegrees), fieldOfView.HorizontalDegrees, + $"Valid range is 1-360 degrees. : " + fieldOfView.HorizontalDegrees); + } + + if (fieldOfView.VerticalDegrees < 1 || fieldOfView.VerticalDegrees > 180) + { + throw new ArgumentOutOfRangeException(nameof(fieldOfView.VerticalDegrees), fieldOfView.VerticalDegrees, + $"Valid range is 1-180 degrees. : " + fieldOfView.VerticalDegrees); + } + + NativePlayer.SetZoomWithFieldOfView(Player.Handle, level, fieldOfView.HorizontalDegrees, fieldOfView.VerticalDegrees). + ThrowIfFailed(Player, "Failed to set the zoom with the field of the view."); + } } } -- 2.7.4