internal static partial class Interop
{
- internal static partial class Libraries
- {
- public const string Player = "libcapi-media-player.so.0";
- public const string Recorder = "libcapi-media-recorder.so.0";
- public const string SoundManager = "libcapi-media-sound-manager.so.0";
- public const string AudioIO = "libcapi-media-audio-io.so.0";
- public const string MetadataExtractor = "libcapi-media-metadata-extractor.so.0";
- public const string MediaController = "libcapi-media-controller.so.0";
- public const string Libc = "libc.so.6";
- }
+ internal static partial class Libraries
+ {
+ public const string Player = "libcapi-media-player.so.0";
+ public const string Recorder = "libcapi-media-recorder.so.0";
+ public const string SoundManager = "libcapi-media-sound-manager.so.0";
+ public const string AudioIO = "libcapi-media-audio-io.so.0";
+ public const string MetadataExtractor = "libcapi-media-metadata-extractor.so.0";
+ public const string MediaController = "libcapi-media-controller.so.0";
+ public const string MediaTool = "libcapi-media-tool.so.0";
+ public const string MediaCodec = "libcapi-media-codec.so.0";
+ public const string Libc = "libc.so.6";
+ }
}
--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal static class MediaCodec
+ {
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void InputBufferUsedCallback(IntPtr mediaPacket, IntPtr arg);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void OutputBufferAvailableCallback(IntPtr mediaPacket, IntPtr arg);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void ErrorCallback(int errorCode, IntPtr arg);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void EosCallback(IntPtr arg);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate void BufferStatusCallback(int statusCode, IntPtr arg);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ internal delegate bool SupportedCodecCallback(int codecType, IntPtr arg);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_create")]
+ internal static extern int Create(out IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_destroy")]
+ internal static extern int Destroy(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_codec")]
+ internal static extern int Configure(IntPtr handle, int codecType, int flags);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_vdec_info")]
+ internal static extern int SetVideoDecoderInfo(IntPtr handle, int width, int height);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_venc_info")]
+ internal static extern int SetVideoEncoderInfo(IntPtr handle, int width, int height,
+ int fps, int targetBits);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_adec_info")]
+ internal static extern int SetAudioDecoderInfo(IntPtr handle, int sampleRate, int channel,
+ int bit);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_aenc_info")]
+ internal static extern int SetAudioEncoderInfo(IntPtr handle, int sampleRate, int channel,
+ int bit, int bitRate);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_prepare")]
+ internal static extern int Prepare(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unprepare")]
+ internal static extern int Unprepare(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_process_input")]
+ internal static extern int Process(IntPtr handle, IntPtr mediaPacket, ulong timeoutInUs);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_get_output")]
+ internal static extern int GetOutput(IntPtr handle, out IntPtr packet, ulong timeoutInUs);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_flush_buffers")]
+ internal static extern int FlushBuffers(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_input_buffer_used_cb")]
+ internal static extern int SetInputBufferUsedCb(IntPtr handle,
+ InputBufferUsedCallback cb, IntPtr arg);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_input_buffer_used_cb")]
+ internal static extern int UnsetInputBufferUsedCb(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_output_buffer_available_cb")]
+ internal static extern int SetOutputBufferAvaiableCb(IntPtr handle,
+ OutputBufferAvailableCallback cb, IntPtr arg);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_output_buffer_available_cb")]
+ internal static extern int UnsetOutputBufferAvaiableCb(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_error_cb")]
+ internal static extern int SetErrorCb(IntPtr handle, ErrorCallback cb, IntPtr arg);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_error_cb")]
+ internal static extern int UnsetErrorCb(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_eos_cb")]
+ internal static extern int SetEosCb(IntPtr handle, EosCallback cb, IntPtr arg);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_eos_cb")]
+ internal static extern int UnsetEosCb(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_buffer_status_cb")]
+ internal static extern int SetBufferStatusCb(IntPtr handle, BufferStatusCallback cb,
+ IntPtr arg);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_buffer_status_cb")]
+ internal static extern int UnsetBufferStatusCb(IntPtr handle);
+
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_get_supported_type")]
+ internal static extern int GetSupportedType(IntPtr handle, int codecType, bool isEncoder,
+ out int value);
+
+ // TODO the native method name needs to get replaced with new one which will be added
+ [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_foreach_supported_codec")]
+ internal static extern int ForeachSupportedCodec(SupportedCodecCallback cb, IntPtr arg);
+ }
+}
--- /dev/null
+using System;
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal static class MediaPacket
+ {
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_create")]
+ internal static extern int Create(IntPtr format, IntPtr finalizeCb, IntPtr cbData, out IntPtr handle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_alloc")]
+ internal static extern int Alloc(IntPtr handle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_destroy")]
+ internal static extern int Destroy(IntPtr handle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_format")]
+ internal static extern int GetFormat(IntPtr handle, out IntPtr format);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_buffer_data_ptr")]
+ internal static extern int GetBufferData(IntPtr handle, out IntPtr dataHandle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_buffer_size")]
+ internal static extern int GetBufferSize(IntPtr handle, out ulong size);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_buffer_size")]
+ internal static extern int SetBufferSize(IntPtr handle, ulong size);
+
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_allocated_buffer_size")]
+ internal static extern int GetAllocatedBufferSize(IntPtr handle, out int size);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_number_of_video_planes")]
+ internal static extern int GetNumberOfVideoPlanes(IntPtr handle, out uint num);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_stride_width")]
+ internal static extern int GetVideoStrideWidth(IntPtr handle, int planeIndex, out int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_stride_height")]
+ internal static extern int GetVideoStrideHeight(IntPtr handle, int planeIndex, out int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_plane_data_ptr")]
+ internal static extern int GetVideoPlaneData(IntPtr handle, int planeIndex, out IntPtr dataHandle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_is_encoded")]
+ internal static extern int IsEncoded(IntPtr handle, out bool value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_flags")]
+ internal static extern int GetBufferFlags(IntPtr handle, out int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_flags")]
+ internal static extern int SetBufferFlags(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_reset_flags")]
+ internal static extern int ResetBufferFlags(IntPtr handle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_pts")]
+ internal static extern int GetPts(IntPtr handle, out ulong value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_dts")]
+ internal static extern int GetDts(IntPtr handle, out ulong value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_pts")]
+ internal static extern int SetPts(IntPtr handle, ulong value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_dts")]
+ internal static extern int SetDts(IntPtr handle, ulong value);
+
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_extra")]
+ internal static extern int SetExtra(IntPtr handle, IntPtr value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_extra")]
+ internal static extern int GetExtra(IntPtr handle, out IntPtr value);
+ }
+
+ internal static class MediaFormat
+ {
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_create")]
+ internal static extern int Create(out IntPtr handle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_unref")]
+ internal static extern int Unref(IntPtr handle);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_type")]
+ internal static extern int GetType(IntPtr handle, out int type);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_container_mime")]
+ internal static extern int GetContainerMimeType(IntPtr handle, out int mimeType);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_container_mime")]
+ internal static extern int SetContainerMimeType(IntPtr handle, int mimeType);
+
+ #region Video apis
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_video_info")]
+ internal static extern int GetVideoInfo(IntPtr handle, out int mimeType,
+ out int width, out int height, out int averageBps, out int maxBps);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_video_frame_rate")]
+ internal static extern int GetVideoFrameRate(IntPtr handle, out int frameRate);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_mime")]
+ internal static extern int SetVideoMimeType(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_width")]
+ internal static extern int SetVideoWidth(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_height")]
+ internal static extern int SetVideoHeight(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_avg_bps")]
+ internal static extern int SetVideoAverageBps(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_frame_rate")]
+ internal static extern int SetVideoFrameRate(IntPtr handle, int value);
+ #endregion
+
+ #region Audio apis
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_info")]
+ internal static extern int GetAudioInfo(IntPtr handle, out int mimeType,
+ out int channel, out int sampleRate, out int bit, out int averageBps);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_aac_header_type")]
+ internal static extern int GetAudioAacType(IntPtr handle, out int aacType);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_mime")]
+ internal static extern int SetAudioMimeType(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_channel")]
+ internal static extern int SetAudioChannel(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_samplerate")]
+ internal static extern int SetAudioSampleRate(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_bit")]
+ internal static extern int SetAudioBit(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_avg_bps")]
+ internal static extern int SetAudioAverageBps(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_aac_header_type")]
+ internal static extern int SetAudioAacType(IntPtr handle, int value);
+ #endregion
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_text_info")]
+ internal static extern int GetTextInfo(IntPtr handle, out int mimeType, out int textType);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_mime")]
+ internal static extern int SetTextMimeType(IntPtr handle, int value);
+
+ [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_type")]
+ internal static extern int SetTextType(IntPtr handle, int value);
+ }
+}
--- /dev/null
+using System;
+using System.Diagnostics;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// MediaFormat is a base class for media formats.
+ /// </summary>
+ public abstract class MediaFormat
+ {
+ /// <summary>
+ /// Initializes a new instance of the ContainerMediaFormat class with a type.
+ /// </summary>
+ /// <param name="type">A type for the format.</param>
+ internal MediaFormat(MediaFormatType type)
+ {
+ _type = type;
+ }
+
+ private readonly MediaFormatType _type;
+
+ /// <summary>
+ /// Gets the type of the current format.
+ /// </summary>
+ public MediaFormatType Type
+ {
+ get
+ {
+ return _type;
+ }
+ }
+
+ /// <summary>
+ /// Creates a media format from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ /// <returns>An object of one of subclasses of <see cref="MediaFormat"/>.</returns>
+ internal static MediaFormat FromHandle(IntPtr handle)
+ {
+ if (handle == IntPtr.Zero)
+ {
+ throw new ArgumentNullException("The handle value is null.");
+ }
+
+ int type = 0;
+ int ret = Interop.MediaFormat.GetType(handle, out type);
+
+ if (ret != (int)ErrorCode.InvalidOperation)
+ {
+ MediaToolDebug.AssertNoError(ret);
+
+ switch ((MediaFormatType)type)
+ {
+ case MediaFormatType.Container:
+ return new ContainerMediaFormat(handle);
+
+ case MediaFormatType.Video:
+ return new VideoMediaFormat(handle);
+
+ case MediaFormatType.Audio:
+ return new AudioMediaFormat(handle);
+
+ case MediaFormatType.Text:
+ return new TextMediaFormat(handle);
+ }
+ }
+
+ throw new ArgumentException("looks like handle is corrupted.");
+ }
+
+ /// <summary>
+ /// Create a native media format from this object.
+ /// </summary>
+ /// <returns>A converted native handle.</returns>
+ /// <remarks>The returned handle must be destroyed using <see cref="Interop.MediaFormat.Unref(IntPtr)"/>.</remarks>
+ internal IntPtr AsNativeHandle()
+ {
+ IntPtr handle;
+ int ret = Interop.MediaFormat.Create(out handle);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ AsNativeHandle(handle);
+
+ return handle;
+ }
+
+ /// <summary>
+ /// Fill out properties of a native media format with the current media format object.
+ /// </summary>
+ /// <param name="handle">A native handle to be written.</param>
+ protected abstract void AsNativeHandle(IntPtr handle);
+ }
+
+ /// <summary>
+ /// Represents a container media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class ContainerMediaFormat : MediaFormat
+ {
+ /// <summary>
+ /// Initializes a new instance of the ContainerMediaFormat class.
+ /// </summary>
+ /// <param name="mimeType">The mime type of the container format.</param>
+ /// <exception cref="System.ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
+ public ContainerMediaFormat(MediaFormatContainerMimeType mimeType)
+ : base(MediaFormatType.Container)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ _mimeType = mimeType;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the ContainerMediaFormat class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native media format handle.</param>
+ internal ContainerMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Container)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int mimeType = 0;
+
+ int ret = Interop.MediaFormat.GetContainerMimeType(handle, out mimeType);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType),
+ "Invalid container mime type!");
+
+ _mimeType = (MediaFormatContainerMimeType)mimeType;
+ }
+
+ private readonly MediaFormatContainerMimeType _mimeType;
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatContainerMimeType MimeType
+ {
+ get
+ {
+ return _mimeType;
+ }
+ }
+
+ protected override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Container);
+
+ int ret = Interop.MediaFormat.SetContainerMimeType(handle, (int)_mimeType);
+
+ MediaToolDebug.AssertNoError(ret);
+ }
+ }
+
+ /// <summary>
+ /// Represents a video media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class VideoMediaFormat : MediaFormat
+ {
+ private const int DEFAULT_FRAME_RATE = 0;
+ private const int DEFAULT_BIT_RATE = 0;
+
+
+ /// <summary>
+ /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, width and height.
+ /// </summary>
+ /// <param name="mimeType">The mime type of the format.</param>
+ /// <param name="width">The width value of the format.</param>
+ /// <param name="height">The height value of the format</param>
+ /// <exception cref="System.ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">width, or height is less than zero.</exception>
+ public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height)
+ : this(mimeType, width, height, DEFAULT_FRAME_RATE)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the VideoMediaFormat class with the specified mime type,
+ /// width, height and frame rate.
+ /// </summary>
+ /// <param name="mimeType">The mime type of the format.</param>
+ /// <param name="width">The width value of the format.</param>
+ /// <param name="height">The height value of the format</param>
+ /// <param name="frameRate">The frame rate of the format.</param>
+ /// <exception cref="System.ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">width, height or frameRate is less than zero.</exception>
+ public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height,
+ int frameRate)
+ : this(mimeType, width, height, frameRate, DEFAULT_BIT_RATE)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the VideoMediaFormat class with the specified mime type,
+ /// width, height, frame rate and bit rate.
+ /// </summary>
+ /// <param name="mimeType">The mime type of the format.</param>
+ /// <param name="width">The width value of the format.</param>
+ /// <param name="height">The height value of the format</param>
+ /// <param name="frameRate">The frame rate of the format.</param>
+ /// <param name="bitRate">The bit rate of the format.</param>
+ /// <exception cref="System.ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">width, height, frameRate or bitRate is less than zero.</exception>
+ public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height,
+ int frameRate, int bitRate)
+ : base(MediaFormatType.Video)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ if (width < 0)
+ {
+ throw new ArgumentOutOfRangeException("Width value can't be less than zero.");
+ }
+ if (height < 0)
+ {
+ throw new ArgumentOutOfRangeException("Height value can't be less than zero.");
+ }
+ if (frameRate < 0)
+ {
+ throw new ArgumentOutOfRangeException("Frame rate can't be less than zero.");
+ }
+ if (bitRate < 0)
+ {
+ throw new ArgumentOutOfRangeException("Bit rate value can't be less than zero.");
+ }
+
+ _mimeType = mimeType;
+ _width = width;
+ _height = height;
+ _frameRate = frameRate;
+ _bitRate = bitRate;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the VideoMediaForma class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ internal VideoMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Video)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ GetInfo(handle, out _width, out _height, out _bitRate, out _mimeType);
+
+ GetFrameRate(handle, out _frameRate);
+ }
+
+ /// <summary>
+ /// Retrieves video properties of media format from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle that properties are retrieved from.</param>
+ /// <param name="width">An out parameter for width.</param>
+ /// <param name="height">An out parameter for height.</param>
+ /// <param name="bitRate">An out parameter for bit rate.</param>
+ /// <param name="mimeType">An out parameter for mime type.</param>
+ private static void GetInfo(IntPtr handle, out int width, out int height, out int bitRate,
+ out MediaFormatVideoMimeType mimeType)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int mimeTypeValue = 0;
+ int maxBps = 0;
+
+ int ret = Interop.MediaFormat.GetVideoInfo(handle,
+ out mimeTypeValue, out width, out height, out bitRate, out maxBps);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ mimeType = (MediaFormatVideoMimeType)mimeTypeValue;
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType),
+ "Invalid video mime type!");
+ }
+
+ /// <summary>
+ /// Retrieves frame rate from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle that properties are retrieved from.</param>
+ /// <param name="frameRate">An out parameter for frame rate.</param>
+ private static void GetFrameRate(IntPtr handle, out int frameRate)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int ret = Interop.MediaFormat.GetVideoFrameRate(handle, out frameRate);
+
+ MediaToolDebug.AssertNoError(ret);
+ }
+
+ protected override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Video);
+
+ int ret = Interop.MediaFormat.SetVideoMimeType(handle, (int)_mimeType);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoWidth(handle, _width);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoHeight(handle, _height);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoAverageBps(handle, _bitRate);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetVideoFrameRate(handle, _frameRate);
+ MediaToolDebug.AssertNoError(ret);
+ }
+
+ private readonly MediaFormatVideoMimeType _mimeType;
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatVideoMimeType MimeType
+ {
+ get
+ {
+ return _mimeType;
+ }
+ }
+
+ private readonly int _width;
+
+ /// <summary>
+ /// Gets the width value of the current format.
+ /// </summary>
+ public int Width
+ {
+ get
+ {
+ return _width;
+ }
+ }
+
+ private readonly int _height;
+
+ /// <summary>
+ /// Gets the width value of the current format.
+ /// </summary>
+ public int Height
+ {
+ get
+ {
+ return _height;
+ }
+ }
+
+ private readonly int _frameRate;
+
+ /// <summary>
+ /// Gets the frame rate value of the current format.
+ /// </summary>
+ public int FrameRate
+ {
+ get
+ {
+ return _frameRate;
+ }
+ }
+
+ private readonly int _bitRate;
+
+ /// <summary>
+ /// Gets the bit rate value of the current format.
+ /// </summary>
+ public int BitRate
+ {
+ get
+ {
+ return _bitRate;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Represents an audio media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class AudioMediaFormat : MediaFormat
+ {
+
+ /// <summary>
+ /// Initializes a new instance of the AudioMediaFormat class with the specified mime type,
+ /// channel, sample rate, bit and bit rate.
+ /// </summary>
+ /// <param name="mimeType">The mime type of the format.</param>
+ /// <param name="channel">The channel value of the format.</param>
+ /// <param name="sampleRate">The sample rate value of the format.</param>
+ /// <param name="bit">The bit value of the format.</param>
+ /// <param name="bitRate">The bit rate value of the format.</param>
+ /// <exception cref="System.ArgumentException">mimeType is invalid(i.e. undefined value).</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">
+ /// channel, sampleRate, bit or bitRate is less than zero.</exception>
+ public AudioMediaFormat(MediaFormatAudioMimeType mimeType,
+ int channel, int sampleRate, int bit, int bitRate)
+ : this(mimeType, channel, sampleRate, bit, bitRate, MediaFormatAacType.None)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the AudioMediaFormat class with the specified mime type,
+ /// channel, sample rate, bit, bit rate and aac type.
+ /// </summary>
+ /// <param name="mimeType">The mime type of the format.</param>
+ /// <param name="channel">The channel value of the format.</param>
+ /// <param name="sampleRate">The sample rate value of the format.</param>
+ /// <param name="bit">The bit value of the format.</param>
+ /// <param name="bitRate">The bit rate value of the format.</param>
+ /// <exception cref="System.ArgumentException">
+ /// mimeType or aacType is invalid(i.e. undefined value).
+ /// <para>- or -</para>
+ /// aacType is not <see cref="MediaFormatAacType.None"/>, but mimeType is one of aac types.
+ /// </exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">
+ /// channel, sampleRate, bit or bitRate is less than zero.</exception>
+ public AudioMediaFormat(MediaFormatAudioMimeType mimeType,
+ int channel, int sampleRate, int bit, int bitRate, MediaFormatAacType aacType)
+ : base(MediaFormatType.Audio)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ if (channel < 0)
+ {
+ throw new ArgumentOutOfRangeException("Channel value can't be negative.");
+ }
+ if (sampleRate < 0)
+ {
+ throw new ArgumentOutOfRangeException("Sample rate value can't be negative.");
+ }
+ if (bit < 0)
+ {
+ throw new ArgumentOutOfRangeException("Bit value can't be negative.");
+ }
+ if (bitRate < 0)
+ {
+ throw new ArgumentOutOfRangeException("Bit rate value can't be negative.");
+ }
+ if (!Enum.IsDefined(typeof(MediaFormatAacType), aacType))
+ {
+ throw new ArgumentException($"Invalid aac type value : { (int)aacType }");
+ }
+ if (!IsAacSupportedMimeType(mimeType) && aacType != MediaFormatAacType.None)
+ {
+ throw new ArgumentException("Aac is supported only with aac mime types.");
+ }
+
+ _mimeType = mimeType;
+ _channel = channel;
+ _sampleRate = sampleRate;
+ _bit = bit;
+ _bitRate = bitRate;
+ _aacType = aacType;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the AudioMediaFormat class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ internal AudioMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Audio)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ GetInfo(handle, out _mimeType, out _channel, out _sampleRate, out _bit, out _bitRate);
+
+ if (IsAacSupportedMimeType(_mimeType))
+ {
+ GetAacType(handle, out _aacType);
+ }
+ else
+ {
+ _aacType = MediaFormatAacType.None;
+ }
+
+ }
+
+ /// <summary>
+ /// Returns an indication whether a specified mime type is a aac type.
+ /// </summary>
+ /// <param name="mimeType">A mime type.</param>
+ private static bool IsAacSupportedMimeType(MediaFormatAudioMimeType mimeType)
+ {
+ return mimeType == MediaFormatAudioMimeType.AacLC ||
+ mimeType == MediaFormatAudioMimeType.AacHE ||
+ mimeType == MediaFormatAudioMimeType.AacHEPS;
+ }
+
+ /// <summary>
+ /// Retrieves audio properties of media format from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle that properties are retrieved from.</param>
+ /// <param name="mimeType">An out parameter for mime type.</param>
+ /// <param name="channel">An out parameter for channel.</param>
+ /// <param name="sampleRate">An out parameter for sample rate.</param>
+ /// <param name="bit">An out parameter for bit.</param>
+ /// <param name="bitRate">An out parameter for bit rate.</param>
+ private static void GetInfo(IntPtr handle, out MediaFormatAudioMimeType mimeType,
+ out int channel, out int sampleRate, out int bit, out int bitRate)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int mimeTypeValue = 0;
+
+ int ret = Interop.MediaFormat.GetAudioInfo(handle,
+ out mimeTypeValue, out channel, out sampleRate, out bit, out bitRate);
+
+ mimeType = (MediaFormatAudioMimeType)mimeTypeValue;
+
+ MediaToolDebug.AssertNoError(ret);
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType),
+ "Invalid audio mime type!");
+ }
+
+ /// <summary>
+ /// Retrieves aac type value from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle that properties are retrieved from.</param>
+ /// <param name="aacType">An out parameter for aac type.</param>
+ private static void GetAacType(IntPtr handle, out MediaFormatAacType aacType)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ int aacTypeValue = 0;
+
+ int ret = Interop.MediaFormat.GetAudioAacType(handle, out aacTypeValue);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ aacType = (MediaFormatAacType)aacTypeValue;
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatAacType), aacType), "Invalid aac type!");
+ }
+
+ protected override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Audio);
+
+ int ret = Interop.MediaFormat.SetAudioMimeType(handle, (int)_mimeType);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioChannel(handle, _channel);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioSampleRate(handle, _sampleRate);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioBit(handle, _bit);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioAverageBps(handle, _bitRate);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetAudioAacType(handle, (int)_aacType);
+ MediaToolDebug.AssertNoError(ret);
+ }
+
+ private readonly MediaFormatAudioMimeType _mimeType;
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatAudioMimeType MimeType
+ {
+ get
+ {
+ return _mimeType;
+ }
+ }
+
+ private readonly int _channel;
+
+ /// <summary>
+ /// Gets the channel value of the current format.
+ /// </summary>
+ public int Channel
+ {
+ get
+ {
+ return _channel;
+ }
+ }
+
+ private readonly int _sampleRate;
+
+ /// <summary>
+ /// Gets the sample rate value of the current format.
+ /// </summary>
+ public int SampleRate
+ {
+ get
+ {
+ return _sampleRate;
+ }
+ }
+
+ private readonly int _bit;
+
+ /// <summary>
+ /// Gets the bit value of the current format.
+ /// </summary>
+ public int Bit
+ {
+ get
+ {
+ return _bit;
+ }
+ }
+
+ private readonly int _bitRate;
+
+ /// <summary>
+ /// Gets the bit rate value of the current format.
+ /// </summary>
+ public int BitRate
+ {
+ get
+ {
+ return _bitRate;
+ }
+ }
+
+ private readonly MediaFormatAacType _aacType;
+
+ /// <summary>
+ /// Gets the aac type of the current format.
+ /// </summary>
+ public MediaFormatAacType AacType
+ {
+ get
+ {
+ return _aacType;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Represents a text media format. This class cannot be inherited.
+ /// </summary>
+ public sealed class TextMediaFormat : MediaFormat
+ {
+ /// <summary>
+ /// Initializes a new instance of the TextMediaFormat class with the specified mime type
+ /// and text type.
+ /// </summary>
+ /// <param name="mimeType">The mime type of the format.</param>
+ /// <param name="textType">The text type of the format.</param>
+ /// <exception cref="System.ArgumentException">
+ /// mimeType or textType is invalid(i.e. undefined value).</exception>
+ public TextMediaFormat(MediaFormatTextMimeType mimeType, MediaFormatTextType textType)
+ : base(MediaFormatType.Text)
+ {
+ if (!Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType))
+ {
+ throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
+ }
+ if (!Enum.IsDefined(typeof(MediaFormatTextType), textType))
+ {
+ throw new ArgumentException($"Invalid text type value : { (int)textType }");
+ }
+ _mimeType = mimeType;
+ _textType = textType;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the TextMediaFormat class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ internal TextMediaFormat(IntPtr handle)
+ : base(MediaFormatType.Text)
+ {
+ Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
+
+ GetInfo(handle, out _mimeType, out _textType);
+ }
+
+ /// <summary>
+ /// Retrieves text properties of media format from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle that properties are retrieved from.</param>
+ /// <param name="mimeType">An out parameter for mime type.</param>
+ /// <param name="textType">An out parameter for text type.</param>
+ private static void GetInfo(IntPtr handle, out MediaFormatTextMimeType mimeType,
+ out MediaFormatTextType textType)
+ {
+ int mimeTypeValue = 0;
+ int textTypeValue = 0;
+
+ int ret = Interop.MediaFormat.GetTextInfo(handle, out mimeTypeValue, out textTypeValue);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ mimeType = (MediaFormatTextMimeType)mimeTypeValue;
+ textType = (MediaFormatTextType)textTypeValue;
+
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType),
+ "Invalid text mime type!");
+ Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextType), textType),
+ "Invalid text type!");
+ }
+
+ protected override void AsNativeHandle(IntPtr handle)
+ {
+ Debug.Assert(Type == MediaFormatType.Text);
+
+ int ret = Interop.MediaFormat.SetTextMimeType(handle, (int)_mimeType);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaFormat.SetTextType(handle, (int)_textType);
+ MediaToolDebug.AssertNoError(ret);
+ }
+
+ private readonly MediaFormatTextMimeType _mimeType;
+
+ /// <summary>
+ /// Gets the mime type of the current format.
+ /// </summary>
+ public MediaFormatTextMimeType MimeType
+ {
+ get
+ {
+ return _mimeType;
+ }
+ }
+
+ private readonly MediaFormatTextType _textType;
+
+ /// <summary>
+ /// Gets the text type of the current format.
+ /// </summary>
+ public MediaFormatTextType TextType
+ {
+ get
+ {
+ return _textType;
+ }
+ }
+ }
+}
--- /dev/null
+namespace Tizen.Multimedia
+{
+ public enum MediaFormatAacType
+ {
+ None,
+ Adts,
+ Adif
+ }
+}
--- /dev/null
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Enumeration for media format type
+ /// </summary>
+ public enum MediaFormatType
+ {
+ /// <summary>
+ /// Audio
+ /// </summary>
+ Audio = 0x00100000,
+
+ /// <summary>
+ /// Video
+ /// </summary>
+ Video = 0x00200000,
+
+ /// <summary>
+ /// Container
+ /// </summary>
+ Container = 0x00400000,
+
+ /// <summary>
+ /// Text
+ /// </summary>
+ Text = 0x00800000,
+ }
+
+ /// <summary>
+ /// Enumeration for media format data type
+ /// </summary>
+ internal enum MediaFormatDataType
+ {
+ /// <summary>
+ /// Encoded type
+ /// </summary>
+ Encoded = 0x10000000,
+
+ /// <summary>
+ /// Raw type
+ /// </summary>
+ Raw = 0x20000000,
+ }
+
+ public enum MediaFormatAudioMimeType
+ {
+ /// <summary>
+ /// L16, Audio
+ /// </summary>
+ L16 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1010),
+
+ /// <summary>
+ /// ALAW, Audio
+ /// </summary>
+ ALaw = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1020),
+
+ /// <summary>
+ /// ULAW, Audio
+ /// </summary>
+ ULaw = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1030),
+
+ /// <summary>
+ /// AMR, Audio, Alias for AmrNB
+ /// </summary>
+ Amr = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1040),
+
+ /// <summary>
+ /// AMR-NB, Audio
+ /// </summary>
+ AmrNB = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1040),
+
+ /// <summary>
+ /// AMR-WB, Audio
+ /// </summary>
+ AmrWB = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1041),
+
+ /// <summary>
+ /// G729, Audio
+ /// </summary>
+ G729 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1050),
+
+ /// <summary>
+ /// AAC, Audio, Alias for AacLc
+ /// </summary>
+ Aac = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1060),
+
+ /// <summary>
+ /// AAC-LC (Advanced Audio Coding Low-Complexity profile), Audio
+ /// </summary>
+ AacLC = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1060),
+
+ /// <summary>
+ /// HE-AAC (High-Efficiency Advanced Audio Coding), Audio
+ /// </summary>
+ AacHE = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1061),
+
+ /// <summary>
+ /// HE-AAC-PS (High-Efficiency Advanced Audio Coding with Parametric Stereo), Audio
+ /// </summary>
+ AacHEPS = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1062),
+
+ /// <summary>
+ /// MP3, Audio
+ /// </summary>
+ MP3 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1070),
+
+ /// <summary>
+ /// VORBIS, Audio
+ /// </summary>
+ Vorbis = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1080),
+
+ /// <summary>
+ /// FLAC, Audio
+ /// </summary>
+ Flac = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1090),
+
+ /// <summary>
+ /// Windows Media Audio 1, Audio
+ /// </summary>
+ Wma1 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A0),
+
+ /// <summary>
+ /// Windows Media Audio 2, Audio
+ /// </summary>
+ Wma2 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A1),
+
+ /// <summary>
+ /// Windows Media Audio Professional, Audio
+ /// </summary>
+ WmaPro = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A2),
+
+ /// <summary>
+ /// Windows Media Audio Lossless, Audio
+ /// </summary>
+ WmaLossless = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A3),
+
+ /// <summary>
+ /// PCM, Audio, Alias for PcmS16LE
+ /// </summary>
+ Pcm = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1510),
+
+ /// <summary>
+ /// PCM signed 16-bit little-endian, Audio
+ /// </summary>
+ PcmS16LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1510),
+
+ /// <summary>
+ /// PCM signed 24-bit little-endian, Audio
+ /// </summary>
+ PcmS24LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1511),
+
+ /// <summary>
+ /// PCM signed 32-bit little-endian, Audio
+ /// </summary>
+ Pcm32LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1512),
+
+ /// <summary>
+ /// PCM signed 16-bit big-endian, Audio
+ /// </summary>
+ PcmS16BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1513),
+
+ /// <summary>
+ /// PCM signed 24-bit big-endian, Audio
+ /// </summary>
+ PcmS24BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1514),
+
+ /// <summary>
+ /// PCM signed 32-bit big-endian, Audio
+ /// </summary>
+ PcmS32BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1515),
+
+ /// <summary>
+ /// PCM 32-bit floating point little-endian, Audio
+ /// </summary>
+ PcmF32LE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1516),
+
+ /// <summary>
+ /// PCM 32-bit floating point big-endian, Audio
+ /// </summary>
+ PcmF32BE = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1517),
+
+ /// <summary>
+ /// PCM A-law, Audio
+ /// </summary>
+ PcmALaw = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1520),
+
+ /// <summary>
+ /// PCM U-law, Audio
+ /// </summary>
+ PcmULaw = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1530),
+ }
+
+ /// <summary>
+ /// Enumeration for media format MIME type
+ /// </summary>
+ public enum MediaFormatVideoMimeType
+ {
+ /// <summary>
+ /// H261
+ /// </summary>
+ H261 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2010),
+
+ /// <summary>
+ /// H263
+ /// </summary>
+ H263 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2020),
+
+ /// <summary>
+ /// H263P
+ /// </summary>
+ H263P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2021),
+
+ /// <summary>
+ /// H263 Baseline Profile
+ /// </summary>
+ H263BP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2022),
+
+ /// <summary>
+ /// H263 H.320 Coding Efficiency Profile
+ /// </summary>
+ H263H320Cep = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2023),
+
+ /// <summary>
+ /// H263 Backward-Compatibility Profile
+ /// </summary>
+ H263Bcp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2024),
+
+ /// <summary>
+ /// H263 Interactive and Streaming Wireless Profile
+ /// </summary>
+ H263Isw2p = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2025),
+
+ /// <summary>
+ /// H263 Interactive and Streaming Wireless Profile
+ /// </summary>
+ H263Isw3p = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2026),
+
+ /// <summary>
+ /// H263 Conversation High Compression Profile
+ /// </summary>
+ H263Chcp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2027),
+
+ /// <summary>
+ /// H263 Conversational Internet Profile
+ /// </summary>
+ H263CInternetP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2028),
+
+ /// <summary>
+ /// H263 Conversational Interlace Profile
+ /// </summary>
+ H263CInterlaceP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2029),
+
+ /// <summary>
+ /// H263 High Latency Profile
+ /// </summary>
+ H263Hlp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x202A),
+
+ /// <summary>
+ /// H264_SP
+ /// </summary>
+ H264SP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2030),
+
+ /// <summary>
+ /// H264_MP
+ /// </summary>
+ H264MP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2031),
+
+ /// <summary>
+ /// H264_HP
+ /// </summary>
+ H264HP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2032),
+
+ /// <summary>
+ /// H264 Extended Profile
+ /// </summary>
+ H264XP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2033),
+
+ /// <summary>
+ /// H264 High10 Profile
+ /// </summary>
+ H264H10P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2034),
+
+ /// <summary>
+ /// H264 High422 Profile
+ /// </summary>
+ H264H422P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2035),
+
+ /// <summary>
+ /// H264 High444 Profile
+ /// </summary>
+ H264H444P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2036),
+
+ /// <summary>
+ /// H264 CAVLC444 Profile
+ /// </summary>
+ H264C444P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2037),
+
+ /// <summary>
+ /// MJPEG
+ /// </summary>
+ MJpeg = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2040),
+
+ /// <summary>
+ /// MPEG1
+ /// </summary>
+ Mpeg1 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2050),
+
+ /// <summary>
+ /// MPEG2_SP
+ /// </summary>
+ Mpeg2SP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2060),
+
+ /// <summary>
+ /// MPEG2_MP
+ /// </summary>
+ Mpeg2MP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2061),
+
+ /// <summary>
+ /// MPEG2_HP
+ /// </summary>
+ Mpeg2HP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2062),
+
+ /// <summary>
+ /// MPEG4_SP
+ /// </summary>
+ Mpeg4SP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2070),
+
+ /// <summary>
+ /// MPEG4_ASP
+ /// </summary>
+ Mpeg4Asp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2071),
+
+ /// <summary>
+ /// HEVC
+ /// </summary>
+ Hevc = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2080),
+
+ /// <summary>
+ /// HEVC Main Profile
+ /// </summary>
+ HevcMP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2081),
+
+ /// <summary>
+ /// HEVC Main10 Profile
+ /// </summary>
+ HevcM10P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2082),
+
+ /// <summary>
+ /// VP8
+ /// </summary>
+ VP8 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2090),
+
+ /// <summary>
+ /// VP9
+ /// </summary>
+ VP9 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x20A0),
+
+ /// <summary>
+ /// VC1
+ /// </summary>
+ VC1 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x20B0),
+
+ /// <summary>
+ /// I420
+ /// </summary>
+ I420 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2510),
+
+ /// <summary>
+ /// NV12
+ /// </summary>
+ NV12 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2520),
+
+ /// <summary>
+ /// NV12T
+ /// </summary>
+ NV12T = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2530),
+
+ /// <summary>
+ /// YV12
+ /// </summary>
+ YV12 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2540),
+
+ /// <summary>
+ /// NV21
+ /// </summary>
+ NV21 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2550),
+
+ /// <summary>
+ /// NV16
+ /// </summary>
+ NV16 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2560),
+
+ /// <summary>
+ /// YUYV
+ /// </summary>
+ Yuyv = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2570),
+
+ /// <summary>
+ /// UYVY
+ /// </summary>
+ Uyvy = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2580),
+
+ /// <summary>
+ /// 422P
+ /// </summary>
+ Yuv422P = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2590),
+
+ /// <summary>
+ /// RGB565
+ /// </summary>
+ Rgb565 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25a0),
+
+ /// <summary>
+ /// RGB888
+ /// </summary>
+ Rgb888 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25b0),
+
+ /// <summary>
+ /// RGBA
+ /// </summary>
+ Rgba = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25c0),
+
+ /// <summary>
+ /// ARGB
+ /// </summary>
+ Argb = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25d0),
+
+ /// <summary>
+ /// BGRA
+ /// </summary>
+ Bgra = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25e0),
+
+ /// <summary>
+ /// HW dependent
+ /// </summary>
+ NativeVideo = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x7000),
+ }
+
+ public enum MediaFormatContainerMimeType
+ {
+ /// <summary>
+ /// MP4 container, Video
+ /// </summary>
+ MP4 = (MediaFormatType.Container | 0x3010),
+
+ /// <summary>
+ /// AVI container, Video
+ /// </summary>
+ Avi = (MediaFormatType.Container | 0x3020),
+
+ /// <summary>
+ /// MPEG2TS container, Video
+ /// </summary>
+ Mpeg2TS = (MediaFormatType.Container | 0x3030),
+
+ /// <summary>
+ /// MPEG2PS container, Video
+ /// </summary>
+ Mpeg2PS = (MediaFormatType.Container | 0x3040),
+
+ /// <summary>
+ /// MATROSKA container, Video
+ /// </summary>
+ Matroska = (MediaFormatType.Container | 0x3050),
+
+ /// <summary>
+ /// WEBM container, Video
+ /// </summary>
+ Webm = (MediaFormatType.Container | 0x3060),
+
+ /// <summary>
+ /// 3GP container, Video
+ /// </summary>
+ ThreeGP = (MediaFormatType.Container | 0x3070),
+
+
+
+ /// <summary>
+ /// WAV container, Audio
+ /// </summary>
+ Wav = (MediaFormatType.Container | 0x4010),
+
+ /// <summary>
+ /// OGG container, Audio
+ /// </summary>
+ Ogg = (MediaFormatType.Container | 0x4020),
+
+ /// <summary>
+ /// AAC_ADTS container, Audio
+ /// </summary>
+ AacAdts = (MediaFormatType.Container | 0x4030),
+
+ /// <summary>
+ /// AAC_ADIF container, Audio
+ /// </summary>
+ AacAdif = (MediaFormatType.Container | 0x4031),
+ }
+
+ public enum MediaFormatTextMimeType
+ {
+ /// <summary>
+ /// MP4
+ /// </summary>
+ MP4 = (MediaFormatType.Text | MediaFormatDataType.Encoded | 0x8010),
+
+ /// <summary>
+ /// 3GP
+ /// </summary>
+ ThreeGP = (MediaFormatType.Text | MediaFormatDataType.Encoded | 0x8020),
+ }
+
+}
+
--- /dev/null
+namespace Tizen.Multimedia
+{
+ public enum MediaFormatTextType
+ {
+ None,
+ Mp4,
+ ThreeGpp
+ }
+}
--- /dev/null
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a packet for multimedia.
+ /// </summary>
+ public abstract class MediaPacket : IDisposable
+ {
+ private IntPtr _handle = IntPtr.Zero;
+
+ /// <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>
+ /// <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>
+ /// <exception cref="NotEnoughMemoryException">Out of memory.</exception>
+ /// <exception cref="System.InvalidOperationException">Operation failed.</exception>
+ internal MediaPacket(MediaFormat format)
+ {
+ if (format == null)
+ {
+ throw new ArgumentNullException("MediaFormat must be not null.");
+ }
+
+ if (format.Type == MediaFormatType.Container)
+ {
+ throw new ArgumentException("Container format can't be used to create a new packet.");
+ }
+
+ Initialize(format);
+ _format = format;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the MediaPacket class from a native handle.
+ /// </summary>
+ /// <param name="handle">A native handle.</param>
+ internal MediaPacket(IntPtr handle)
+ {
+ _handle = handle;
+
+ IntPtr formatHandle = IntPtr.Zero;
+ int ret = Interop.MediaPacket.GetFormat(handle, out formatHandle);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ try
+ {
+ if (formatHandle != IntPtr.Zero)
+ {
+ _format = MediaFormat.FromHandle(formatHandle);
+ }
+ }
+ finally
+ {
+ Interop.MediaFormat.Unref(formatHandle);
+ }
+ }
+
+ ~MediaPacket()
+ {
+ Dispose(false);
+ }
+
+ /// <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>
+ /// <exception cref="NotEnoughMemoryException">Out of memory.</exception>
+ /// <exception cref="System.InvalidOperationException">Operation failed.</exception>
+ private void Initialize(MediaFormat format)
+ {
+ IntPtr formatHandle = IntPtr.Zero;
+
+ if (format.Type == MediaFormatType.Container)
+ {
+ throw new ArgumentException("Creating a packet for container is not supported.");
+ }
+
+ try
+ {
+ formatHandle = format.AsNativeHandle();
+
+ int ret = Interop.MediaPacket.Create(formatHandle, IntPtr.Zero, IntPtr.Zero, out _handle);
+ MediaToolDebug.AssertNoError(ret);
+
+ Debug.Assert(_handle != IntPtr.Zero, "Created handle must not be null");
+
+ Alloc();
+ }
+ catch (Exception)
+ {
+ if (_handle != IntPtr.Zero)
+ {
+ Interop.MediaPacket.Destroy(_handle);
+ _handle = IntPtr.Zero;
+ }
+
+ throw;
+ }
+ finally
+ {
+ if (formatHandle != IntPtr.Zero)
+ {
+ Interop.MediaFormat.Unref(formatHandle);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Allocates internal buffer.
+ /// </summary>
+ /// <exception cref="NotEnoughMemoryException">Out of memory.</exception>
+ /// <exception cref="System.InvalidOperationException">Operation failed.</exception>
+ private void Alloc()
+ {
+ ErrorCode ret = (ErrorCode)Interop.MediaPacket.Alloc(_handle);
+ if (ret == ErrorCode.None)
+ {
+ return;
+ }
+
+ switch (ret)
+ {
+ case ErrorCode.OutOfMemory:
+ throw new NotEnoughMemoryException("Failed to allocate buffer for the packet.");
+
+ default:
+ throw new InvalidOperationException("Failed to create a packet.");
+ }
+
+ }
+
+ private readonly MediaFormat _format;
+
+ /// <summary>
+ /// Gets the media format of the current packet.
+ /// </summary>
+ public MediaFormat Format
+ {
+ get
+ {
+ ValidateNotDisposed();
+ return _format;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the PTS(Presentation Time Stamp) value of the current packet.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The MediaPacket is not writable state which means it being used by another module.</exception>
+ public ulong Pts
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ ulong value = 0;
+ int ret = Interop.MediaPacket.GetPts(_handle, out value);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ return value;
+ }
+ set
+ {
+ ValidateNotDisposed();
+ ValidateNotLocked();
+
+ int ret = Interop.MediaPacket.SetPts(_handle, value);
+
+ MediaToolDebug.AssertNoError(ret);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the DTS(Decoding Time Stamp) value of the current packet.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The MediaPacket is not in writable state which means it being used by another module.</exception>
+ public ulong Dts
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ ulong value = 0;
+ int ret = Interop.MediaPacket.GetDts(_handle, out value);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ return value;
+ }
+ set
+ {
+ ValidateNotDisposed();
+ ValidateNotLocked();
+
+ int ret = Interop.MediaPacket.SetDts(_handle, value);
+
+ MediaToolDebug.AssertNoError(ret);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the packet is encoded type.
+ /// </summary>
+ /// <value>true if the packet is encoded type; otherwise, false.</value>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ public bool IsEncoded
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ bool value = false;
+ int ret = Interop.MediaPacket.IsEncoded(_handle, out value);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ return value;
+ }
+ }
+
+ private MediaPacketBuffer _buffer;
+
+ /// <summary>
+ /// Gets the buffer of the packet.
+ /// </summary>
+ /// <value>The <see cref="MediaPacketBuffer"/> allocated to the packet.
+ /// This property will return null if the packet is raw video format.</value>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <seealso cref="IsEncoded"/>
+ /// <seealso cref="VideoPlanes"/>
+ public MediaPacketBuffer Buffer
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ if (IsVideoPlaneSupported)
+ {
+ return null;
+ }
+
+ if (_buffer == null)
+ {
+ _buffer = GetBuffer();
+ }
+
+ return _buffer;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a length of data written in the <see cref="Buffer"/>.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// The value specified for this property is less than zero or greater than <see cref="MediaPacketBuffer.Length"/>.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The MediaPacket has <see cref="VideoPlanes"/> instead of <see cref="Buffer"/>.
+ /// <para>-or-</para>
+ /// The MediaPacket is not in writable state which means it being used by another module.
+ /// </exception>
+ public int BufferWrittenLength
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ ulong value = 0;
+ int ret = Interop.MediaPacket.GetBufferSize(_handle, out value);
+ MediaToolDebug.AssertNoError(ret);
+
+ Debug.Assert(value < int.MaxValue);
+
+ return (int)value;
+ }
+ set
+ {
+ ValidateNotDisposed();
+ ValidateNotLocked();
+
+ if (IsVideoPlaneSupported)
+ {
+ throw new InvalidOperationException(
+ "This packet uses VideoPlanes instead of Buffer.");
+ }
+
+ Debug.Assert(Buffer != null);
+
+ if (value < 0 || value >= Buffer.Length)
+ {
+ throw new ArgumentOutOfRangeException("value must be less than Buffer.Size.");
+ }
+
+ int ret = Interop.MediaPacket.SetBufferSize(_handle, (ulong)value);
+ MediaToolDebug.AssertNoError(ret);
+ }
+ }
+
+ private MediaPacketVideoPlane[] _videoPlanes;
+
+ /// <summary>
+ /// Gets the video planes of the packet.
+ /// </summary>
+ /// <value>The <see cref="MediaPacketVideoPlane"/>s allocated to the packet.
+ /// This property will return null if the packet is not raw video format.</value>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <seealso cref="IsEncoded"/>
+ /// <seealso cref="Buffer"/>
+ public MediaPacketVideoPlane[] VideoPlanes
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ if (!IsVideoPlaneSupported)
+ {
+ return null;
+ }
+
+ if (_videoPlanes == null)
+ {
+ _videoPlanes = GetVideoPlanes();
+ }
+
+ return _videoPlanes;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the buffer flags of the packet.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The MediaPacket is not in writable state which means it being used by another module.
+ /// </exception>
+ public MediaPacketBufferFlags BufferFlags
+ {
+ get
+ {
+ ValidateNotDisposed();
+
+ int value = 0;
+
+ int ret = Interop.MediaPacket.GetBufferFlags(_handle, out value);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ return (MediaPacketBufferFlags)value;
+ }
+
+ set
+ {
+ ValidateNotDisposed();
+ ValidateNotLocked();
+
+ int ret = Interop.MediaPacket.ResetBufferFlags(_handle);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaPacket.SetBufferFlags(_handle, (int)value);
+
+ MediaToolDebug.AssertNoError(ret);
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the packet has been disposed of.
+ /// </summary>
+ /// <value>true if the packet has been disposed of; otherwise, false.</value>
+ public bool IsDisposed
+ {
+ get
+ {
+ return _isDisposed;
+ }
+ }
+
+ private bool _isDisposed = false;
+
+ /// <summary>
+ /// Releases all resources.
+ /// </summary>
+ /// <exception cref="InvalidOperationException">
+ /// The MediaPacket can not be disposed which means it being used by another module.
+ /// </exception>
+ public void Dispose()
+ {
+ ValidateNotLocked();
+
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (_isDisposed)
+ {
+ return;
+ }
+
+ if (_handle != IntPtr.Zero)
+ {
+ Interop.MediaPacket.Destroy(_handle);
+ _handle = IntPtr.Zero;
+ }
+
+ _isDisposed = true;
+ }
+
+ internal IntPtr GetHandle()
+ {
+ ValidateNotDisposed();
+
+ Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
+
+ return _handle;
+ }
+
+ /// <summary>
+ /// Validate the current object has not been disposed of.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
+ private void ValidateNotDisposed()
+ {
+ if (_isDisposed)
+ {
+ throw new ObjectDisposedException("This packet has already been disposed of.");
+ }
+ }
+
+ /// <summary>
+ /// Validate the current object is not locked.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket has already been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">The MediaPacket is in use by another module.</exception>
+ private void ValidateNotLocked()
+ {
+ ValidateNotDisposed();
+
+ if (_lock.IsLocked)
+ {
+ throw new InvalidOperationException("Can't perform any writing operation." +
+ "The packet is in use, internally.");
+ }
+ }
+ /// <summary>
+ /// Ensures whether the packet is writable.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket already has been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">The MediaPacket is being used by another module.</exception>
+ internal void EnsureWritableState()
+ {
+ ValidateNotDisposed();
+ ValidateNotLocked();
+ }
+
+ /// <summary>
+ /// Ensures whether the packet is readable.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket already has been disposed of.</exception>
+ internal void EnsureReadableState()
+ {
+ ValidateNotDisposed();
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the packet is raw video format.
+ /// </summary>
+ /// <value>true if the packet is raw video format; otherwise, false.</value>
+ private bool IsVideoPlaneSupported
+ {
+ get
+ {
+ return !IsEncoded && Format.Type == MediaFormatType.Video;
+ }
+ }
+
+ /// <summary>
+ /// Retrieves video planes of the current packet.
+ /// </summary>
+ /// <returns><see cref="MediaPacketVideoPlane"/>s allocated to the current MediaPacket.</returns>
+ private MediaPacketVideoPlane[] GetVideoPlanes()
+ {
+ Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
+
+ uint numberOfPlanes = 0;
+ int ret = Interop.MediaPacket.GetNumberOfVideoPlanes(_handle, out numberOfPlanes);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ MediaPacketVideoPlane[] planes = new MediaPacketVideoPlane[numberOfPlanes];
+
+ for (int i = 0; i < numberOfPlanes; ++i)
+ {
+ planes[i] = new MediaPacketVideoPlane(this, i);
+ }
+
+ return planes;
+ }
+
+ /// <summary>
+ /// Retrieves the buffer of the current packet.
+ /// </summary>
+ /// <returns>A <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!");
+
+ ret = Interop.MediaPacket.GetAllocatedBufferSize(_handle, out size);
+ MediaToolDebug.AssertNoError(ret);
+
+ return new MediaPacketBuffer(this, dataHandle, size);
+ }
+
+ #region Lock operations
+ private readonly LockState _lock = new LockState();
+
+ /// <summary>
+ /// Provides a thread-safe lock state controller.
+ /// </summary>
+ private sealed class LockState
+ {
+ const int LOCKED = 1;
+ const int UNLOCKED = 0;
+
+ private int _locked = UNLOCKED;
+
+ internal void SetLock()
+ {
+ if (Interlocked.CompareExchange(ref _locked, LOCKED, UNLOCKED) == LOCKED)
+ {
+ throw new InvalidOperationException("The packet is already locked.");
+ }
+ }
+
+ internal void SetUnlock()
+ {
+ if (Interlocked.CompareExchange(ref _locked, UNLOCKED, LOCKED) == UNLOCKED)
+ {
+ Debug.Fail("The packet to unlock is not locked. " +
+ "There must be an error somewhere that a lock isn't disposed correctly.");
+ }
+ }
+
+ internal bool IsLocked
+ {
+ get
+ {
+ return Interlocked.CompareExchange(ref _locked, 0, 0) == LOCKED;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Provides a thread-safe lock controller.
+ /// </summary>
+ /// <example>
+ /// using (var lock = BaseMeadiPacket.Lock(mediaPacket))
+ /// {
+ /// ....
+ /// }
+ /// </example>
+ internal sealed class Lock : IDisposable
+ {
+ private readonly MediaPacket _packet;
+ private readonly GCHandle _gcHandle;
+
+ internal Lock(MediaPacket packet)
+ {
+ Debug.Assert(packet != null, "The packet is null!");
+
+ packet.ValidateNotDisposed();
+
+ _packet = packet;
+
+ _packet._lock.SetLock();
+
+ //TODO need test
+ _gcHandle = GCHandle.Alloc(this);
+
+ SetExtra(GCHandle.ToIntPtr(_gcHandle));
+ }
+
+ internal static Lock FromHandle(IntPtr handle)
+ {
+ Debug.Assert(handle != IntPtr.Zero);
+
+ IntPtr extra = GetExtra(handle);
+
+ Debug.Assert(extra != IntPtr.Zero, "Extra of packet must not be null.");
+
+ return (Lock)GCHandle.FromIntPtr(extra).Target;
+ }
+
+ private void SetExtra(IntPtr ptr)
+ {
+ int ret = Interop.MediaPacket.SetExtra(_packet._handle, ptr);
+
+ MediaToolDebug.AssertNoError(ret);
+ }
+
+ private static IntPtr GetExtra(IntPtr handle)
+ {
+ IntPtr value = IntPtr.Zero;
+
+ int ret = Interop.MediaPacket.GetExtra(handle, out value);
+
+ MediaToolDebug.AssertNoError(ret);
+
+ return value;
+ }
+
+ internal IntPtr GetHandle()
+ {
+ return _packet.GetHandle();
+ }
+
+ internal MediaPacket MediaPacket
+ {
+ get
+ {
+ return _packet;
+ }
+ }
+
+ private bool _isDisposed = false;
+
+ public void Dispose()
+ {
+ if (!_isDisposed)
+ {
+ SetExtra(IntPtr.Zero);
+
+ if (_gcHandle.IsAllocated)
+ {
+ _gcHandle.Free();
+ }
+
+ //We can assure that at this point '_packet' is always locked by this lock.
+ _packet._lock.SetUnlock();
+
+ _isDisposed = true;
+ }
+ }
+ }
+ #endregion
+
+ /// <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>
+ /// <returns>A new MediaPacket object.</returns>
+ public static MediaPacket Create(MediaFormat format)
+ {
+ return new SimpleMediaPacket(format);
+ }
+
+ internal static MediaPacket From(IntPtr handle)
+ {
+ return new SimpleMediaPacket(handle);
+ }
+ }
+
+ internal class SimpleMediaPacket : MediaPacket
+ {
+ internal SimpleMediaPacket(MediaFormat format) : base(format)
+ {
+ }
+
+ internal SimpleMediaPacket(IntPtr handle) : base(handle)
+ {
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a buffer for a <see cref="MediaPacket"/>.
+ /// </summary>
+ public class MediaPacketBuffer
+ {
+ private readonly MediaPacket _packet;
+ private readonly IntPtr _dataHandle;
+
+ internal MediaPacketBuffer(MediaPacket packet, IntPtr dataHandle, int size)
+ {
+ Debug.Assert(packet != null, "Packet is null!");
+ Debug.Assert(!packet.IsDisposed, "Packet is already disposed!");
+ Debug.Assert(dataHandle != IntPtr.Zero, "dataHandle is null!");
+ Debug.Assert(size >= 0, "size must not be negative!");
+
+ _packet = packet;
+ _dataHandle = dataHandle;
+ _length = size;
+ }
+
+ /// <summary>
+ /// Gets or sets a value at the specified index.
+ /// </summary>
+ /// <param name="index">The index of the value to get or set.</param>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// index is less than zero.
+ /// <para>-or-</para>
+ /// index is equal to or greater than <see cref="Length"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">The MediaPacket that owns the current buffer is being used by another module.</exception>
+ public byte this[int index]
+ {
+ get
+ {
+ _packet.EnsureReadableState();
+
+ if (index < 0 || index >= Length)
+ {
+ throw new ArgumentOutOfRangeException($"Valid index range is [0, { nameof(Length) }).");
+ }
+
+ return Marshal.ReadByte(_dataHandle, index);
+ }
+ set
+ {
+ _packet.EnsureWritableState();
+
+ Marshal.WriteByte(_dataHandle, index, value);
+ }
+ }
+
+ /// <summary>
+ /// Validates the range
+ /// </summary>
+ /// <param name="offset"></param>
+ /// <param name="length"></param>
+ /// <exception cref="ArgumentOutOfRangeException">
+ /// offset + length is greater than <see cref="Length"/>.
+ /// <para>-or-</para>
+ /// offset or length is less than zero.
+ /// </exception>
+ private void ValidateRange(int offset, int length)
+ {
+ if (offset + length > _length)
+ {
+ throw new ArgumentOutOfRangeException("offset + length can't be greater than length of the buffer.");
+ }
+ if (length < 0)
+ {
+ throw new ArgumentOutOfRangeException($"Length can't be less than zero : { length }.");
+ }
+ if (offset < 0)
+ {
+ throw new ArgumentOutOfRangeException($"Offset can't be less than zero : { offset }.");
+ }
+ }
+
+ /// <summary>
+ /// Copies data from a byte array to the buffer.
+ /// </summary>
+ /// <param name="source">The array to copy from.</param>
+ /// <param name="startIndex">The zero-based index in the source array where copying should start.</param>
+ /// <param name="length">The number of array elements to copy.</param>
+ /// <param name="offset">The zero-based index in the buffer where copying should start.</param>
+ /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ public void CopyFrom(byte[] source, int startIndex, int length, int offset = 0)
+ {
+ _packet.EnsureReadableState();
+
+ if (startIndex < 0)
+ {
+ throw new ArgumentOutOfRangeException("startIndex can't be less than zero.");
+ }
+ if (startIndex + length > source.Length)
+ {
+ throw new ArgumentOutOfRangeException("startIndex + length can't be greater than source.Length.");
+ }
+
+ ValidateRange(offset, length);
+
+ Marshal.Copy(source, startIndex, IntPtr.Add(_dataHandle, offset), length);
+ }
+
+ /// <summary>
+ /// Copies data from the buffer to a byte array.
+ /// </summary>
+ /// <param name="dest">The array to copy to.</param>
+ /// <param name="startIndex">The zero-based index in the dest array where copying should start.</param>
+ /// <param name="length">The number of elements to copy.</param>
+ /// <param name="offset">The zero-based index in the buffer where copying should start.</param>
+ /// <exception cref="ArgumentOutOfRangeException">startIndex, offset or length is not valid.</exception>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ /// <exception cref="InvalidOperationException">The MediaPacket that owns the current buffer is being used by another module.</exception>
+ public void CopyTo(byte[] dest, int startIndex, int length, int offset = 0)
+ {
+ _packet.EnsureWritableState();
+
+ if (startIndex < 0)
+ {
+ throw new ArgumentOutOfRangeException("Start index can't be less than zero.");
+ }
+ if (startIndex + length > dest.Length)
+ {
+ throw new ArgumentOutOfRangeException("startIndex + length can't be greater than dest.Length.");
+ }
+
+ ValidateRange(offset, length);
+
+ Marshal.Copy(IntPtr.Add(_dataHandle, offset), dest, startIndex, length);
+ }
+
+ private readonly int _length;
+
+ /// <summary>
+ /// Gets the size of the buffer, in bytes.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ public int Length
+ {
+ get
+ {
+ _packet.EnsureReadableState();
+
+ return _length;
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.Multimedia
+{
+ [Flags]
+ public enum MediaPacketBufferFlags
+ {
+ CodecConfig = 0x1,
+ EndOfStream = 0x2,
+ SyncFrame = 0x4,
+ }
+}
--- /dev/null
+using System;
+using System.Diagnostics;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// Represents a video plane for <see cref="MediaPacket"/>.
+ /// This class is used if and only if the format of the packet is raw video.
+ /// </summary>
+ public class MediaPacketVideoPlane
+ {
+ private readonly MediaPacket _packet;
+ private readonly int _strideWidth;
+ private readonly int _strideHeight;
+ private readonly MediaPacketBuffer _buffer;
+
+ internal MediaPacketVideoPlane(MediaPacket packet, int index)
+ {
+ Debug.Assert(packet != null, "The packet is null!");
+ Debug.Assert(!packet.IsDisposed, "Packet is already disposed!");
+ Debug.Assert(index >= 0, "Video plane index must not be negative!");
+
+ _packet = packet;
+
+ int ret = Interop.MediaPacket.GetVideoStrideWidth(packet.GetHandle(), index, out _strideWidth);
+ MediaToolDebug.AssertNoError(ret);
+
+ ret = Interop.MediaPacket.GetVideoStrideWidth(packet.GetHandle(), index, out _strideHeight);
+ MediaToolDebug.AssertNoError(ret);
+
+ IntPtr dataHandle = IntPtr.Zero;
+ ret = Interop.MediaPacket.GetVideoPlaneData(packet.GetHandle(), index, out dataHandle);
+ MediaToolDebug.AssertNoError(ret);
+
+ _buffer = new MediaPacketBuffer(packet, dataHandle, _strideWidth * _strideHeight);
+ }
+
+ /// <summary>
+ /// Gets the buffer of the current video plane.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ public MediaPacketBuffer Buffer
+ {
+ get
+ {
+ _packet.EnsureReadableState();
+ return _buffer;
+ }
+ }
+
+ /// <summary>
+ /// Gets the stride width of the current video plane.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ public int StrideWidth
+ {
+ get
+ {
+ _packet.EnsureReadableState();
+ return _strideWidth;
+ }
+ }
+
+ /// <summary>
+ /// Gets the stride height of the current video plane.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">The MediaPacket that owns the current buffer already has been disposed of.</exception>
+ public int StrideHeight
+ {
+ get
+ {
+ _packet.EnsureReadableState();
+ return _strideHeight;
+ }
+ }
+ }
+}
--- /dev/null
+
+using System.Diagnostics;
+using Tizen.Internals.Errors;
+
+namespace Tizen.Multimedia
+{
+ internal class MediaToolDebug
+ {
+
+ [ConditionalAttribute("DEBUG")]
+ internal static void AssertNoError(int errorCode)
+ {
+ Debug.Assert(errorCode == (int)ErrorCode.None, "The API is supposed not to return an error!",
+ "Implementation of core may have been changed, modify code to throw if the return code is not zero.");
+ }
+ }
+}
--- /dev/null
+using System;
+
+namespace Tizen.Multimedia
+{
+ /// <summary>
+ /// The exception that is thrown when there is no memory to allocate a new buffer for the packet.
+ /// </summary>
+ public class NotEnoughMemoryException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the NotEnoughMemoryException class with a specified error message.
+ /// </summary>
+ /// <param name="message">Error description.</param>
+ public NotEnoughMemoryException(string message) : base(message)
+ {
+ }
+ }
+}
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <PropertyGroup>\r
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
- <ProjectGuid>{026550F4-E9A0-48F3-BCBF-0AB37268C3D7}</ProjectGuid>\r
- <OutputType>Library</OutputType>\r
- <AppDesignerFolder>Properties</AppDesignerFolder>\r
- <RootNamespace>Tizen.Multimedia</RootNamespace>\r
- <AssemblyName>Tizen.Multimedia</AssemblyName>\r
- <FileAlignment>512</FileAlignment>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
- <DebugSymbols>true</DebugSymbols>\r
- <DebugType>full</DebugType>\r
- <Optimize>false</Optimize>\r
- <OutputPath>bin\Debug\Net45\</OutputPath>\r
- <DefineConstants>DEBUG;TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
- <DebugType>pdbonly</DebugType>\r
- <Optimize>true</Optimize>\r
- <OutputPath>bin\Release\Net45\</OutputPath>\r
- <DefineConstants>TRACE</DefineConstants>\r
- <ErrorReport>prompt</ErrorReport>\r
- <WarningLevel>4</WarningLevel>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <SignAssembly>true</SignAssembly>\r
- </PropertyGroup>\r
- <PropertyGroup>\r
- <AssemblyOriginatorKeyFile>Tizen.Multimedia.snk</AssemblyOriginatorKeyFile>\r
- </PropertyGroup>\r
- <ItemGroup>\r
- <Reference Include="System" />\r
- <Reference Include="System.Core" />\r
- <Reference Include="System.Xml.Linq" />\r
- <Reference Include="System.Data.DataSetExtensions" />\r
- <Reference Include="Microsoft.CSharp" />\r
- <Reference Include="System.Data" />\r
- <Reference Include="System.Net.Http" />\r
- <Reference Include="System.Xml" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <Compile Include="AudioIO\AudioErrorHelper.cs" />\r
- <Compile Include="AudioIO\AudioInput.cs" />\r
- <Compile Include="AudioIO\AudioIOEnumerations.cs" />\r
- <Compile Include="AudioIO\AudioOutput.cs" />\r
- <Compile Include="AudioIO\AudioStateChangedEventArgs.cs" />\r
- <Compile Include="AudioIO\AudioStreamLengthChangedEventArgs.cs" />\r
- <Compile Include="AudioIO\BaseAudio.cs" />\r
- <Compile Include="Interop\Interop.AudioIO.cs" />\r
- <Compile Include="Interop\Interop.EvasObject.cs" />\r
- <Compile Include="Interop\Interop.Player.cs" />\r
- <Compile Include="MediaView\MediaView.cs" />\r
- <Compile Include="Player\PlayerEnums.cs" />\r
- <Compile Include="Player\MediaStreamConfiguration.cs" />\r
- <Compile Include="Player\SubtitleTrack.cs" />\r
- <Compile Include="Player\AudioEffect.cs" />\r
- <Compile Include="Player\BufferingProgressChangedEventArgs.cs" />\r
- <Compile Include="Player\BufferStatusEventArgs.cs" />\r
- <Compile Include="Player\DownloadProgress.cs" />\r
- <Compile Include="Player\EqualizerBand.cs" />\r
- <Compile Include="Player\ProgressiveDownloadMessageEventArgs.cs" />\r
- <Compile Include="Player\ProgressiveDownloadStatus.cs" />\r
- <Compile Include="Player\SeekOffsetEventArgs.cs" />\r
- <Compile Include="Player\SubtitleUpdatedEventArgs.cs" />\r
- <Compile Include="Player\Display.cs" />\r
- <Compile Include="Player\PlaybackCompletedEventArgs.cs" />\r
- <Compile Include="Player\PlaybackErrorEventArgs.cs" />\r
- <Compile Include="Player\PlaybackInterruptedEventArgs.cs" />\r
- <Compile Include="Player\Player.cs" />\r
- <Compile Include="Player\PlayerContentInfo.cs" />\r
- <Compile Include="Player\StreamInformation.cs" />\r
- <Compile Include="Player\StreamingConfiguration.cs" />\r
- <Compile Include="Player\Subtitle.cs" />\r
- <Compile Include="Player\VideoFrameDecodedEventArgs.cs" />\r
- <Compile Include="Player\VideoFrameCapture.cs" />\r
- <Compile Include="Player\VideoStreamEventArgs.cs" />\r
- <Compile Include="Properties\AssemblyInfo.cs" />\r
- <Compile Include="Player\MediaSource.cs" />\r
- <Compile Include="Player\MediaUriSource.cs" />\r
- <Compile Include="Player\MediaBufferSource.cs" />\r
- <Compile Include="Player\MediaStreamSource.cs" />\r
- <Compile Include="Interop\Interop.Libraries.cs" />\r
- <Compile Include="Player\PlayerErrorFactory.cs" />\r
- <Compile Include="Recorder\AudioStreamDeliveredEventArgs.cs" />\r
- <Compile Include="Recorder\Camera.cs" />\r
- <Compile Include="Recorder\Recorder.cs" />\r
- <Compile Include="Recorder\RecorderEnums.cs" />\r
- <Compile Include="Recorder\RecorderErrorFactory.cs" />\r
- <Compile Include="Recorder\RecorderInterruptedEventArgs.cs" />\r
- <Compile Include="Recorder\RecorderStateChangedEventArgs.cs" />\r
- <Compile Include="Recorder\RecordingErrorOccurredEventArgs.cs" />\r
- <Compile Include="Recorder\RecordingLimitReachedEventArgs.cs" />\r
- <Compile Include="Recorder\RecordingStatusChangedEventArgs.cs" />\r
- <Compile Include="Recorder\VideoResolution.cs" />\r
- <Compile Include="Interop\Interop.Recorder.cs" />\r
- <Compile Include="Interop\Interop.RecorderAttribute.cs" />\r
- <Compile Include="Interop\Interop.RecorderCapability.cs" />\r
- <Compile Include="AudioManager\AudioDevice.cs" />\r
- <Compile Include="AudioManager\AudioDeviceConnectionChangedEventArgs.cs" />\r
- <Compile Include="AudioManager\AudioDevicePropertyChangedEventArgs.cs" />\r
- <Compile Include="AudioManager\AudioManager.cs" />\r
- <Compile Include="AudioManager\AudioManagerEnumerations.cs" />\r
- <Compile Include="AudioManager\AudioManagerErrorFactory.cs" />\r
- <Compile Include="AudioManager\AudioStreamPolicy.cs" />\r
- <Compile Include="AudioManager\AudioVolume.cs" />\r
- <Compile Include="AudioManager\FocusStateChangedEventArgs.cs" />\r
- <Compile Include="AudioManager\MaxVolumeLevel.cs" />\r
- <Compile Include="AudioManager\StreamFocusStateChangedEventArgs.cs" />\r
- <Compile Include="AudioManager\VolumeChangedEventArgs.cs" />\r
- <Compile Include="AudioManager\VolumeLevel.cs" />\r
- <Compile Include="Interop\Interop.Device.cs" />\r
- <Compile Include="Interop\Interop.StreamPolicy.cs" />\r
- <Compile Include="Interop\Interop.Volume.cs" />\r
- </ItemGroup>\r
- <ItemGroup>\r
- <None Include="Tizen.Multimedia.nuspec" />\r
- <None Include="Tizen.Multimedia.Net45.project.json" />\r
- <None Include="Tizen.Multimedia.snk" />\r
- </ItemGroup>\r
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\r
- Other similar extension points exist, see Microsoft.Common.targets.\r
- <Target Name="BeforeBuild">\r
- </Target>\r
- <Target Name="AfterBuild">\r
- </Target>\r
- -->\r
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{026550F4-E9A0-48F3-BCBF-0AB37268C3D7}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Tizen.Multimedia</RootNamespace>
+ <AssemblyName>Tizen.Multimedia</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\Net45\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\Net45\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>Tizen.Multimedia.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AudioIO\AudioErrorHelper.cs" />
+ <Compile Include="AudioIO\AudioInput.cs" />
+ <Compile Include="AudioIO\AudioIOEnumerations.cs" />
+ <Compile Include="AudioIO\AudioOutput.cs" />
+ <Compile Include="AudioIO\AudioStateChangedEventArgs.cs" />
+ <Compile Include="AudioIO\AudioStreamLengthChangedEventArgs.cs" />
+ <Compile Include="AudioIO\BaseAudio.cs" />
+ <Compile Include="Interop\Interop.AudioIO.cs" />
+ <Compile Include="Interop\Interop.MediaCodec.cs" />
+ <Compile Include="Interop\Interop.MediaTool.cs" />
+ <Compile Include="Interop\Interop.EvasObject.cs" />
+ <Compile Include="Interop\Interop.Player.cs" />
+ <Compile Include="MediaTool\MediaFormat.cs" />
+ <Compile Include="MediaTool\MediaFormatAacType.cs" />
+ <Compile Include="MediaTool\MediaFormatMimeType.cs" />
+ <Compile Include="MediaTool\MediaFormatTextType.cs" />
+ <Compile Include="MediaTool\MediaPacket.cs" />
+ <Compile Include="MediaTool\MediaPacketBuffer.cs" />
+ <Compile Include="MediaTool\MediaPacketBufferFlags.cs" />
+ <Compile Include="MediaTool\MediaPacketVideoPlane.cs" />
+ <Compile Include="MediaTool\MediaToolDebug.cs" />
+ <Compile Include="MediaTool\NotEnoughMemoryException.cs" />
+ <Compile Include="MediaView\MediaView.cs" />
+ <Compile Include="Player\PlayerEnums.cs" />
+ <Compile Include="Player\MediaStreamConfiguration.cs" />
+ <Compile Include="Player\SubtitleTrack.cs" />
+ <Compile Include="Player\AudioEffect.cs" />
+ <Compile Include="Player\BufferingProgressChangedEventArgs.cs" />
+ <Compile Include="Player\BufferStatusEventArgs.cs" />
+ <Compile Include="Player\DownloadProgress.cs" />
+ <Compile Include="Player\EqualizerBand.cs" />
+ <Compile Include="Player\ProgressiveDownloadMessageEventArgs.cs" />
+ <Compile Include="Player\ProgressiveDownloadStatus.cs" />
+ <Compile Include="Player\SeekOffsetEventArgs.cs" />
+ <Compile Include="Player\SubtitleUpdatedEventArgs.cs" />
+ <Compile Include="Player\Display.cs" />
+ <Compile Include="Player\PlaybackCompletedEventArgs.cs" />
+ <Compile Include="Player\PlaybackErrorEventArgs.cs" />
+ <Compile Include="Player\PlaybackInterruptedEventArgs.cs" />
+ <Compile Include="Player\Player.cs" />
+ <Compile Include="Player\PlayerContentInfo.cs" />
+ <Compile Include="Player\StreamInformation.cs" />
+ <Compile Include="Player\StreamingConfiguration.cs" />
+ <Compile Include="Player\Subtitle.cs" />
+ <Compile Include="Player\VideoFrameDecodedEventArgs.cs" />
+ <Compile Include="Player\VideoFrameCapture.cs" />
+ <Compile Include="Player\VideoStreamEventArgs.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Player\MediaSource.cs" />
+ <Compile Include="Player\MediaUriSource.cs" />
+ <Compile Include="Player\MediaBufferSource.cs" />
+ <Compile Include="Player\MediaStreamSource.cs" />
+ <Compile Include="Interop\Interop.Libraries.cs" />
+ <Compile Include="Player\PlayerErrorFactory.cs" />
+ <Compile Include="Recorder\AudioStreamDeliveredEventArgs.cs" />
+ <Compile Include="Recorder\Camera.cs" />
+ <Compile Include="Recorder\Recorder.cs" />
+ <Compile Include="Recorder\RecorderEnums.cs" />
+ <Compile Include="Recorder\RecorderErrorFactory.cs" />
+ <Compile Include="Recorder\RecorderInterruptedEventArgs.cs" />
+ <Compile Include="Recorder\RecorderStateChangedEventArgs.cs" />
+ <Compile Include="Recorder\RecordingErrorOccurredEventArgs.cs" />
+ <Compile Include="Recorder\RecordingLimitReachedEventArgs.cs" />
+ <Compile Include="Recorder\RecordingStatusChangedEventArgs.cs" />
+ <Compile Include="Recorder\VideoResolution.cs" />
+ <Compile Include="Interop\Interop.Recorder.cs" />
+ <Compile Include="Interop\Interop.RecorderAttribute.cs" />
+ <Compile Include="Interop\Interop.RecorderCapability.cs" />
+ <Compile Include="AudioManager\AudioDevice.cs" />
+ <Compile Include="AudioManager\AudioDeviceConnectionChangedEventArgs.cs" />
+ <Compile Include="AudioManager\AudioDevicePropertyChangedEventArgs.cs" />
+ <Compile Include="AudioManager\AudioManager.cs" />
+ <Compile Include="AudioManager\AudioManagerEnumerations.cs" />
+ <Compile Include="AudioManager\AudioManagerErrorFactory.cs" />
+ <Compile Include="AudioManager\AudioStreamPolicy.cs" />
+ <Compile Include="AudioManager\AudioVolume.cs" />
+ <Compile Include="AudioManager\FocusStateChangedEventArgs.cs" />
+ <Compile Include="AudioManager\MaxVolumeLevel.cs" />
+ <Compile Include="AudioManager\StreamFocusStateChangedEventArgs.cs" />
+ <Compile Include="AudioManager\VolumeChangedEventArgs.cs" />
+ <Compile Include="AudioManager\VolumeLevel.cs" />
+ <Compile Include="Interop\Interop.Device.cs" />
+ <Compile Include="Interop\Interop.StreamPolicy.cs" />
+ <Compile Include="Interop\Interop.Volume.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Tizen.Multimedia.nuspec" />
+ <None Include="Tizen.Multimedia.Net45.project.json" />
+ <None Include="Tizen.Multimedia.snk" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
</Project>
\ No newline at end of file
<Compile Include="AudioIO\AudioStreamLengthChangedEventArgs.cs" />
<Compile Include="AudioIO\BaseAudio.cs" />
<Compile Include="Interop\Interop.AudioIO.cs" />
+ <Compile Include="Interop\Interop.MediaCodec.cs" />
+ <Compile Include="Interop\Interop.MediaTool.cs" />
<Compile Include="Interop\Interop.Player.cs" />
<Compile Include="Interop\Interop.MetadataExtractor.cs" />
+ <Compile Include="MediaTool\MediaFormat.cs" />
+ <Compile Include="MediaTool\MediaFormatAacType.cs" />
+ <Compile Include="MediaTool\MediaFormatMimeType.cs" />
+ <Compile Include="MediaTool\MediaFormatTextType.cs" />
+ <Compile Include="MediaTool\MediaPacket.cs" />
+ <Compile Include="MediaTool\MediaPacketBuffer.cs" />
+ <Compile Include="MediaTool\MediaPacketBufferFlags.cs" />
+ <Compile Include="MediaTool\MediaPacketVideoPlane.cs" />
+ <Compile Include="MediaTool\MediaToolDebug.cs" />
+ <Compile Include="MediaTool\NotEnoughMemoryException.cs" />
<Compile Include="MetadataExtractor\MetadataEnums.cs" />
<Compile Include="MetadataExtractor\MetadataExtractorErrorFactory.cs" />
<Compile Include="MetadataExtractor\Synclyrics.cs" />
<_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
</PropertyGroup>
-</Project>
+</Project>
\ No newline at end of file