--- /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.
+ */
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a rotation and flip for mediatool.
+ /// </summary>
+ internal enum RotationFlip
+ {
+ Rotate0,
+ Rotate90,
+ Rotate180,
+ Rotate270,
+ HorizontalFlip,
+ VerticalFlip
+ }
+}
ValidateNotDisposed();
int ret = Interop.MediaPacket.GetDts(_handle, out var value);
-
MultimediaDebug.AssertNoError(ret);
return value;
ValidateNotLocked();
int ret = Interop.MediaPacket.SetDts(_handle, value);
-
MultimediaDebug.AssertNoError(ret);
}
}
ValidateNotDisposed();
int ret = Interop.MediaPacket.IsEncoded(_handle, out var value);
-
MultimediaDebug.AssertNoError(ret);
return value;
}
}
+ /// <summary>
+ /// Gets or sets the rotation value of the current packet.
+ /// </summary>
+ /// <exception cref="ArgumentException">The specified value to set is invalid.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The MediaPacket is not in the writable state, which means it is being used by another module.
+ /// </exception>
+ /// <since_tizen> 5 </since_tizen>
+ public Rotation Rotation
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ int ret = Interop.MediaPacket.GetRotation(_handle, out var value);
+ MultimediaDebug.AssertNoError(ret);
+
+ var rotation = value < RotationFlip.HorizontalFlip ? (Rotation)value : Rotation.Rotate0;
+
+ return rotation;
+ }
+ set
+ {
+ ValidateNotDisposed();
+ ValidateNotLocked();
+ ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value));
+
+ int ret = Interop.MediaPacket.SetRotation(_handle, (RotationFlip)value);
+ MultimediaDebug.AssertNoError(ret);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the flip value of the current packet.
+ /// </summary>
+ /// <remarks>
+ /// <see cref="Flips.None"/> will be ignored in set case. It's not supported in Native FW.
+ /// </remarks>
+ /// <exception cref="ArgumentException">The specified value to set is invalid.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The MediaPacket is not in the writable state, which means it is being used by another module.
+ /// </exception>
+ /// <since_tizen> 5 </since_tizen>
+ public Flips Flip
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ int ret = Interop.MediaPacket.GetRotation(_handle, out var value);
+ MultimediaDebug.AssertNoError(ret);
+
+ var flip = (value < RotationFlip.HorizontalFlip) ? Flips.None :
+ (value == RotationFlip.HorizontalFlip ? Flips.Horizontal : Flips.Vertical);
+
+ return flip;
+ }
+ set
+ {
+ ValidateNotDisposed();
+ ValidateNotLocked();
+ ValidationUtil.ValidateEnum(typeof(Flips), value, nameof(value));
+
+ if (value == Flips.None)
+ {
+ return;
+ }
+
+ var flip = value == Flips.Horizontal ? RotationFlip.HorizontalFlip : RotationFlip.VerticalFlip;
+
+ int ret = Interop.MediaPacket.SetRotation(_handle, flip);
+ MultimediaDebug.AssertNoError(ret);
+ }
+ }
+
private Lazy<IMediaBuffer> _buffer;
/// <summary>
}
}
+ #region Dispose support
/// <summary>
/// Gets a value indicating whether the packet has been disposed of.
/// </summary>
private bool _isDisposed = false;
-
/// <summary>
/// Releases all resources used by the <see cref="MediaPacket"/> object.
/// </summary>
_isDisposed = true;
}
- internal IntPtr GetHandle()
- {
- ValidateNotDisposed();
-
- Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
-
- return _handle;
- }
-
/// <summary>
/// Validates the current object has not been disposed of.
/// </summary>
throw new ObjectDisposedException("This packet has already been disposed of.");
}
}
+ #endregion
+
+ internal IntPtr GetHandle()
+ {
+ ValidateNotDisposed();
+
+ Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
+
+ return _handle;
+ }
/// <summary>
/// Ensures whether the packet is writable.