NativePlayer.GetStreamingDownloadProgress(Handle, out start, out current).
ThrowIfFailed(this, "Failed to get download progress");
- Log.Info(PlayerLog.Tag, "get download progress : " + start + ", " + current);
+ Log.Info(PlayerLog.Tag, $"get download progress : {start}, {current}");
return new DownloadProgress(start, current);
}
NativePlayer.GetPlayPosition(Handle, out playPosition).
ThrowIfFailed(this, "Failed to get the play position of the player");
- Log.Info(PlayerLog.Tag, "get play position : " + playPosition);
+ Log.Info(PlayerLog.Tag, $"get play position : {playPosition}");
return playPosition;
}
NativePlayer.GetPlayPositionNanoseconds(Handle, out long playPosition).
ThrowIfFailed(this, "Failed to get the play position(nsec) of the player");
- Log.Info(PlayerLog.Tag, "get play position(nsec) : " + playPosition);
+ Log.Info(PlayerLog.Tag, $"get play position(nsec) : {playPosition}");
return playPosition;
}
ret.ThrowIfFailed(this, "Failed to set the audio stream policy to the player");
}
+
+ /// <summary>
+ /// Set the relative ROI (Region Of Interest) area as a decimal fraction based on the video source.
+ /// It can be regarded as zooming operation because the specified video area will be rendered to fit to the display.
+ /// </summary>
+ /// <param name="scaleRectangle">The containing the ROI area information.</param>
+ /// <remarks>
+ /// This function requires the ratio of the each coordinate and size to the video resolution size
+ /// to guarantee of showing the same area for the dynamic resolution video content.
+ /// This function have to be called after setting <see cref="Display"/>
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Operation failed; internal error.
+ /// -or-<br/>
+ /// The <see cref="PlayerDisplayType"/> is not set to <see cref="PlayerDisplayType.Overlay"/>.
+ /// </exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// <paramref name="scaleRectangle.ScaleX"/> is less than 0.0 or greater than 1.0.<br/>
+ /// -or-<br/>
+ /// <paramref name="scaleRectangle.ScaleY"/> is less than 0.0 or greater than 1.0.<br/>
+ /// -or-<br/>
+ /// <paramref name="scaleRectangle.ScaleWidth"/> is less than or equal to 0.0 or greater than 1.0.<br/>
+ /// -or-<br/>
+ /// <paramref name="scaleRectangle.ScaleHeight"/> is less than or equal to 0.0 or greater than 1.0.
+ /// </exception>
+ /// <seealso cref="ScaleRectangle"/>
+ /// <seealso cref="Display"/>
+ /// <seealso cref="StreamInfo.GetVideoProperties"/>
+ /// <seealso cref="GetVideoRoi"/>
+ /// <since_tizen> 5 </since_tizen>
+ public void SetVideoRoi(ScaleRectangle scaleRectangle)
+ {
+ ValidateNotDisposed();
+
+ if (scaleRectangle.ScaleX < 0 || scaleRectangle.ScaleX > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleX), scaleRectangle.ScaleX, "Valid range is 0 to 1.0");
+ }
+ if (scaleRectangle.ScaleY < 0 || scaleRectangle.ScaleY > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleY), scaleRectangle.ScaleY, "Valid range is 0 to 1.0");
+ }
+ if (scaleRectangle.ScaleWidth <= 0 || scaleRectangle.ScaleWidth > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleWidth), scaleRectangle.ScaleWidth, "Valid range is 0 to 1.0 (except 0.0)");
+ }
+ if (scaleRectangle.ScaleHeight <= 0 || scaleRectangle.ScaleHeight > 1)
+ {
+ throw new ArgumentOutOfRangeException(nameof(scaleRectangle.ScaleHeight), scaleRectangle.ScaleHeight, "Valid range is 0 to 1.0 (except 0.0)");
+ }
+
+ NativePlayer.SetVideoRoi(Handle, scaleRectangle.ScaleX, scaleRectangle.ScaleY, scaleRectangle.ScaleWidth, scaleRectangle.ScaleHeight).ThrowIfFailed(this, "Failed to set the video roi area.");
+ }
+
+ /// <summary>
+ /// Get the relative ROI (Region Of Interest) area as a decimal fraction based on the video source.
+ /// </summary>
+ /// <returns>The <see cref="ScaleRectangle"/> containing the ROI area information.</returns>
+ /// <remarks>The specified ROI area is valid only in <see cref="PlayerDisplayType.Overlay"/>.</remarks>
+ /// <exception cref="ObjectDisposedException">The player has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// Operation failed; internal error.
+ /// </exception>
+ /// <seealso cref="Display"/>
+ /// <seealso cref="StreamInfo.GetVideoProperties"/>
+ /// <seealso cref="SetVideoRoi"/>
+ /// <since_tizen> 5 </since_tizen>
+ public ScaleRectangle GetVideoRoi()
+ {
+ ValidateNotDisposed();
+
+ NativePlayer.GetVideoRoi(Handle, out var scaleX, out var scaleY,
+ out var scaleWidth, out var scaleHeight).ThrowIfFailed(this, "Failed to get the video roi area");
+
+ return new ScaleRectangle(scaleX, scaleY, scaleWidth, scaleHeight);
+ }
#endregion
#region Preparing state
--- /dev/null
+/*
+ * Copyright (c) 2018 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 System.Diagnostics;
+using static Interop;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents properties for the relative ROI area based on video size
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public struct ScaleRectangle
+ {
+ /// <summary>
+ /// Initializes a new instance of the struct with the specified field of view for the spherical video.
+ /// </summary>
+ /// <param name="scaleX">The ratio expressed as a decimal of x coordinate to the video width. (x/video width)
+ /// x coordinate means the base point located lower-left corner of the video area.
+ /// valid range is [0, 1]. Default value is 0.</param>
+ /// <param name="scaleY">The ratio expressed as a decimal of y coordinate to the video height. (y/video height)
+ /// y coordinate means the base point located lower-left corner of the video area.
+ /// valid range is [0, 1]. Default value is 0.</param>
+ /// <param name="scaleWidth">The ratio expressed as a decimal of ROI width to the video width. (ROI width/video width)
+ /// valid range is (0, 1]. Default value is 1.</param>
+ /// <param name="scaleHeight">The ratio expressed as a decimal of ROI height to the video height. (ROI height/video height)
+ /// valid range is (0, 1]. Default value is 1.</param>
+ /// <since_tizen> 5 </since_tizen>
+ public ScaleRectangle(double scaleX, double scaleY, double scaleWidth, double scaleHeight)
+ {
+ ScaleX = scaleX;
+ ScaleY = scaleY;
+ ScaleWidth = scaleWidth;
+ ScaleHeight = scaleHeight;
+
+ Log.Debug(PlayerLog.Tag, $"scaleX={scaleX}, scaleY={scaleY}, scaleWidth={scaleWidth}, scaleHeight={scaleHeight}");
+ }
+
+ /// <summary>
+ /// Gets or sets the ScaleX.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public double ScaleX
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the ScaleY.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public double ScaleY
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the ScaleWidth.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public double ScaleWidth
+ {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Gets or sets the ScaleHeight.
+ /// </summary>
+ /// <since_tizen> 5 </since_tizen>
+ public double ScaleHeight
+ {
+ get;
+ set;
+ }
+ }
+}