﻿// Decompiled with JetBrains decompiler
// Type: AForge.Video.DirectShow.Internals.AMMediaType
// Assembly: PluginRemoteWebcam, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 264B4BD0-AE99-4418-804A-8A34B1A0A20B
// Assembly location: C:\Users\ian\Downloads\Telegram Desktop\fein\Plugins\PluginRemoteWebcam.dll

using System;
using System.Runtime.InteropServices;


namespace AForge.Video.DirectShow.Internals
{
	[ComVisible(false)]
	[StructLayout(LayoutKind.Sequential)]
	internal class AMMediaType : IDisposable
	{
		public Guid MajorType;
		public Guid SubType;
		[MarshalAs(UnmanagedType.Bool)]
		public bool FixedSizeSamples = true;
		[MarshalAs(UnmanagedType.Bool)]
		public bool TemporalCompression;
		public int SampleSize = 1;
		public Guid FormatType;
		public IntPtr unkPtr;
		public int FormatSize;
		public IntPtr FormatPtr;

		~AMMediaType() => this.Dispose(false);

		public void Dispose()
		{
			this.Dispose(true);
			GC.SuppressFinalize((object) this);
		}

		protected virtual void Dispose(bool disposing)
		{
			if (this.FormatSize != 0 && this.FormatPtr != IntPtr.Zero)
			{
				Marshal.FreeCoTaskMem(this.FormatPtr);
				this.FormatSize = 0;
			}
			if (!(this.unkPtr != IntPtr.Zero))
				return;
			Marshal.Release(this.unkPtr);
			this.unkPtr = IntPtr.Zero;
		}
	}
}
