DsVmRender.cs
Upload User: wuming6209
Upload Date: 2013-06-06
Package Size: 161k
Code Size: 4k
Category:

Video Capture

Development Platform:

Visual C++

  1. /******************************************************
  2.                   DirectShow .NET
  3.          brian.low@shaw.ca
  4. *******************************************************/
  5. // DsVmRender
  6. // Video Mixer Renderer, ported from VmRender.idl
  7. using System;
  8. using System.Runtime.InteropServices;
  9. namespace DShowNET
  10. {
  11. [ComVisible(false)]
  12. public enum VMRMode : uint
  13. {
  14. Windowed                         = 0x00000001,
  15. Windowless                       = 0x00000002,
  16. Renderless                       = 0x00000004,
  17. }
  18. [StructLayout(LayoutKind.Sequential), ComVisible(false)]
  19. public struct RECT
  20. {
  21. int left;
  22. int top;
  23. int right;
  24. int bottom;
  25. }
  26. [ComVisible(true), ComImport,
  27. Guid("0eb1088c-4dcd-46f0-878f-39dae86a51b7"),
  28. InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
  29. public interface IVMRWindowlessControl
  30. {
  31. //
  32. //////////////////////////////////////////////////////////
  33. // Video size and position information
  34. //////////////////////////////////////////////////////////
  35. //
  36. int GetNativeVideoSize(
  37. [Out] out int lpWidth,
  38. [Out] out int lpHeight,
  39. [Out] out int lpARWidth,
  40. [Out] out int lpARHeight
  41. );
  42. int GetMinIdealVideoSize(
  43. [Out] out int lpHeight
  44. );
  45. int GetMaxIdealVideoSize(
  46. [Out] out int lpWidth,
  47. [Out] out int lpHeight
  48. );
  49. int SetVideoPosition(
  50. [In, MarshalAs(UnmanagedType.LPStruct)] RECT lpSRCRect,
  51. [In, MarshalAs(UnmanagedType.LPStruct)] RECT lpDSTRect
  52. );
  53. int GetVideoPosition(
  54. [Out, MarshalAs(UnmanagedType.LPStruct)] out RECT lpSRCRect,
  55. [Out, MarshalAs(UnmanagedType.LPStruct)] out RECT lpDSTRect
  56. );
  57. int GetAspectRatioMode( [Out] out uint lpAspectRatioMode );
  58. int SetAspectRatioMode( [In] uint AspectRatioMode );
  59. //
  60. //////////////////////////////////////////////////////////
  61. // Display and clipping management
  62. //////////////////////////////////////////////////////////
  63. //
  64. int SetVideoClippingWindow( [In] IntPtr hwnd );
  65. int RepaintVideo(
  66. [In] IntPtr hwnd,
  67. [In] IntPtr hdc
  68. );
  69. int DisplayModeChanged();
  70. //
  71. //////////////////////////////////////////////////////////
  72. // GetCurrentImage
  73. //
  74. // Returns the current image being displayed.  This images
  75. // is returned in the form of packed Windows DIB.
  76. //
  77. // GetCurrentImage can be called at any time, also
  78. // the caller is responsible for free the returned memory
  79. // by calling CoTaskMemFree.
  80. //
  81. // Excessive use of this function will degrade video
  82. // playback performed.
  83. //////////////////////////////////////////////////////////
  84. //
  85. int GetCurrentImage( [Out] out IntPtr lpDib );
  86. //
  87. //////////////////////////////////////////////////////////
  88. // Border Color control
  89. //
  90. // The border color is color used to fill any area of the
  91. // the destination rectangle that does not contain video.
  92. // It is typically used in two instances.  When the video
  93. // straddles two monitors and when the VMR is trying
  94. // to maintain the aspect ratio of the movies by letter
  95. // boxing the video to fit within the specified destination
  96. // rectangle. See SetAspectRatioMode above.
  97. //////////////////////////////////////////////////////////
  98. //
  99. int SetBorderColor( [In] uint Clr );
  100. int GetBorderColor( [Out] out uint lpClr );
  101. //
  102. //////////////////////////////////////////////////////////
  103. // Color key control only meaningful when the VMR is using
  104. // and overlay
  105. //////////////////////////////////////////////////////////
  106. //
  107. int SetColorKey( [In] uint Clr );
  108. int GetColorKey( [Out] out uint lpClr );
  109. }
  110. [ComVisible(true), ComImport,
  111. Guid("9e5530c5-7034-48b4-bb46-0b8a6efc8e36"),
  112. InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
  113. public interface IVMRFilterConfig
  114. {
  115. [PreserveSig]
  116. int SetImageCompositor( [In] IntPtr lpVMRImgCompositor );
  117. [PreserveSig]
  118. int SetNumberOfStreams( [In] uint dwMaxStreams );
  119. [PreserveSig]
  120. int GetNumberOfStreams( [Out] out uint pdwMaxStreams );
  121. [PreserveSig]
  122. int SetRenderingPrefs( [In] uint dwRenderFlags );
  123. [PreserveSig]
  124. int GetRenderingPrefs( [Out] out uint pdwRenderFlags );
  125. [PreserveSig]
  126. int SetRenderingMode( [In] uint Mode );
  127. [PreserveSig]
  128. int GetRenderingMode( [Out] out VMRMode Mode );
  129. }
  130. }