?? vmrender.cs
字號:
#region license
/*
DirectShowLib - Provide access to DirectShow interfaces via .NET
Copyright (C) 2006
http://sourceforge.net/projects/directshownet/
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#endregion
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace DirectShowLib
{
#region Declarations
#if ALLOW_UNTESTED_INTERFACES
/// <summary>
/// From VMRPresentationFlags
/// </summary>
[Flags]
public enum VMRPresentationFlags
{
None = 0,
SyncPoint = 0x00000001,
Preroll = 0x00000002,
Discontinuity = 0x00000004,
TimeValid = 0x00000008,
SrcDstRectsValid = 0x00000010
}
/// <summary>
/// From VMRSurfaceAllocationFlags
/// </summary>
[Flags]
public enum VMRSurfaceAllocationFlags
{
None = 0,
PixelFormatValid = 0x01,
ThreeDTarget = 0x02,
AllowSysMem = 0x04,
ForceSysMem = 0x08,
DirectedFlip = 0x10,
DXVATarget = 0x20
}
/// <summary>
/// From VMRPRESENTATIONINFO
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VMRPresentationInfo
{
public VMRPresentationFlags dwFlags;
public IntPtr lpSurf; //LPDIRECTDRAWSURFACE7
public long rtStart;
public long rtEnd;
public Size szAspectRatio;
public DsRect rcSrc;
public DsRect rcDst;
public int dwTypeSpecificFlags;
public int dwInterlaceFlags;
}
/// <summary>
/// From VMRALLOCATIONINFO
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VMRAllocationInfo
{
public VMRSurfaceAllocationFlags dwFlags;
// public BitmapInfoHeader lpHdr;
// public DDPixelFormat lpPixFmt;
public IntPtr lpHdr;
public IntPtr lpPixFmt;
public Size szAspectRatio;
public int dwMinBuffers;
public int dwMaxBuffers;
public int dwInterlaceFlags;
public Size szNativeSize;
}
#endif
/// <summary>
/// From VMRDeinterlaceTech
/// </summary>
[Flags]
public enum VMRDeinterlaceTech
{
Unknown = 0x0000,
BOBLineReplicate = 0x0001,
BOBVerticalStretch = 0x0002,
MedianFiltering = 0x0004,
EdgeFiltering = 0x0010,
FieldAdaptive = 0x0020,
PixelAdaptive = 0x0040,
MotionVectorSteered = 0x0080
}
/// <summary>
/// From VMRBITMAP_* defines
/// </summary>
[Flags]
public enum VMRBitmap
{
None = 0,
Disable = 0x00000001,
Hdc = 0x00000002,
EntireDDS = 0x00000004,
SRCColorKey = 0x00000008,
SRCRect = 0x00000010
}
/// <summary>
/// From VMRDeinterlacePrefs
/// </summary>
[Flags]
public enum VMRDeinterlacePrefs
{
None = 0,
NextBest = 0x01,
BOB = 0x02,
Weave = 0x04,
Mask = 0x07
}
/// <summary>
/// From VMRMixerPrefs
/// </summary>
[Flags]
public enum VMRMixerPrefs
{
None = 0,
NoDecimation = 0x00000001,
DecimateOutput = 0x00000002,
ARAdjustXorY = 0x00000004,
DecimationReserved = 0x00000008,
DecimateMask = 0x0000000F,
BiLinearFiltering = 0x00000010,
PointFiltering = 0x00000020,
FilteringMask = 0x000000F0,
RenderTargetRGB = 0x00000100,
RenderTargetYUV = 0x00001000,
RenderTargetYUV420 = 0x00000200,
RenderTargetYUV422 = 0x00000400,
RenderTargetYUV444 = 0x00000800,
RenderTargetReserved = 0x0000E000,
RenderTargetMask = 0x0000FF00,
DynamicSwitchToBOB = 0x00010000,
DynamicDecimateBy2 = 0x00020000,
DynamicReserved = 0x000C0000,
DynamicMask = 0x000F0000
}
/// <summary>
/// From VMRRenderPrefs
/// </summary>
[Flags]
public enum VMRRenderPrefs
{
RestrictToInitialMonitor = 0x00000000,
ForceOffscreen = 0x00000001,
ForceOverlays = 0x00000002,
AllowOverlays = 0x00000000,
AllowOffscreen = 0x00000000,
DoNotRenderColorKeyAndBorder = 0x00000008,
Reserved = 0x00000010,
PreferAGPMemWhenMixing = 0x00000020,
Mask = 0x0000003f,
}
/// <summary>
/// From VMRMode
/// </summary>
[Flags]
public enum VMRMode
{
None = 0,
Windowed = 0x00000001,
Windowless = 0x00000002,
Renderless = 0x00000004,
}
/// <summary>
/// From VMR_ASPECT_RATIO_MODE
/// </summary>
public enum VMRAspectRatioMode
{
None,
LetterBox
}
/// <summary>
/// From VMRALPHABITMAP
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VMRAlphaBitmap
{
public VMRBitmap dwFlags;
public IntPtr hdc; // HDC
public IntPtr pDDS; //LPDIRECTDRAWSURFACE7
public DsRect rSrc;
public NormalizedRect rDest;
public float fAlpha;
public int clrSrcKey;
}
/// <summary>
/// From VMRDeinterlaceCaps
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VMRDeinterlaceCaps
{
public int dwSize;
public int dwNumPreviousOutputFrames;
public int dwNumForwardRefSamples;
public int dwNumBackwardRefSamples;
public VMRDeinterlaceTech DeinterlaceTechnology;
}
/// <summary>
/// From VMRFrequency
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VMRFrequency
{
public int dwNumerator;
public int dwDenominator;
}
/// <summary>
/// From VMRVideoDesc
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack=1)]
public struct VMRVideoDesc
{
public int dwSize;
public int dwSampleWidth;
public int dwSampleHeight;
[MarshalAs(UnmanagedType.Bool)] public bool SingleFieldPerSample;
public int dwFourCC;
public VMRFrequency InputSampleFreq;
public VMRFrequency OutputFrameFreq;
}
/// <summary>
/// From VMRVIDEOSTREAMINFO
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VMRVideoStreamInfo
{
public IntPtr pddsVideoSurface;
public int dwWidth;
public int dwHeight;
public int dwStrmID;
public float fAlpha;
public DDColorKey ddClrKey;
public NormalizedRect rNormal;
}
/// <summary>
/// From DDCOLORKEY
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct DDColorKey
{
public int dw1;
public int dw2;
}
/// <summary>
/// From VMRMONITORINFO
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
public struct VMRMonitorInfo
{
public VMRGuid guid;
public DsRect rcMonitor;
public IntPtr hMon; // HMONITOR
public int dwFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=32)] public string szDevice;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)] public string szDescription;
public long liDriverVersion;
public int dwVendorId;
public int dwDeviceId;
public int dwSubSysId;
public int dwRevision;
}
/// <summary>
/// From VMRGUID
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct VMRGuid
{
public IntPtr pGUID; // GUID *
public Guid GUID;
}
#endregion
#region Interfaces
#if ALLOW_UNTESTED_INTERFACES
[ComImport,
Guid("CE704FE7-E71E-41fb-BAA2-C4403E1182F5"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVMRImagePresenter
{
[PreserveSig]
int StartPresenting([In] IntPtr dwUserID);
[PreserveSig]
int StopPresenting([In] IntPtr dwUserID);
[PreserveSig]
int PresentImage(
[In] IntPtr dwUserID,
[In] ref VMRPresentationInfo lpPresInfo
);
}
[ComImport,
Guid("31ce832e-4484-458b-8cca-f4d7e3db0b52"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVMRSurfaceAllocator
{
[PreserveSig]
int AllocateSurface(
[In] IntPtr dwUserID,
[In] ref VMRAllocationInfo lpAllocInfo,
[Out] out int lpdwActualBuffers,
[In, Out] ref IntPtr lplpSurface // LPDIRECTDRAWSURFACE7
);
[PreserveSig]
int FreeSurface([In] IntPtr dwID);
[PreserveSig]
int PrepareSurface(
[In] IntPtr dwUserID,
[In] IntPtr lplpSurface, // LPDIRECTDRAWSURFACE7
[In] int dwSurfaceFlags
);
[PreserveSig]
int AdviseNotify([In] IVMRSurfaceAllocatorNotify lpIVMRSurfAllocNotify);
}
[ComImport,
Guid("aada05a8-5a4e-4729-af0b-cea27aed51e2"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVMRSurfaceAllocatorNotify
{
[PreserveSig]
int AdviseSurfaceAllocator(
[In] IntPtr dwUserID,
[In] IVMRSurfaceAllocator lpIVRMSurfaceAllocator
);
[PreserveSig]
int SetDDrawDevice(
[In] IntPtr lpDDrawDevice, // LPDIRECTDRAW7
[In] IntPtr hMonitor // HMONITOR
);
[PreserveSig]
int ChangeDDrawDevice(
[In] IntPtr lpDDrawDevice, // LPDIRECTDRAW7
[In] IntPtr hMonitor // HMONITOR
);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -