From 839fb8555702585251025573c0567c21c08a5d3b Mon Sep 17 00:00:00 2001 From: hsgwon Date: Mon, 16 Sep 2019 16:13:05 +0900 Subject: [PATCH] [MediaTool] Add audio channel mapping APIs for PCM format (#1000) * [MediaTool] Add audio channel mapping APIs for PCM format --- src/Tizen.Multimedia/Interop/Interop.MediaTool.cs | 20 ++ src/Tizen.Multimedia/MediaTool/AudioMediaFormat.cs | 227 +++++++++++++++++++-- .../MediaTool/MediaFormatChannelPosition.cs | 217 ++++++++++++++++++++ src/Tizen.Multimedia/MediaTool/MediaPacket.Lock.cs | 5 +- src/Tizen.Multimedia/MediaTool/MediaPacket.cs | 56 ++--- .../MediaTool/MediaPacketVideoPlane.cs | 7 +- 6 files changed, 486 insertions(+), 46 deletions(-) create mode 100644 src/Tizen.Multimedia/MediaTool/MediaFormatChannelPosition.cs diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaTool.cs b/src/Tizen.Multimedia/Interop/Interop.MediaTool.cs index 35c5e4a..3174f14 100644 --- a/src/Tizen.Multimedia/Interop/Interop.MediaTool.cs +++ b/src/Tizen.Multimedia/Interop/Interop.MediaTool.cs @@ -173,6 +173,26 @@ namespace Tizen.Multimedia [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_aac_header_type")] internal static extern int SetAudioAacType(IntPtr handle, MediaFormatAacType value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_channel_mask")] + internal static extern int SetAudioChannelMask(IntPtr handle, ulong mask); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_channel_mask")] + internal static extern int GetAudioChannelMask(IntPtr handle, out ulong mask); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_is_little_endian")] + internal static extern int IsLittleEndian(IntPtr handle, out bool isLittleEndian); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_bit_depth")] + internal static extern int GetAudioBitDepth(IntPtr handle, out int bitDepth); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_channel_positions_from_mask")] + internal static extern int GetChannelPositionFromMask(IntPtr handle, ulong mask, + out MediaFormatAudioChannelPosition[] position); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_channel_positions_to_mask")] + internal static extern int GetMaskFromChannelPosition(IntPtr handle, + MediaFormatAudioChannelPosition[] position, out ulong mask); #endregion [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_text_info")] diff --git a/src/Tizen.Multimedia/MediaTool/AudioMediaFormat.cs b/src/Tizen.Multimedia/MediaTool/AudioMediaFormat.cs index db99fff..e75bc2e 100644 --- a/src/Tizen.Multimedia/MediaTool/AudioMediaFormat.cs +++ b/src/Tizen.Multimedia/MediaTool/AudioMediaFormat.cs @@ -14,8 +14,12 @@ * limitations under the License. */ using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; using System.Diagnostics; using Tizen.Internals.Errors; +using Native = Tizen.Multimedia.Interop.MediaFormat; namespace Tizen.Multimedia { @@ -66,6 +70,91 @@ namespace Tizen.Multimedia /// 3 public AudioMediaFormat(MediaFormatAudioMimeType mimeType, int channel, int sampleRate, int bit, int bitRate, MediaFormatAacType aacType) + : this(mimeType, channel, sampleRate, bit, bitRate, aacType, 0, null) + { + } + + /// + /// Initializes a new instance of the AudioMediaFormat class with the specified mime type, + /// channel, sample rate, bit, bit rate, bit depth, and audio channel map. + /// + /// + /// If contains , + /// should be set greater than 0.
+ /// If contains , + /// should be set 1.
+ /// User can not set with another channel positions.
+ /// User can not set with another channel positions.
+ /// If same channel position is added in more than once, the duplicaiton will be removed. + ///
+ /// The mime type of the format. + /// The channel value of the format. + /// The sample rate value of the format. + /// The bit value of the format. + /// The bit rate value of the format. + /// The bit depth value of the PCM audio format. + /// The loudspeaker position in PCM audio format. + /// + /// is invalid (i.e. undefined value).
+ ///
+ /// + /// is invalid or mismatched with like the following:
+ /// is not matched correctly with . + /// -or-
+ /// is set to . + /// -or-
+ /// or is set with another channel position. + ///
+ /// + /// , , , or is less than zero. + /// + /// 6 + public AudioMediaFormat(MediaFormatAudioMimeType mimeType, + int channel, int sampleRate, int bit, int bitRate, int bitDepth, IList audioChannelMap) + : this(mimeType, channel, sampleRate, bit, bitRate, MediaFormatAacType.None, bitDepth, audioChannelMap) + { + } + + /// + /// Initializes a new instance of the AudioMediaFormat class with the specified mime type, + /// channel, sample rate, bit, bit rate, bit depth, and audio channel map. + /// + /// + /// If contains , + /// should be set greater than 0.
+ /// If contains , + /// should be set 1.
+ /// User can not set with another channel positions.
+ /// User can not set with another channel positions.
+ /// If same channel position is added in more than twice, its duplicaiton will be removed. + ///
+ /// The mime type of the format. + /// The channel value of the format. + /// The sample rate value of the format. + /// The bit value of the format. + /// The bit rate value of the format. + /// The AAC bitstream format(ADIF or ADTS). + /// The bit depth value of the PCM audio format. + /// The loudspeaker position in PCM audio format. + /// + /// or is invalid (i.e. undefined value).
+ /// -or-
+ /// is not , but is one of the AAC types. + ///
+ /// + /// is invalid or mismatched with like the following:
+ /// is not matched correctly with . + /// -or-
+ /// is set to . + /// -or-
+ /// or is set with another channel position. + ///
+ /// + /// , , , or is less than zero. + /// + /// 6 + public AudioMediaFormat(MediaFormatAudioMimeType mimeType, + int channel, int sampleRate, int bit, int bitRate, MediaFormatAacType aacType, int bitDepth, IList audioChannelMap) : base(MediaFormatType.Audio) { ValidationUtil.ValidateEnum(typeof(MediaFormatAudioMimeType), mimeType, nameof(mimeType)); @@ -99,11 +188,53 @@ namespace Tizen.Multimedia } MimeType = mimeType; + AacType = aacType; Channel = channel; SampleRate = sampleRate; Bit = bit; BitRate = bitRate; - AacType = aacType; + BitDepth = bitDepth; + + if (audioChannelMap != null) + { + audioChannelMap = audioChannelMap.Distinct().OrderBy(p => p).ToList(); + + ValidateAudioChannelMap(audioChannelMap); + + AudioChannelMap = new ReadOnlyCollection(audioChannelMap); + } + } + + private void ValidateAudioChannelMap(IList audioChannelMap) + { + if (audioChannelMap.Contains(MediaFormatAudioChannelPosition.Invaild)) + { + throw new ArgumentException("Invalid channel position.", nameof(audioChannelMap)); + } + + if ((audioChannelMap.Contains(MediaFormatAudioChannelPosition.Mono) && audioChannelMap.Count > 1) || + (audioChannelMap.Contains(MediaFormatAudioChannelPosition.None) && audioChannelMap.Count > 1)) + { + throw new ArgumentException($"Mono and None can not be set with another channel position.", + nameof(audioChannelMap)); + } + + if (audioChannelMap.Contains(MediaFormatAudioChannelPosition.None)) + { + if (Channel <= 0) + { + throw new ArgumentException($"Channel should be greater than 0 in {MediaFormatAudioChannelPosition.None}.", + nameof(audioChannelMap)); + } + } + else + { + if (audioChannelMap.Count != Channel) + { + throw new ArgumentException("Channel should be the same with number of audioChannelMap.", + nameof(audioChannelMap)); + } + } } /// @@ -123,6 +254,19 @@ namespace Tizen.Multimedia Bit = bit; BitRate = bitRate; AacType = IsAacSupportedMimeType(mimeType) ? GetAacType(handle) : MediaFormatAacType.None; + AudioChannelMap = GetAudioChannelMap(handle); + } + + private static ReadOnlyCollection GetAudioChannelMap(IntPtr handle) + { + var ret = Native.GetAudioChannelMask(handle, out ulong mask); + MultimediaDebug.AssertNoError(ret); + + ret = Native.GetChannelPositionFromMask(handle, mask, out MediaFormatAudioChannelPosition[] positions); + MultimediaDebug.AssertNoError(ret); + + return positions == null ? null : + new ReadOnlyCollection(positions.Distinct().OrderBy(p => p).ToList()); } /// @@ -150,7 +294,7 @@ namespace Tizen.Multimedia { Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); - int ret = Interop.MediaFormat.GetAudioInfo(handle, + int ret = Native.GetAudioInfo(handle, out mimeType, out channel, out sampleRate, out bit, out bitRate); MultimediaDebug.AssertNoError(ret); @@ -167,7 +311,7 @@ namespace Tizen.Multimedia { Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); - int ret = Interop.MediaFormat.GetAudioAacType(handle, out var aacType); + int ret = Native.GetAudioAacType(handle, out var aacType); MultimediaDebug.AssertNoError(ret); @@ -180,23 +324,38 @@ namespace Tizen.Multimedia { Debug.Assert(Type == MediaFormatType.Audio); - int ret = Interop.MediaFormat.SetAudioMimeType(handle, MimeType); + int ret = Native.SetAudioMimeType(handle, MimeType); MultimediaDebug.AssertNoError(ret); - ret = Interop.MediaFormat.SetAudioChannel(handle, Channel); + ret = Native.SetAudioChannel(handle, Channel); MultimediaDebug.AssertNoError(ret); - ret = Interop.MediaFormat.SetAudioSampleRate(handle, SampleRate); + ret = Native.SetAudioSampleRate(handle, SampleRate); MultimediaDebug.AssertNoError(ret); - ret = Interop.MediaFormat.SetAudioBit(handle, Bit); + ret = Native.SetAudioBit(handle, Bit); MultimediaDebug.AssertNoError(ret); - ret = Interop.MediaFormat.SetAudioAverageBps(handle, BitRate); + ret = Native.SetAudioAverageBps(handle, BitRate); MultimediaDebug.AssertNoError(ret); - ret = Interop.MediaFormat.SetAudioAacType(handle, AacType); + ret = Native.SetAudioAacType(handle, AacType); MultimediaDebug.AssertNoError(ret); + + if (AudioChannelMap != null) + { + ret = Native.SetAudioChannelMask(handle, GetAudioChannelMask(handle, AudioChannelMap)); + MultimediaDebug.AssertNoError(ret); + } + } + + private static ulong GetAudioChannelMask(IntPtr handle, IList audioChannelMap) + { + int ret = Native.GetMaskFromChannelPosition(handle, audioChannelMap.ToArray(), + out ulong mask); + MultimediaDebug.AssertNoError(ret); + + return mask; } /// @@ -212,6 +371,18 @@ namespace Tizen.Multimedia public int Channel { get; } /// + /// Gets or sets the list of channel position value of PCM audio format. + /// + /// + /// The channel mask specifies the mapping of channels to speakers. + /// default value is 0. + /// + /// + /// + /// 6 + public ReadOnlyCollection AudioChannelMap { get; } + + /// /// Gets the sample rate value of the current format. /// /// 3 @@ -230,6 +401,12 @@ namespace Tizen.Multimedia public int BitRate { get; } /// + /// Gets the bit depth value of the current format. + /// + /// 6 + public int BitDepth { get; } + + /// /// Gets the AAC type of the current format. /// /// 3 @@ -241,8 +418,17 @@ namespace Tizen.Multimedia /// A string that represents the current object. /// 3 public override string ToString() - => $@"MimeType={ MimeType.ToString() }, Channel={ Channel.ToString() }, SampleRate= - { SampleRate }, Bit={ Bit.ToString() }, BitRate={ BitRate.ToString() }, AacType={ AacType.ToString() }"; + { + var toString = $@"MimeType={ MimeType.ToString() }, Channel={ Channel.ToString() }, SampleRate={ SampleRate }, + Bit={ Bit.ToString() }, BitRate={ BitRate.ToString() }, BitDepth={ BitDepth.ToString() }, AacType={ AacType.ToString()}"; + + if (AudioChannelMap != null) + { + toString += ", AudioChannelMap=" + $"{string.Join(",", AudioChannelMap)}"; + } + + return toString; + } /// /// Compares an object to an instance of for equality. @@ -258,8 +444,23 @@ namespace Tizen.Multimedia return false; } + var mapCompare = true; + // We don't care the case of both properties are null. + if (AudioChannelMap != null && rhs.AudioChannelMap != null) + { + for (int i = 0; i < AudioChannelMap.Count; i++) + { + mapCompare = AudioChannelMap[i].Equals(rhs.AudioChannelMap[i]); + } + } + else if ((AudioChannelMap == null && rhs.AudioChannelMap != null) || + (AudioChannelMap != null && rhs.AudioChannelMap == null)) + { + mapCompare = false; + } + return MimeType == rhs.MimeType && Channel == rhs.Channel && SampleRate == rhs.SampleRate && - Bit == rhs.Bit && BitRate == rhs.BitRate && AacType == rhs.AacType; + Bit == rhs.Bit && BitRate == rhs.BitRate && BitDepth == rhs.BitDepth && AacType == rhs.AacType && mapCompare; } /// @@ -268,6 +469,6 @@ namespace Tizen.Multimedia /// The hash code for this instance of . /// 3 public override int GetHashCode() - => new { MimeType, Channel, SampleRate, Bit, BitRate, AacType }.GetHashCode(); + => new { MimeType, Channel, SampleRate, Bit, BitRate, BitDepth, AacType, AudioChannelMap }.GetHashCode(); } } diff --git a/src/Tizen.Multimedia/MediaTool/MediaFormatChannelPosition.cs b/src/Tizen.Multimedia/MediaTool/MediaFormatChannelPosition.cs new file mode 100644 index 0000000..9e06ce6 --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaFormatChannelPosition.cs @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2019 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 +{ + /// + /// Specifies the channel position of media format. + /// + /// This type is based on SMPTE 2036-2-2008 standard. + /// + /// 6 + public enum MediaFormatAudioChannelPosition + { + /// + /// This is used for position-less channels. + /// + /// 6 + None = -3, + + /// + /// Mono channel. + /// + /// If user want to set this value, should be 1. + /// 6 + Mono = -2, + + /// + /// Invalid position. + /// + /// 6 + Invaild = -1, + + /// + /// A loudspeaker position located at far left and centered vertically with the middle layer. + /// + /// 6 + FrontLeft = 0, + + /// + /// A loudspeaker position located at far right and centered vertically with the middle layer. + /// + /// 6 + FrontRight, + + /// + /// A loudspeaker position located at the middle layer corresponding to the center of the television + /// screen as viewed from the seating area. + /// + /// 6 + FrontCenter, + + /// + /// A Low Frequency Effects(band-limited low frequency channel) loudspeaker position located at + /// the bottom layer and normally far left front, when LFE2 is used. + /// + /// 6 + LFE1, + + /// + /// A loudspeaker position located at far left back of the middle layer. + /// + /// 6 + BackLeft, + + /// + /// A loudspeaker position located at far right back of the middle layer. + /// + /// 6 + BackRight, + + /// + /// A loudspeaker position located mid-way between the front center and front left of the middle layer. + /// + /// 6 + FrontLeftOrCenter, + + /// + /// A loudspeaker position located mid-way between the front center and front right of the middle layer. + /// + /// 6 + FrontRightOrCenter, + + /// + /// A loudspeaker position located at center back of the middle layer. + /// + /// 6 + BackCenter, + + /// + /// A Low Frequency Effects(band-limited low frequency channel) loudspeaker position located at the + /// bottom layer, and is normally at far right front of the bottom layer, when LFE1 is used. + /// + /// 6 + LFE2, + + /// + /// A loudspeaker position located at left side of the middle layer. + /// + /// 6 + SideLeft, + + /// + /// A loudspeaker position located at right side of the middle layer. + /// + /// 6 + SideRight, + + /// + /// A loudspeaker position located at far left front of the top layer. + /// + /// 6 + TopFrontLeft, + + /// + /// A loudspeaker position located at far right front of the top layer. + /// + /// 6 + TopFrontRight, + + /// + /// A loudspeaker position located at center front of the top layer. + /// + /// 6 + TopFrontCenter, + + /// + /// A loudspeaker position located at the center of the top layer directly above the seating area. + /// + /// 6 + TopCenter, + + /// + /// A loudspeaker position located at far left back of the top layer. + /// + /// 6 + TopBackLeft, + + /// + /// A loudspeaker position located at far right back of the top layer. + /// + /// 6 + TopBackRight, + + /// + /// A loudspeaker position located at left side of the top layer. + /// + /// 6 + TopSideLeft, + + /// + /// A loudspeaker position located at right side of the top layer. + /// + /// 6 + TopSideRight, + + /// + /// A loudspeaker position located at center back of the top layer. + /// + /// 6 + TopBackCenter, + + /// + /// A loudspeaker position located at center front of the bottom layer. + /// + /// 6 + BottomFrontCenter, + + /// + /// A loudspeaker position located at far left front of the bottom layer. + /// + /// 6 + BottomFrontLeft, + + /// + /// A loudspeaker position located at far right front of the bottom layer. + /// + /// 6 + BottomFrontRight, + + /// + /// A loudspeaker position located between front left and side left. + /// + /// 6 + WideLeft, + + /// + /// A loudspeaker position located between front right and side right. + /// + /// 6 + WideRight, + + /// + /// A loudspeaker position located between back left and side left. + /// + /// 6 + SurroundLeft, + + /// + /// A loudspeaker position located between back right and side right. + /// + /// 6 + SurroundRight + } +} diff --git a/src/Tizen.Multimedia/MediaTool/MediaPacket.Lock.cs b/src/Tizen.Multimedia/MediaTool/MediaPacket.Lock.cs index 5629119..94706d4 100644 --- a/src/Tizen.Multimedia/MediaTool/MediaPacket.Lock.cs +++ b/src/Tizen.Multimedia/MediaTool/MediaPacket.Lock.cs @@ -19,6 +19,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; using System.Threading; using Tizen.Internals.Errors; +using Native = Tizen.Multimedia.Interop.MediaPacket; namespace Tizen.Multimedia { @@ -136,14 +137,14 @@ namespace Tizen.Multimedia private void SetExtra(IntPtr ptr) { - int ret = Interop.MediaPacket.SetExtra(_packet._handle, ptr); + int ret = Native.SetExtra(_packet._handle, ptr); MultimediaDebug.AssertNoError(ret); } private static IntPtr GetExtra(IntPtr handle) { - int ret = Interop.MediaPacket.GetExtra(handle, out var value); + int ret = Native.GetExtra(handle, out var value); MultimediaDebug.AssertNoError(ret); diff --git a/src/Tizen.Multimedia/MediaTool/MediaPacket.cs b/src/Tizen.Multimedia/MediaTool/MediaPacket.cs index 54ca5b1..43ba0c4 100644 --- a/src/Tizen.Multimedia/MediaTool/MediaPacket.cs +++ b/src/Tizen.Multimedia/MediaTool/MediaPacket.cs @@ -16,9 +16,9 @@ using System; using System.Diagnostics; -using System.Runtime.InteropServices; -using System.Threading; using Tizen.Internals.Errors; +using Native = Tizen.Multimedia.Interop.MediaPacket; +using NativeFormat = Tizen.Multimedia.Interop.MediaFormat; namespace Tizen.Multimedia { @@ -59,7 +59,7 @@ namespace Tizen.Multimedia { _handle = handle; - int ret = Interop.MediaPacket.GetFormat(handle, out IntPtr formatHandle); + int ret = Native.GetFormat(handle, out IntPtr formatHandle); MultimediaDebug.AssertNoError(ret); @@ -72,7 +72,7 @@ namespace Tizen.Multimedia } finally { - Interop.MediaFormat.Unref(formatHandle); + NativeFormat.Unref(formatHandle); } } @@ -103,7 +103,7 @@ namespace Tizen.Multimedia { formatHandle = format.AsNativeHandle(); - int ret = Interop.MediaPacket.Create(formatHandle, IntPtr.Zero, IntPtr.Zero, out _handle); + int ret = Native.Create(formatHandle, IntPtr.Zero, IntPtr.Zero, out _handle); MultimediaDebug.AssertNoError(ret); Debug.Assert(_handle != IntPtr.Zero, "Created handle must not be null"); @@ -114,7 +114,7 @@ namespace Tizen.Multimedia { if (_handle != IntPtr.Zero) { - Interop.MediaPacket.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } @@ -124,7 +124,7 @@ namespace Tizen.Multimedia { if (formatHandle != IntPtr.Zero) { - Interop.MediaFormat.Unref(formatHandle); + NativeFormat.Unref(formatHandle); } } } @@ -135,7 +135,7 @@ namespace Tizen.Multimedia /// Operation failed. private void Alloc() { - ErrorCode ret = (ErrorCode)Interop.MediaPacket.Alloc(_handle); + ErrorCode ret = (ErrorCode)Native.Alloc(_handle); if (ret == ErrorCode.None) { return; @@ -183,7 +183,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.GetPts(_handle, out var value); + int ret = Native.GetPts(_handle, out var value); MultimediaDebug.AssertNoError(ret); @@ -194,7 +194,7 @@ namespace Tizen.Multimedia ValidateNotDisposed(); ValidateNotLocked(); - int ret = Interop.MediaPacket.SetPts(_handle, value); + int ret = Native.SetPts(_handle, value); MultimediaDebug.AssertNoError(ret); } @@ -214,7 +214,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.GetDts(_handle, out var value); + int ret = Native.GetDts(_handle, out var value); MultimediaDebug.AssertNoError(ret); return value; @@ -224,7 +224,7 @@ namespace Tizen.Multimedia ValidateNotDisposed(); ValidateNotLocked(); - int ret = Interop.MediaPacket.SetDts(_handle, value); + int ret = Native.SetDts(_handle, value); MultimediaDebug.AssertNoError(ret); } } @@ -243,7 +243,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.GetDuration(_handle, out var value); + int ret = Native.GetDuration(_handle, out var value); MultimediaDebug.AssertNoError(ret); return value; @@ -253,7 +253,7 @@ namespace Tizen.Multimedia ValidateNotDisposed(); ValidateNotLocked(); - int ret = Interop.MediaPacket.SetDuration(_handle, value); + int ret = Native.SetDuration(_handle, value); MultimediaDebug.AssertNoError(ret); } } @@ -270,7 +270,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.IsEncoded(_handle, out var value); + int ret = Native.IsEncoded(_handle, out var value); MultimediaDebug.AssertNoError(ret); return value; @@ -292,7 +292,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.GetRotation(_handle, out var value); + int ret = Native.GetRotation(_handle, out var value); MultimediaDebug.AssertNoError(ret); var rotation = value < RotationFlip.HorizontalFlip ? (Rotation)value : Rotation.Rotate0; @@ -305,7 +305,7 @@ namespace Tizen.Multimedia ValidateNotLocked(); ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(value)); - int ret = Interop.MediaPacket.SetRotation(_handle, (RotationFlip)value); + int ret = Native.SetRotation(_handle, (RotationFlip)value); MultimediaDebug.AssertNoError(ret); } } @@ -328,7 +328,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.GetRotation(_handle, out var value); + int ret = Native.GetRotation(_handle, out var value); MultimediaDebug.AssertNoError(ret); var flip = (value < RotationFlip.HorizontalFlip) ? Flips.None : @@ -349,7 +349,7 @@ namespace Tizen.Multimedia var flip = value == Flips.Horizontal ? RotationFlip.HorizontalFlip : RotationFlip.VerticalFlip; - int ret = Interop.MediaPacket.SetRotation(_handle, flip); + int ret = Native.SetRotation(_handle, flip); MultimediaDebug.AssertNoError(ret); } } @@ -400,7 +400,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.GetBufferSize(_handle, out var value); + int ret = Native.GetBufferSize(_handle, out var value); MultimediaDebug.AssertNoError(ret); Debug.Assert(value < int.MaxValue); @@ -426,7 +426,7 @@ namespace Tizen.Multimedia "value must be less than Buffer.Size."); } - int ret = Interop.MediaPacket.SetBufferSize(_handle, (ulong)value); + int ret = Native.SetBufferSize(_handle, (ulong)value); MultimediaDebug.AssertNoError(ret); } } @@ -476,7 +476,7 @@ namespace Tizen.Multimedia { ValidateNotDisposed(); - int ret = Interop.MediaPacket.GetBufferFlags(_handle, out var value); + int ret = Native.GetBufferFlags(_handle, out var value); MultimediaDebug.AssertNoError(ret); @@ -488,11 +488,11 @@ namespace Tizen.Multimedia ValidateNotDisposed(); ValidateNotLocked(); - int ret = Interop.MediaPacket.ResetBufferFlags(_handle); + int ret = Native.ResetBufferFlags(_handle); MultimediaDebug.AssertNoError(ret); - ret = Interop.MediaPacket.SetBufferFlags(_handle, (int)value); + ret = Native.SetBufferFlags(_handle, (int)value); MultimediaDebug.AssertNoError(ret); } @@ -543,7 +543,7 @@ namespace Tizen.Multimedia if (_handle != IntPtr.Zero) { - Interop.MediaPacket.Destroy(_handle); + Native.Destroy(_handle); _handle = IntPtr.Zero; } @@ -606,7 +606,7 @@ namespace Tizen.Multimedia { Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!"); - int ret = Interop.MediaPacket.GetNumberOfVideoPlanes(_handle, out var numberOfPlanes); + int ret = Native.GetNumberOfVideoPlanes(_handle, out var numberOfPlanes); MultimediaDebug.AssertNoError(ret); @@ -630,12 +630,12 @@ namespace Tizen.Multimedia Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!"); - int ret = Interop.MediaPacket.GetBufferData(_handle, out var dataHandle); + int ret = Native.GetBufferData(_handle, out var dataHandle); MultimediaDebug.AssertNoError(ret); Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!"); - ret = Interop.MediaPacket.GetAllocatedBufferSize(_handle, out var size); + ret = Native.GetAllocatedBufferSize(_handle, out var size); MultimediaDebug.AssertNoError(ret); Debug.Assert(size >= 0, "size must not be negative!"); diff --git a/src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs b/src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs index a751126..31ffcb2 100644 --- a/src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs +++ b/src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs @@ -16,6 +16,7 @@ using System; using System.Diagnostics; +using Native = Tizen.Multimedia.Interop.MediaPacket; namespace Tizen.Multimedia { @@ -39,15 +40,15 @@ namespace Tizen.Multimedia _packet = packet; - int ret = Interop.MediaPacket.GetVideoStrideWidth(packet.GetHandle(), index, out _strideWidth); + int ret = Native.GetVideoStrideWidth(packet.GetHandle(), index, out _strideWidth); MultimediaDebug.AssertNoError(ret); - ret = Interop.MediaPacket.GetVideoStrideHeight(packet.GetHandle(), index, out _strideHeight); + ret = Native.GetVideoStrideHeight(packet.GetHandle(), index, out _strideHeight); MultimediaDebug.AssertNoError(ret); Debug.Assert(_strideWidth >= 0 && _strideHeight >= 0, "size must not be negative!"); - ret = Interop.MediaPacket.GetVideoPlaneData(packet.GetHandle(), index, out var dataHandle); + ret = Native.GetVideoPlaneData(packet.GetHandle(), index, out var dataHandle); MultimediaDebug.AssertNoError(ret); Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!"); -- 2.7.4