- Use out variable.
- Validate enum with util method.
- MediaPacket.Lock now uses a field of MediaPacket not packet itself.
- And minor code improvement.
Signed-off-by: coderhyme <jhyo.kim@samsung.com>
{
[DllImport("libevas.so.1")]
internal static extern IntPtr evas_object_image_add(IntPtr parent);
+
[DllImport("libevas.so.1")]
internal static extern IntPtr evas_object_evas_get(IntPtr obj);
- [DllImport("libevas.so.1")]
- internal static extern void evas_object_show(IntPtr obj);
}
}
}
\ No newline at end of file
[DllImport(Libraries.Libc, EntryPoint = "free")]
public static extern void Free(IntPtr ptr);
-
-
[DllImport(Libraries.Libc, EntryPoint = "access")]
public static extern int Access(string path, int mode);
}
[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);
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);
+ internal static extern int GetType(IntPtr handle, out MediaFormatType type);
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_container_mime")]
- internal static extern int GetContainerMimeType(IntPtr handle, out int mimeType);
+ internal static extern int GetContainerMimeType(IntPtr handle,
+ out MediaFormatContainerMimeType mimeType);
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_container_mime")]
- internal static extern int SetContainerMimeType(IntPtr handle, int mimeType);
+ internal static extern int SetContainerMimeType(IntPtr handle,
+ MediaFormatContainerMimeType mimeType);
#region Video apis
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_video_info")]
- internal static extern int GetVideoInfo(IntPtr handle, out int mimeType,
+ internal static extern int GetVideoInfo(IntPtr handle, out MediaFormatVideoMimeType 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);
+ internal static extern int SetVideoMimeType(IntPtr handle, MediaFormatVideoMimeType value);
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_width")]
internal static extern int SetVideoWidth(IntPtr handle, int value);
#region Audio apis
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_info")]
- internal static extern int GetAudioInfo(IntPtr handle, out int mimeType,
+ internal static extern int GetAudioInfo(IntPtr handle, out MediaFormatAudioMimeType 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);
+ internal static extern int GetAudioAacType(IntPtr handle, out MediaFormatAacType aacType);
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_mime")]
- internal static extern int SetAudioMimeType(IntPtr handle, int value);
+ internal static extern int SetAudioMimeType(IntPtr handle, MediaFormatAudioMimeType value);
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_channel")]
internal static extern int SetAudioChannel(IntPtr handle, int value);
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);
+ internal static extern int SetAudioAacType(IntPtr handle, MediaFormatAacType value);
#endregion
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_text_info")]
- internal static extern int GetTextInfo(IntPtr handle, out int mimeType, out int textType);
+ internal static extern int GetTextInfo(IntPtr handle,
+ out MediaFormatTextMimeType mimeType, out MediaFormatTextType textType);
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_mime")]
- internal static extern int SetTextMimeType(IntPtr handle, int value);
+ internal static extern int SetTextMimeType(IntPtr handle, MediaFormatTextMimeType value);
[DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_type")]
- internal static extern int SetTextType(IntPtr handle, int value);
+ internal static extern int SetTextType(IntPtr handle, MediaFormatTextType value);
}
}
}
\ No newline at end of file
/// <since_tizen> 3 </since_tizen>
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.
/// <since_tizen> 3 </since_tizen>
public AudioMediaFormat(MediaFormatAudioMimeType mimeType,
int channel, int sampleRate, int bit, int bitRate)
- : this(mimeType, channel, sampleRate, bit, bitRate, MediaFormatAacType.None)
+ : this(mimeType, channel, sampleRate, bit, bitRate, MediaFormatAacType.None)
{
}
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 }");
- }
+ ValidationUtil.ValidateEnum(typeof(MediaFormatAudioMimeType), mimeType, nameof(mimeType));
+
if (channel < 0)
{
- throw new ArgumentOutOfRangeException("Channel value can't be negative.");
+ throw new ArgumentOutOfRangeException(nameof(channel), channel,
+ "Channel value can't be negative.");
}
if (sampleRate < 0)
{
- throw new ArgumentOutOfRangeException("Sample rate value can't be negative.");
+ throw new ArgumentOutOfRangeException(nameof(sampleRate), sampleRate,
+ "Sample rate value can't be negative.");
}
if (bit < 0)
{
- throw new ArgumentOutOfRangeException("Bit value can't be negative.");
+ throw new ArgumentOutOfRangeException(nameof(bit), bit,
+ "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 }");
+ throw new ArgumentOutOfRangeException(nameof(bitRate), bitRate,
+ "Bit rate value can't be negative.");
}
+
+ ValidationUtil.ValidateEnum(typeof(MediaFormatAacType), aacType, nameof(aacType));
+
if (!IsAacSupportedMimeType(mimeType) && aacType != MediaFormatAacType.None)
{
throw new ArgumentException("Aac is supported only with aac mime types.");
{
Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
- MediaFormatAudioMimeType mimeType;
- int channel = 0;
- int sampleRate = 0;
- int bit = 0;
- int bitRate = 0;
- MediaFormatAacType aacType;
- GetInfo(handle, out mimeType, out channel, out sampleRate, out bit, out bitRate);
-
- if (IsAacSupportedMimeType(mimeType))
- {
- GetAacType(handle, out aacType);
- }
- else
- {
- aacType = MediaFormatAacType.None;
- }
+ GetInfo(handle, out var mimeType, out var channel, out var sampleRate, out var bit, out var bitRate);
MimeType = mimeType;
Channel = channel;
SampleRate = sampleRate;
Bit = bit;
BitRate = bitRate;
- AacType = aacType;
+ AacType = IsAacSupportedMimeType(mimeType) ? GetAacType(handle) : MediaFormatAacType.None;
}
/// <summary>
{
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;
+ out mimeType, out channel, out sampleRate, out bit, out bitRate);
MultimediaDebug.AssertNoError(ret);
/// Retrieves the AAC type value from a native handle.
/// </summary>
/// <param name="handle">A native handle that the properties are retrieved from.</param>
- /// <param name="aacType">An out parameter for tha AAC type.</param>
- private static void GetAacType(IntPtr handle, out MediaFormatAacType aacType)
+ private static MediaFormatAacType GetAacType(IntPtr handle)
{
Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
- int aacTypeValue = 0;
-
- int ret = Interop.MediaFormat.GetAudioAacType(handle, out aacTypeValue);
+ int ret = Interop.MediaFormat.GetAudioAacType(handle, out var aacType);
MultimediaDebug.AssertNoError(ret);
- aacType = (MediaFormatAacType)aacTypeValue;
-
Debug.Assert(Enum.IsDefined(typeof(MediaFormatAacType), aacType), "Invalid aac type!");
+
+ return aacType;
}
internal override void AsNativeHandle(IntPtr handle)
{
Debug.Assert(Type == MediaFormatType.Audio);
- int ret = Interop.MediaFormat.SetAudioMimeType(handle, (int)MimeType);
+ int ret = Interop.MediaFormat.SetAudioMimeType(handle, MimeType);
MultimediaDebug.AssertNoError(ret);
ret = Interop.MediaFormat.SetAudioChannel(handle, Channel);
ret = Interop.MediaFormat.SetAudioAverageBps(handle, BitRate);
MultimediaDebug.AssertNoError(ret);
- ret = Interop.MediaFormat.SetAudioAacType(handle, (int)AacType);
+ ret = Interop.MediaFormat.SetAudioAacType(handle, AacType);
MultimediaDebug.AssertNoError(ret);
}
}
return MimeType == rhs.MimeType && Channel == rhs.Channel && SampleRate == rhs.SampleRate &&
- Bit == rhs.Bit && BitRate == rhs.BitRate;
+ Bit == rhs.Bit && BitRate == rhs.BitRate && AacType == rhs.AacType;
}
/// <summary>
/// <returns>The hash code for this instance of <see cref="AudioMediaFormat"/>.</returns>
/// <since_tizen> 3 </since_tizen>
public override int GetHashCode()
- => new { MimeType, Channel, SampleRate, Bit, BitRate }.GetHashCode();
+ => new { MimeType, Channel, SampleRate, Bit, BitRate, AacType }.GetHashCode();
}
}
public ContainerMediaFormat(MediaFormatContainerMimeType mimeType)
: base(MediaFormatType.Container)
{
- if (!Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType))
- {
- throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
- }
+ ValidationUtil.ValidateEnum(typeof(MediaFormatContainerMimeType), mimeType,
+ nameof(mimeType));
+
MimeType = mimeType;
}
{
Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
- int mimeType = 0;
-
- int ret = Interop.MediaFormat.GetContainerMimeType(handle, out mimeType);
+ int ret = Interop.MediaFormat.GetContainerMimeType(handle, out var mimeType);
MultimediaDebug.AssertNoError(ret);
Debug.Assert(Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType),
"Invalid container mime type!");
- MimeType = (MediaFormatContainerMimeType)mimeType;
+ MimeType = mimeType;
}
/// <summary>
{
Debug.Assert(Type == MediaFormatType.Container);
- int ret = Interop.MediaFormat.SetContainerMimeType(handle, (int)MimeType);
+ int ret = Interop.MediaFormat.SetContainerMimeType(handle, MimeType);
MultimediaDebug.AssertNoError(ret);
}
/// </summary>
/// <returns>The hash code for this instance of <see cref="ContainerMediaFormat"/>.</returns>
/// <since_tizen> 3 </since_tizen>
- public override int GetHashCode()
- => (int)MimeType;
+ public override int GetHashCode() => MimeType.GetHashCode();
}
}
/// Gets the type of the current format.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public MediaFormatType Type
- {
- get;
- }
+ public MediaFormatType Type { get; }
/// <summary>
/// Creates a media format from a native handle.
{
if (handle == IntPtr.Zero)
{
- throw new ArgumentException("The handle value is invalid.");
+ throw new ArgumentException("The handle value is invalid.", nameof(handle));
}
- int type = 0;
- int ret = Interop.MediaFormat.GetType(handle, out type);
+ int ret = Interop.MediaFormat.GetType(handle, out var type);
if (ret != (int)ErrorCode.InvalidOperation)
{
MultimediaDebug.AssertNoError(ret);
- switch ((MediaFormatType)type)
+ switch (type)
{
case MediaFormatType.Container:
return new ContainerMediaFormat(handle);
/// <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);
+ int ret = Interop.MediaFormat.Create(out var handle);
MultimediaDebug.AssertNoError(ret);
}
}
- internal bool IsLocked
- {
- get
- {
- return Interlocked.CompareExchange(ref _locked, 0, 0) == LOCKED;
- }
- }
+ internal bool IsLocked => Interlocked.CompareExchange(ref _locked, 0, 0) == LOCKED;
}
/// <summary>
{
Debug.Assert(packet != null);
- lock (packet)
+ lock (packet._lock)
{
- Lock lck = FromHandle(packet._handle);
-
- if (lck == null)
- {
- lck = new Lock(packet);
- }
+ Lock lck = FromHandle(packet._handle) ?? new Lock(packet);
lck._lockCount++;
private static IntPtr GetExtra(IntPtr handle)
{
- IntPtr value;
-
- int ret = Interop.MediaPacket.GetExtra(handle, out value);
+ int ret = Interop.MediaPacket.GetExtra(handle, out var value);
MultimediaDebug.AssertNoError(ret);
return value;
}
- internal IntPtr GetHandle()
- {
- return _packet.GetHandle();
- }
+ internal IntPtr GetHandle() => _packet.GetHandle();
- internal MediaPacket MediaPacket
- {
- get
- {
- return _packet;
- }
- }
+ internal MediaPacket MediaPacket => _packet;
private bool _isDisposed = false;
{
if (!_isDisposed)
{
- lock (_packet)
+ lock (_packet._lock)
{
_lockCount--;
_gcHandle.Free();
}
- //We can assure that at this point '_packet' is always locked by this lock.
+ // We can assure that at this point '_packet' is always locked by this lock.
_packet._lock.SetUnlock();
}
}
throw new ArgumentNullException(nameof(format));
}
- if (format.Type == MediaFormatType.Container)
- {
- throw new ArgumentException("Container format can't be used to create a new packet.");
- }
-
Initialize(format);
+
_format = format;
_buffer = new Lazy<IMediaBuffer>(GetBuffer);
}
{
if (format.Type == MediaFormatType.Container)
{
- throw new ArgumentException("Creating a packet for container is not supported.");
+ throw new ArgumentException("Container format can't be used to create a new packet.",
+ nameof(format));
}
IntPtr formatHandle = IntPtr.Zero;
{
ValidateNotDisposed();
- ulong value = 0;
- int ret = Interop.MediaPacket.GetPts(_handle, out value);
+ int ret = Interop.MediaPacket.GetPts(_handle, out var value);
MultimediaDebug.AssertNoError(ret);
{
ValidateNotDisposed();
- ulong value = 0;
- int ret = Interop.MediaPacket.GetDts(_handle, out value);
+ int ret = Interop.MediaPacket.GetDts(_handle, out var value);
MultimediaDebug.AssertNoError(ret);
{
ValidateNotDisposed();
- bool value = false;
- int ret = Interop.MediaPacket.IsEncoded(_handle, out value);
+ int ret = Interop.MediaPacket.IsEncoded(_handle, out var value);
MultimediaDebug.AssertNoError(ret);
{
ValidateNotDisposed();
- ulong value = 0;
- int ret = Interop.MediaPacket.GetBufferSize(_handle, out value);
+ int ret = Interop.MediaPacket.GetBufferSize(_handle, out var value);
MultimediaDebug.AssertNoError(ret);
Debug.Assert(value < int.MaxValue);
if (value < 0 || value >= Buffer.Length)
{
- throw new ArgumentOutOfRangeException("value must be less than Buffer.Size.");
+ throw new ArgumentOutOfRangeException(nameof(value), value,
+ "value must be less than Buffer.Size.");
}
int ret = Interop.MediaPacket.SetBufferSize(_handle, (ulong)value);
/// Gets a value indicating whether the packet is in the raw video format.
/// </summary>
/// <value>true if the packet is in the raw video format; otherwise, false.</value>
- private bool IsVideoPlaneSupported
- {
- get
- {
- return !IsEncoded && Format.Type == MediaFormatType.Video;
- }
- }
+ private bool IsVideoPlaneSupported => !IsEncoded && Format.Type == MediaFormatType.Video;
/// <summary>
/// Retrieves video planes of the current packet.
{
Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
- uint numberOfPlanes = 0;
- int ret = Interop.MediaPacket.GetNumberOfVideoPlanes(_handle, out numberOfPlanes);
+ int ret = Interop.MediaPacket.GetNumberOfVideoPlanes(_handle, out var numberOfPlanes);
MultimediaDebug.AssertNoError(ret);
Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!");
- IntPtr dataHandle;
-
- int ret = Interop.MediaPacket.GetBufferData(_handle, out dataHandle);
+ int ret = Interop.MediaPacket.GetBufferData(_handle, out var dataHandle);
MultimediaDebug.AssertNoError(ret);
Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!");
- int size = 0;
- ret = Interop.MediaPacket.GetAllocatedBufferSize(_handle, out size);
+ ret = Interop.MediaPacket.GetAllocatedBufferSize(_handle, out var size);
MultimediaDebug.AssertNoError(ret);
Debug.Assert(size >= 0, "size must not be negative!");
Debug.Assert(_strideWidth >= 0 && _strideHeight >= 0, "size must not be negative!");
- IntPtr dataHandle;
- ret = Interop.MediaPacket.GetVideoPlaneData(packet.GetHandle(), index, out dataHandle);
+ ret = Interop.MediaPacket.GetVideoPlaneData(packet.GetHandle(), index, out var dataHandle);
MultimediaDebug.AssertNoError(ret);
Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!");
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 }");
- }
+ ValidationUtil.ValidateEnum(typeof(MediaFormatTextMimeType), mimeType, nameof(mimeType));
+ ValidationUtil.ValidateEnum(typeof(MediaFormatTextType), textType, nameof(textType));
+
MimeType = mimeType;
TextType = textType;
}
{
Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
- MediaFormatTextMimeType mimeType;
- MediaFormatTextType textType;
-
- GetInfo(handle, out mimeType, out textType);
-
- MimeType = mimeType;
- TextType = textType;
- }
-
- /// <summary>
- /// Retrieves text properties of the media format from a native handle.
- /// </summary>
- /// <param name="handle">A native handle that the properties are retrieved from.</param>
- /// <param name="mimeType">An out parameter for the mime type.</param>
- /// <param name="textType">An out parameter for the 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);
+ int ret = Interop.MediaFormat.GetTextInfo(handle, out var mimeType, out var textType);
MultimediaDebug.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!");
+
+ MimeType = mimeType;
+ TextType = textType;
}
internal override void AsNativeHandle(IntPtr handle)
{
Debug.Assert(Type == MediaFormatType.Text);
- int ret = Interop.MediaFormat.SetTextMimeType(handle, (int)MimeType);
+ int ret = Interop.MediaFormat.SetTextMimeType(handle, MimeType);
MultimediaDebug.AssertNoError(ret);
- ret = Interop.MediaFormat.SetTextType(handle, (int)TextType);
+ ret = Interop.MediaFormat.SetTextType(handle, TextType);
MultimediaDebug.AssertNoError(ret);
}
int frameRate, int bitRate)
: base(MediaFormatType.Video)
{
- if (!Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType))
- {
- throw new ArgumentException($"Invalid mime type value : { (int)mimeType }");
- }
+ ValidationUtil.ValidateEnum(typeof(MediaFormatVideoMimeType), mimeType, nameof(mimeType));
+
if (size.Width < 0)
{
throw new ArgumentOutOfRangeException(nameof(size), size.Width, "Size.Width value can't be less than zero.");
{
Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!");
- int width = 0;
- int height = 0;
- int bitRate = 0;
- int frameRate = 0;
- MediaFormatVideoMimeType mimeType;
- GetInfo(handle, out width, out height, out bitRate, out mimeType);
-
- GetFrameRate(handle, out frameRate);
-
- MimeType = mimeType;
- Size = new Size(width, height);
- FrameRate = frameRate;
- BitRate = bitRate;
- }
-
- /// <summary>
- /// Retrieves video properties of the media format from a native handle.
- /// </summary>
- /// <param name="handle">A native handle that the properties are retrieved from.</param>
- /// <param name="width">An out parameter for the width.</param>
- /// <param name="height">An out parameter for the height.</param>
- /// <param name="bitRate">An out parameter for the bit rate.</param>
- /// <param name="mimeType">An out parameter for the 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);
+ out var mimeType, out var width, out var height, out var bitRate, out var maxBps);
MultimediaDebug.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 the properties are retrieved from.</param>
- /// <param name="frameRate">An out parameter for the 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);
+ ret = Interop.MediaFormat.GetVideoFrameRate(handle, out var frameRate);
MultimediaDebug.AssertNoError(ret);
+
+ MimeType = mimeType;
+ Size = new Size(width, height);
+ FrameRate = frameRate;
+ BitRate = bitRate;
}
internal override void AsNativeHandle(IntPtr handle)
{
Debug.Assert(Type == MediaFormatType.Video);
- int ret = Interop.MediaFormat.SetVideoMimeType(handle, (int)MimeType);
+ int ret = Interop.MediaFormat.SetVideoMimeType(handle, MimeType);
MultimediaDebug.AssertNoError(ret);
ret = Interop.MediaFormat.SetVideoWidth(handle, Size.Width);