⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsutils.cs

📁 DirectShowLibV1-5針對DirectShow一些函數以及指令和LIB的檔案
💻 CS
📖 第 1 页 / 共 5 页
字号:
            return this.guid;
        }

        /// <summary>
        /// Get a new DirectShowLib.DsGuid instance for a given System.Guid
        /// </summary>
        /// <param name="g">The System.Guid to wrap into a DirectShowLib.DsGuid</param>
        /// <returns>A new instance of DirectShowLib.DsGuid</returns>
        public static DsGuid FromGuid(Guid g)
        {
            return new DsGuid(g);
        }
    }

    /// <summary>
    /// DirectShowLib.DsRect is a managed representation of the Win32 RECT structure.
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public class DsRect
    {
        public int left;
        public int top;
        public int right;
        public int bottom;

        /// <summary>
        /// Empty contructor. Initialize all fields to 0
        /// </summary>
        public DsRect()
        {
            this.left = 0;
            this.top = 0;
            this.right = 0;
            this.bottom = 0;
        }

        /// <summary>
        /// A parametred constructor. Initialize fields with given values.
        /// </summary>
        /// <param name="left">the left value</param>
        /// <param name="top">the top value</param>
        /// <param name="right">the right value</param>
        /// <param name="bottom">the bottom value</param>
        public DsRect(int left, int top, int right, int bottom)
        {
            this.left = left;
            this.top = top;
            this.right = right;
            this.bottom = bottom;
        }

        /// <summary>
        /// A parametred constructor. Initialize fields with a given <see cref="System.Drawing.Rectangle"/>.
        /// </summary>
        /// <param name="rectangle">A <see cref="System.Drawing.Rectangle"/></param>
        /// <remarks>
        /// Warning, DsRect define a rectangle by defining two of his corners and <see cref="System.Drawing.Rectangle"/> define a rectangle with his upper/left corner, his width and his height.
        /// </remarks>
        public DsRect(Rectangle rectangle)
        {
            this.left = rectangle.Left;
            this.top = rectangle.Top;
            this.right = rectangle.Right;
            this.bottom = rectangle.Bottom;
        }

        /// <summary>
        /// Provide de string representation of this DsRect instance
        /// </summary>
        /// <returns>A string formated like this : [left, top - right, bottom]</returns>
        public override string ToString()
        {
            return string.Format("[{0}, {1} - {2}, {3}]", this.left, this.top, this.right, this.bottom);
        }

        public override int GetHashCode()
        {
            return this.left.GetHashCode() |
                this.top.GetHashCode() |
                this.right.GetHashCode() |
                this.bottom.GetHashCode();
        }

        /// <summary>
        /// Define implicit cast between DirectShowLib.DsRect and System.Drawing.Rectangle for languages supporting this feature.
        /// VB.Net doesn't support implicit cast. <see cref="DirectShowLib.DsRect.ToRectangle"/> for similar functionality.
        /// <code>
        ///   // Define a new Rectangle instance
        ///   Rectangle r = new Rectangle(0, 0, 100, 100);
        ///   // Do implicit cast between Rectangle and DsRect
        ///   DsRect dsR = r;
        ///
        ///   Console.WriteLine(dsR.ToString());
        /// </code>
        /// </summary>
        /// <param name="r">a DsRect to be cast</param>
        /// <returns>A casted System.Drawing.Rectangle</returns>
        public static implicit operator Rectangle(DsRect r)
        {
            return r.ToRectangle();
        }

        /// <summary>
        /// Define implicit cast between System.Drawing.Rectangle and DirectShowLib.DsRect for languages supporting this feature.
        /// VB.Net doesn't support implicit cast. <see cref="DirectShowLib.DsRect.FromRectangle"/> for similar functionality.
        /// <code>
        ///   // Define a new DsRect instance
        ///   DsRect dsR = new DsRect(0, 0, 100, 100);
        ///   // Do implicit cast between DsRect and Rectangle
        ///   Rectangle r = dsR;
        ///
        ///   Console.WriteLine(r.ToString());
        /// </code>
        /// </summary>
        /// <param name="r">A System.Drawing.Rectangle to be cast</param>
        /// <returns>A casted DsRect</returns>
        public static implicit operator DsRect(Rectangle r)
        {
            return new DsRect(r);
        }

        /// <summary>
        /// Get the System.Drawing.Rectangle equivalent to this DirectShowLib.DsRect instance.
        /// </summary>
        /// <returns>A System.Drawing.Rectangle</returns>
        public Rectangle ToRectangle()
        {
            return new Rectangle(this.left, this.top, (this.right - this.left), (this.bottom - this.top));
        }

        /// <summary>
        /// Get a new DirectShowLib.DsRect instance for a given <see cref="System.Drawing.Rectangle"/>
        /// </summary>
        /// <param name="r">The <see cref="System.Drawing.Rectangle"/> used to initialize this new DirectShowLib.DsGuid</param>
        /// <returns>A new instance of DirectShowLib.DsGuid</returns>
        public static DsRect FromRectangle(Rectangle r)
        {
            return new DsRect(r);
        }
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct NormalizedRect
    {
        public float left;
        public float top;
        public float right;
        public float bottom;

        public NormalizedRect(float l, float t, float r, float b)
        {
            this.left = l;
            this.top = t;
            this.right = r;
            this.bottom = b;
        }

        public NormalizedRect(RectangleF r)
        {
            this.left = r.Left;
            this.top = r.Top;
            this.right = r.Right;
            this.bottom = r.Bottom;
        }

        public override string ToString()
        {
            return string.Format("[{0}, {1} - {2}, {3}]", this.left, this.top, this.right, this.bottom);
        }

        public override int GetHashCode()
        {
            return this.left.GetHashCode() |
                this.top.GetHashCode() |
                this.right.GetHashCode() |
                this.bottom.GetHashCode();
        }

        public static implicit operator RectangleF(NormalizedRect r)
        {
            return r.ToRectangleF();
        }

        public static implicit operator NormalizedRect(Rectangle r)
        {
            return new NormalizedRect(r);
        }

        public static bool operator ==(NormalizedRect r1, NormalizedRect r2)
        {
            return ((r1.left == r2.left) && (r1.top == r2.top) && (r1.right == r2.right) && (r1.bottom == r2.bottom));
        }

        public static bool operator !=(NormalizedRect r1, NormalizedRect r2)
        {
            return ((r1.left != r2.left) || (r1.top != r2.top) || (r1.right != r2.right) || (r1.bottom != r2.bottom));
        }

        public override bool Equals(object obj)
        {
            if (!(obj is NormalizedRect))
                return false;

            NormalizedRect other = (NormalizedRect) obj;
            return (this == other);
        }


        public RectangleF ToRectangleF()
        {
            return new RectangleF(this.left, this.top, (this.right - this.left), (this.bottom - this.top));
        }

        public static NormalizedRect FromRectangle(RectangleF r)
        {
            return new NormalizedRect(r);
        }
    }

    #endregion

    #region Utility Classes

    sealed public class DsResults
    {
        private DsResults()
        {
            // Prevent people from trying to instantiate this class
        }

        public const int E_InvalidMediaType = unchecked((int)0x80040200);
        public const int E_InvalidSubType = unchecked((int)0x80040201);
        public const int E_NeedOwner = unchecked((int)0x80040202);
        public const int E_EnumOutOfSync = unchecked((int)0x80040203);
        public const int E_AlreadyConnected = unchecked((int)0x80040204);
        public const int E_FilterActive = unchecked((int)0x80040205);
        public const int E_NoTypes = unchecked((int)0x80040206);
        public const int E_NoAcceptableTypes = unchecked((int)0x80040207);
        public const int E_InvalidDirection = unchecked((int)0x80040208);
        public const int E_NotConnected = unchecked((int)0x80040209);
        public const int E_NoAllocator = unchecked((int)0x8004020A);
        public const int E_RunTimeError = unchecked((int)0x8004020B);
        public const int E_BufferNotSet = unchecked((int)0x8004020C);
        public const int E_BufferOverflow = unchecked((int)0x8004020D);
        public const int E_BadAlign = unchecked((int)0x8004020E);
        public const int E_AlreadyCommitted = unchecked((int)0x8004020F);
        public const int E_BuffersOutstanding = unchecked((int)0x80040210);
        public const int E_NotCommitted = unchecked((int)0x80040211);
        public const int E_SizeNotSet = unchecked((int)0x80040212);
        public const int E_NoClock = unchecked((int)0x80040213);
        public const int E_NoSink = unchecked((int)0x80040214);
        public const int E_NoInterface = unchecked((int)0x80040215);
        public const int E_NotFound = unchecked((int)0x80040216);
        public const int E_CannotConnect = unchecked((int)0x80040217);
        public const int E_CannotRender = unchecked((int)0x80040218);
        public const int E_ChangingFormat = unchecked((int)0x80040219);
        public const int E_NoColorKeySet = unchecked((int)0x8004021A);
        public const int E_NotOverlayConnection = unchecked((int)0x8004021B);
        public const int E_NotSampleConnection = unchecked((int)0x8004021C);
        public const int E_PaletteSet = unchecked((int)0x8004021D);
        public const int E_ColorKeySet = unchecked((int)0x8004021E);
        public const int E_NoColorKeyFound = unchecked((int)0x8004021F);
        public const int E_NoPaletteAvailable = unchecked((int)0x80040220);
        public const int E_NoDisplayPalette = unchecked((int)0x80040221);
        public const int E_TooManyColors = unchecked((int)0x80040222);
        public const int E_StateChanged = unchecked((int)0x80040223);
        public const int E_NotStopped = unchecked((int)0x80040224);
        public const int E_NotPaused = unchecked((int)0x80040225);
        public const int E_NotRunning = unchecked((int)0x80040226);
        public const int E_WrongState = unchecked((int)0x80040227);
        public const int E_StartTimeAfterEnd = unchecked((int)0x80040228);
        public const int E_InvalidRect = unchecked((int)0x80040229);
        public const int E_TypeNotAccepted = unchecked((int)0x8004022A);
        public const int E_SampleRejected = unchecked((int)0x8004022B);
        public const int E_SampleRejectedEOS = unchecked((int)0x8004022C);
        public const int E_DuplicateName = unchecked((int)0x8004022D);
        public const int S_DuplicateName = unchecked((int)0x0004022D);
        public const int E_Timeout = unchecked((int)0x8004022E);
        public const int E_InvalidFileFormat = unchecked((int)0x8004022F);
        public const int E_EnumOutOfRange = unchecked((int)0x80040230);
        public const int E_CircularGraph = unchecked((int)0x80040231);
        public const int E_NotAllowedToSave = unchecked((int)0x80040232);
        public const int E_TimeAlreadyPassed = unchecked((int)0x80040233);
        public const int E_AlreadyCancelled = unchecked((int)0x80040234);
        public const int E_CorruptGraphFile = unchecked((int)0x80040235);
        public const int E_AdviseAlreadySet = unchecked((int)0x80040236);
        public const int S_StateIntermediate = unchecked((int)0x00040237);
        public const int E_NoModexAvailable = unchecked((int)0x80040238);
        public const int E_NoAdviseSet = unchecked((int)0x80040239);
        public const int E_NoFullScreen = unchecked((int)0x8004023A);
        public const int E_InFullScreenMode = unchecked((int)0x8004023B);
        public const int E_UnknownFileType = unchecked((int)0x80040240);
        public const int E_CannotLoadSourceFilter = unchecked((int)0x80040241);
        public const int S_PartialRender = unchecked((int)0x00040242);
        public const int E_FileTooShort = unchecked((int)0x80040243);
        public const int E_InvalidFileVersion = unchecked((int)0x80040244);
        public const int S_SomeDataIgnored = unchecked((int)0x00040245);
        public const int S_ConnectionsDeferred = unchecked((int)0x00040246);
        public const int E_InvalidCLSID = unchecked((int)0x80040247);
        public const int E_InvalidMediaType2 = unchecked((int)0x80040248);
        public const int E_BabKey = unchecked((int)0x800403F2);
        public const int S_NoMoreItems = unchecked((int)0x00040103);
        public const int E_SampleTimeNotSet = unchecked((int)0x80040249);
        public const int S_ResourceNotNeeded = unchecked((int)0x00040250);
        public const int E_MediaTimeNotSet = unchecked((int)0x80040251);
        public const int E_NoTimeFormatSet = unchecked((int)0x80040252);
        public const int E_MonoAudioHW = unchecked((int)0x80040253);
        public const int S_MediaTypeIgnored = unchecked((int)0x00040254);
        public const int E_NoDecompressor = unchecked((int)0x80040255);
        public const int E_NoAudioHardware = unchecked((int)0x80040256);
        public const int S_VideoNotRendered = unchecked((int)0x00040257);
        public const int S_AudioNotRendered = unchecked((int)0x00040258);
        public const int E_RPZA = unchecked((int)0x80040259);
        public const int S_RPZA = unchecked((int)0x0004025A);
        public const int E_ProcessorNotSuitable = unchecked((int)0x8004025B);
        public const int E_UnsupportedAudio = unchecked((int)0x8004025C);
        public const int E_UnsupportedVideo = unchecked((int)0x8004025D);
        public const int E_MPEGNotConstrained = unchecked((int)0x8004025E);
        public const int E_NotInGraph = unchecked((int)0x8004025F);
        public const int S_Estimated = unchecked((int)0x00040260);
        public const int E_NoTimeFormat = unchecked((int)0x80040261);
        public const int E_ReadOnly = unchecked((int)0x80040262);
        public const int S_Reserved = unchecked((int)0x00040263);
        public const int E_BufferUnderflow = unchecked((int)0x80040264);
        public const int E_UnsupportedStream = unchecked((int)0x80040265);
        public const int E_NoTransport = unchecked((int)0x80040266);
        public const int S_StreamOff = unchecked((int)0x00040267);
        public const int S_CantCue = unchecked((int)0x00040268);
        public const int E_BadVideoCD = unchecked((int)0x80040269);
        public const int S_NoStopTime = unchecked((int)0x00040270);
        public const int E_OutOfVideoMemory = unchecked((int)0x80040271);
        public const int E_VPNegotiationFailed = unchecked((int)0x80040272);
        public const int E_DDrawCapsNotSuitable = unchecked((int)0x80040273);
        public const int E_NoVPHardware = unchecked((int)0x80040274);
        public const int E_NoCaptureHardware = unchecked((int)0x80040275);
        public const int E_DVDOperationInhibited = unchecked((int)0x80040276);
        public const int E_DVDInvalidDomain = unchecked((int)0x80040277);
        public const int E_DVDNoButton = unchecked((int)0x80040278);
        public const int E_DVDGraphNotReady = unchecked((int)0x80040279);
        public const int E_DVDRenderFail = unchecked((int)0x8004027A);
        public const int E_DVDDecNotEnough = unchecked((int)0x8004027B);
        public const int E_DDrawVersionNotSuitable = unchecked((int)0x8004027C);
        public const int E_CopyProtFailed = unchecked((int)0x8004027D);
        public const int S_NoPreviewPin = unchecked((int)0x0004027E);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -