- Temporarily comment out a line resetting extra of a packet. It needs to be rollbacked after the corresponding c-layer api is fixed.
Change-Id: Ic0a56ebc9f15dbef4280edc166f0f4ef8d60c953
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
+/*
+ * Copyright (c) 2016 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 Tizen.Internals.Errors;
{
if (handle == IntPtr.Zero)
{
- throw new ArgumentNullException("The handle value is null.");
+ throw new ArgumentException("The handle value is invalid.");
}
int type = 0;
return handle;
}
+ internal static void ReleaseNativeHandle(IntPtr handle)
+ {
+ Interop.MediaFormat.Unref(handle);
+ }
+
/// <summary>
/// Fill out properties of a native media format with the current media format object.
/// </summary>
MediaToolDebug.AssertNoError(ret);
}
+
+ public override string ToString()
+ {
+ return $"[{ nameof(ContainerMediaFormat) }] MimeType : { _mimeType }";
+ }
+
}
/// <summary>
return _bitRate;
}
}
+
+ public override string ToString()
+ {
+ return $"[{ nameof(VideoMediaFormat) }] MimeType : { _mimeType }, Width : { _width }, "
+ + $"Height : { _height }, FrameRate : { _frameRate }, BitRate : { _bitRate }";
+ }
}
/// <summary>
return _aacType;
}
}
+
+ public override string ToString()
+ {
+ return $"[{ nameof(AudioMediaFormat) }] MimeType : { _mimeType }, Channel : { _channel }, "
+ + $"SampleRate : { _sampleRate }, Bit : { _bit }, BitRate : { _bitRate }, AacType : { _aacType }";
+ }
}
/// <summary>
return _textType;
}
}
+
+ public override string ToString()
+ {
+ return $"[{ nameof(TextMediaFormat) }] MimeType : { _mimeType }, TextType : { _textType }";
+ }
}
}
+/*
+ * Copyright (c) 2016 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
{
public enum MediaFormatAacType
+/*
+ * Copyright (c) 2016 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>
/// <summary>
/// L16, Audio
/// </summary>
- L16 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1010),
+ //L16 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1010),
/// <summary>
/// ALAW, Audio
/// </summary>
- ALaw = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1020),
+ //ALaw = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1020),
/// <summary>
/// ULAW, Audio
/// </summary>
- ULaw = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1030),
+ //ULaw = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1030),
/// <summary>
/// AMR, Audio, Alias for AmrNB
/// <summary>
/// G729, Audio
/// </summary>
- G729 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1050),
+ //G729 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1050),
/// <summary>
/// AAC, Audio, Alias for AacLc
/// <summary>
/// PCM signed 16-bit little-endian, Audio
/// </summary>
- PcmS16LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1510),
+ //PcmS16LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1510),
/// <summary>
/// PCM signed 24-bit little-endian, Audio
/// </summary>
- PcmS24LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1511),
+ //PcmS24LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1511),
/// <summary>
/// PCM signed 32-bit little-endian, Audio
/// </summary>
- Pcm32LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1512),
+ //Pcm32LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1512),
/// <summary>
/// PCM signed 16-bit big-endian, Audio
/// </summary>
- PcmS16BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1513),
+ //PcmS16BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1513),
/// <summary>
/// PCM signed 24-bit big-endian, Audio
/// </summary>
- PcmS24BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1514),
+ //PcmS24BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1514),
/// <summary>
/// PCM signed 32-bit big-endian, Audio
/// </summary>
- PcmS32BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1515),
+ //PcmS32BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1515),
/// <summary>
/// PCM 32-bit floating point little-endian, Audio
/// </summary>
- PcmF32LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1516),
+ //PcmF32LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1516),
/// <summary>
/// PCM 32-bit floating point big-endian, Audio
/// </summary>
- PcmF32BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1517),
+ //PcmF32BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1517),
/// <summary>
/// PCM A-law, Audio
/// </summary>
- PcmALaw = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1520),
+ //PcmALaw = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1520),
/// <summary>
/// PCM U-law, Audio
/// </summary>
- PcmULaw = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1530),
+ //PcmULaw = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1530),
}
/// <summary>
/// <summary>
/// H263 Baseline Profile
/// </summary>
- H263BP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2022),
+ //H263BP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2022),
/// <summary>
/// H263 H.320 Coding Efficiency Profile
/// </summary>
- H263H320Cep = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2023),
+ //H263H320Cep = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2023),
/// <summary>
/// H263 Backward-Compatibility Profile
/// </summary>
- H263Bcp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2024),
+ //H263Bcp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2024),
/// <summary>
/// H263 Interactive and Streaming Wireless Profile
/// </summary>
- H263Isw2p = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2025),
+ //H263Isw2p = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2025),
/// <summary>
/// H263 Interactive and Streaming Wireless Profile
/// </summary>
- H263Isw3p = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2026),
+ //H263Isw3p = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2026),
/// <summary>
/// H263 Conversation High Compression Profile
/// </summary>
- H263Chcp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2027),
+ //H263Chcp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2027),
/// <summary>
/// H263 Conversational Internet Profile
/// </summary>
- H263CInternetP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2028),
+ //H263CInternetP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2028),
/// <summary>
/// H263 Conversational Interlace Profile
/// </summary>
- H263CInterlaceP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2029),
+ //H263CInterlaceP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2029),
/// <summary>
/// H263 High Latency Profile
/// </summary>
- H263Hlp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x202A),
+ //H263Hlp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x202A),
/// <summary>
/// H264_SP
/// <summary>
/// H264 Extended Profile
/// </summary>
- H264XP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2033),
+ //H264XP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2033),
/// <summary>
/// H264 High10 Profile
/// </summary>
- H264H10P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2034),
+ //H264H10P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2034),
/// <summary>
/// H264 High422 Profile
/// </summary>
- H264H422P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2035),
+ //H264H422P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2035),
/// <summary>
/// H264 High444 Profile
/// </summary>
- H264H444P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2036),
+ //H264H444P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2036),
/// <summary>
/// H264 CAVLC444 Profile
/// </summary>
- H264C444P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2037),
+ //H264C444P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2037),
/// <summary>
/// MJPEG
/// <summary>
/// HEVC
/// </summary>
- Hevc = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2080),
+ //Hevc = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2080),
/// <summary>
/// HEVC Main Profile
/// </summary>
- HevcMP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2081),
+ //HevcMP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2081),
/// <summary>
/// HEVC Main10 Profile
/// </summary>
- HevcM10P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2082),
+ //HevcM10P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2082),
/// <summary>
/// VP8
/// </summary>
- VP8 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2090),
+ //VP8 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2090),
/// <summary>
/// VP9
/// </summary>
- VP9 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x20A0),
+ //VP9 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x20A0),
/// <summary>
/// VC1
/// </summary>
- VC1 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x20B0),
+ //VC1 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x20B0),
/// <summary>
/// I420
/// <summary>
/// HW dependent
/// </summary>
- NativeVideo = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x7000),
+ //NativeVideo = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x7000),
}
public enum MediaFormatContainerMimeType
+/*
+ * Copyright (c) 2016 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>
+ /// Specifies text types.
+ /// </summary>
public enum MediaFormatTextType
{
+ /// <summary>
+ /// This indicates no type specified.
+ /// </summary>
None,
+
+ /// <summary>
+ /// The mp4 type.
+ /// </summary>
Mp4,
+
+ /// <summary>
+ /// The 3gp type.
+ /// </summary>
ThreeGpp
}
}
+/*
+ * Copyright (c) 2016 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 System.Runtime.InteropServices;
/// <summary>
/// Initializes a new instance of the MediaPacket class with the specified media format.
/// </summary>
- /// <param name="format">A media format containing properties for the packet.</param>
+ /// <param name="format">The media format containing properties for the packet.</param>
/// <exception cref="System.ArgumentNullException">format is null.</exception>
/// <exception cref="System.ArgumentException">
/// <see cref="MediaFormatType"/> of the specified format is <see cref="MediaFormatType.Container"/>.</exception>
{
if (format == null)
{
- throw new ArgumentNullException("MediaFormat must be not null.");
+ throw new ArgumentNullException(nameof(format));
}
if (format.Type == MediaFormatType.Container)
/// <summary>
/// Initializes a new instance of the MediaPacket class from a native handle.
/// </summary>
- /// <param name="handle">A native handle.</param>
+ /// <param name="handle">The native handle to be used.</param>
internal MediaPacket(IntPtr handle)
{
_handle = handle;
/// <summary>
/// Creates and initializes a native handle for the current object.
/// </summary>
- /// <param name="format">A format to be set to the media format.</param>
+ /// <param name="format">The format to be set to the media format.</param>
/// <exception cref="NotEnoughMemoryException">Out of memory.</exception>
/// <exception cref="System.InvalidOperationException">Operation failed.</exception>
private void Initialize(MediaFormat format)
/// </exception>
public void Dispose()
{
+ if (_isDisposed)
+ {
+ return;
+ }
ValidateNotLocked();
Dispose(true);
/// <summary>
/// Retrieves video planes of the current packet.
/// </summary>
- /// <returns><see cref="MediaPacketVideoPlane"/>s allocated to the current MediaPacket.</returns>
+ /// <returns>The <see cref="MediaPacketVideoPlane"/>s allocated to the current MediaPacket.</returns>
private MediaPacketVideoPlane[] GetVideoPlanes()
{
Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
/// <summary>
/// Retrieves the buffer of the current packet.
/// </summary>
- /// <returns>A <see cref="MediaPacketBuffer"/> allocated to the current MediaPacket.</returns>
+ /// <returns>The <see cref="MediaPacketBuffer"/> allocated to the current MediaPacket.</returns>
private MediaPacketBuffer GetBuffer()
{
Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
IntPtr dataHandle = IntPtr.Zero;
- int size = 0;
int ret = Interop.MediaPacket.GetBufferData(_handle, out dataHandle);
MediaToolDebug.AssertNoError(ret);
Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!");
+ int size = 0;
ret = Interop.MediaPacket.GetAllocatedBufferSize(_handle, out size);
MediaToolDebug.AssertNoError(ret);
_packet._lock.SetLock();
- //TODO need test
_gcHandle = GCHandle.Alloc(this);
SetExtra(GCHandle.ToIntPtr(_gcHandle));
{
if (!_isDisposed)
{
- SetExtra(IntPtr.Zero);
+ // TODO rollback after the corresponding native api is fixed.
+ //SetExtra(IntPtr.Zero);
if (_gcHandle.IsAllocated)
{
/// <summary>
/// Creates an object of the MediaPacekt with the specified <see cref="MediaFormat"/>.
/// </summary>
- /// <param name="format">A media format for the new packet.</param>
+ /// <param name="format">The media format for the new packet.</param>
/// <returns>A new MediaPacket object.</returns>
public static MediaPacket Create(MediaFormat format)
{
+/*
+ * Copyright (c) 2016 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 System.Runtime.InteropServices;
+/*
+ * Copyright (c) 2016 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;
namespace Tizen.Multimedia
{
+ /// <summary>
+ /// Specifies the flag for a buffer.
+ /// <para>
+ /// This enumeration has a <see cref="FlagsAttribute"/> attribute that allows a bitwise combination of its member values.
+ /// </para>
+ /// </summary>
[Flags]
public enum MediaPacketBufferFlags
{
+ /// <summary>
+ /// The buffer contains codec initialization or codec specific data instead of media data
+ /// </summary>
CodecConfig = 0x1,
+
+ /// <summary>
+ /// The buffer indicates the end of stream.
+ /// </summary>
EndOfStream = 0x2,
+
+ /// <summary>
+ /// The buffer contains a sync frame.
+ /// </summary>
SyncFrame = 0x4,
}
}
+/*
+ * Copyright (c) 2016 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;
+/*
+ * Copyright (c) 2016 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.Diagnostics;
using Tizen.Internals.Errors;
+/*
+ * Copyright (c) 2016 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;
namespace Tizen.Multimedia