streams.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. //------------------------------------------------------------------------------
  2. // File: Streams.h
  3. //
  4. // Desc: DirectShow base classes - defines overall streams architecture.
  5. //
  6. // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
  7. //------------------------------------------------------------------------------
  8. #ifndef __STREAMS__
  9. #define __STREAMS__
  10. #ifdef _MSC_VER
  11. // disable some level-4 warnings, use #pragma warning(enable:###) to re-enable
  12. #pragma warning(disable:4100) // warning C4100: unreferenced formal parameter
  13. #pragma warning(disable:4201) // warning C4201: nonstandard extension used : nameless struct/union
  14. #pragma warning(disable:4511) // warning C4511: copy constructor could not be generated
  15. #pragma warning(disable:4512) // warning C4512: assignment operator could not be generated
  16. #pragma warning(disable:4514) // warning C4514: "unreferenced inline function has been removed"
  17. #if _MSC_VER>=1100
  18. #define AM_NOVTABLE __declspec(novtable)
  19. #else
  20. #define AM_NOVTABLE
  21. #endif
  22. #else
  23. #include <sal.h>
  24. #include <sal2.h>
  25. #define AM_NOVTABLE
  26. #pragma GCC diagnostic ignored "-Wwrite-strings"
  27. #endif // MSC_VER
  28. // Because of differences between Visual C++ and older Microsoft SDKs,
  29. // you may have defined _DEBUG without defining DEBUG. This logic
  30. // ensures that both will be set if Visual C++ sets _DEBUG.
  31. #ifdef _DEBUG
  32. #ifndef DEBUG
  33. #define DEBUG
  34. #endif
  35. #endif
  36. #include <windows.h>
  37. #include <windowsx.h>
  38. #include <olectl.h>
  39. #include <ddraw.h>
  40. #include <mmsystem.h>
  41. #ifndef NUMELMS
  42. #if _WIN32_WINNT < 0x0600
  43. #define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0]))
  44. #else
  45. #define NUMELMS(aa) ARRAYSIZE(aa)
  46. #endif
  47. #endif
  48. ///////////////////////////////////////////////////////////////////////////
  49. // The following definitions come from the Platform SDK and are required if
  50. // the applicaiton is being compiled with the headers from Visual C++ 6.0.
  51. /////////////////////////////////////////////////// ////////////////////////
  52. #ifndef InterlockedExchangePointer
  53. #define InterlockedExchangePointer(Target, Value) \
  54. (PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value))
  55. #endif
  56. #ifndef _WAVEFORMATEXTENSIBLE_
  57. #define _WAVEFORMATEXTENSIBLE_
  58. typedef struct {
  59. WAVEFORMATEX Format;
  60. union {
  61. WORD wValidBitsPerSample; /* bits of precision */
  62. WORD wSamplesPerBlock; /* valid if wBitsPerSample==0 */
  63. WORD wReserved; /* If neither applies, set to zero. */
  64. } Samples;
  65. DWORD dwChannelMask; /* which channels are */
  66. /* present in stream */
  67. GUID SubFormat;
  68. } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
  69. #endif // !_WAVEFORMATEXTENSIBLE_
  70. #if !defined(WAVE_FORMAT_EXTENSIBLE)
  71. #define WAVE_FORMAT_EXTENSIBLE 0xFFFE
  72. #endif // !defined(WAVE_FORMAT_EXTENSIBLE)
  73. #ifndef GetWindowLongPtr
  74. #define GetWindowLongPtrA GetWindowLongA
  75. #define GetWindowLongPtrW GetWindowLongW
  76. #ifdef UNICODE
  77. #define GetWindowLongPtr GetWindowLongPtrW
  78. #else
  79. #define GetWindowLongPtr GetWindowLongPtrA
  80. #endif // !UNICODE
  81. #endif // !GetWindowLongPtr
  82. #ifndef SetWindowLongPtr
  83. #define SetWindowLongPtrA SetWindowLongA
  84. #define SetWindowLongPtrW SetWindowLongW
  85. #ifdef UNICODE
  86. #define SetWindowLongPtr SetWindowLongPtrW
  87. #else
  88. #define SetWindowLongPtr SetWindowLongPtrA
  89. #endif // !UNICODE
  90. #endif // !SetWindowLongPtr
  91. #ifndef GWLP_WNDPROC
  92. #define GWLP_WNDPROC (-4)
  93. #endif
  94. #ifndef GWLP_HINSTANCE
  95. #define GWLP_HINSTANCE (-6)
  96. #endif
  97. #ifndef GWLP_HWNDPARENT
  98. #define GWLP_HWNDPARENT (-8)
  99. #endif
  100. #ifndef GWLP_USERDATA
  101. #define GWLP_USERDATA (-21)
  102. #endif
  103. #ifndef GWLP_ID
  104. #define GWLP_ID (-12)
  105. #endif
  106. #ifndef DWLP_MSGRESULT
  107. #define DWLP_MSGRESULT 0
  108. #endif
  109. #ifndef DWLP_DLGPROC
  110. #define DWLP_DLGPROC DWLP_MSGRESULT + sizeof(LRESULT)
  111. #endif
  112. #ifndef DWLP_USER
  113. #define DWLP_USER DWLP_DLGPROC + sizeof(DLGPROC)
  114. #endif
  115. #pragma warning(push)
  116. #pragma warning(disable: 4312 4244)
  117. // _GetWindowLongPtr
  118. // Templated version of GetWindowLongPtr, to suppress spurious compiler warning.
  119. template <class T>
  120. T _GetWindowLongPtr(HWND hwnd, int nIndex)
  121. {
  122. return (T)GetWindowLongPtr(hwnd, nIndex);
  123. }
  124. // _SetWindowLongPtr
  125. // Templated version of SetWindowLongPtr, to suppress spurious compiler warning.
  126. template <class T>
  127. LONG_PTR _SetWindowLongPtr(HWND hwnd, int nIndex, T p)
  128. {
  129. return SetWindowLongPtr(hwnd, nIndex, (LONG_PTR)p);
  130. }
  131. #pragma warning(pop)
  132. ///////////////////////////////////////////////////////////////////////////
  133. // End Platform SDK definitions
  134. ///////////////////////////////////////////////////////////////////////////
  135. #include <strmif.h> // Generated IDL header file for streams interfaces
  136. #include <intsafe.h> // required by amvideo.h
  137. #include <reftime.h> // Helper class for REFERENCE_TIME management
  138. #include <wxdebug.h> // Debug support for logging and ASSERTs
  139. #include <amvideo.h> // ActiveMovie video interfaces and definitions
  140. //include amaudio.h explicitly if you need it. it requires the DX SDK.
  141. //#include <amaudio.h> // ActiveMovie audio interfaces and definitions
  142. #include <wxutil.h> // General helper classes for threads etc
  143. #include <combase.h> // Base COM classes to support IUnknown
  144. //#include <dllsetup.h> // Filter registration support functions
  145. #include <measure.h> // Performance measurement
  146. //#include <comlite.h> // Light weight com function prototypes
  147. //#include <cache.h> // Simple cache container class
  148. #include <wxlist.h> // Non MFC generic list class
  149. #include <msgthrd.h> // CMsgThread
  150. #include <mtype.h> // Helper class for managing media types
  151. #include <fourcc.h> // conversions between FOURCCs and GUIDs
  152. #include <control.h> // generated from control.odl
  153. #include <ctlutil.h> // control interface utility classes
  154. #include <evcode.h> // event code definitions
  155. #include <amfilter.h> // Main streams architecture class hierachy
  156. //#include <transfrm.h> // Generic transform filter
  157. //#include <transip.h> // Generic transform-in-place filter
  158. #include <uuids.h> // declaration of type GUIDs and well-known clsids
  159. //#include <source.h> // Generic source filter
  160. //#include <outputq.h> // Output pin queueing
  161. #include <errors.h> // HRESULT status and error definitions
  162. #include <renbase.h> // Base class for writing ActiveX renderers
  163. //#include <winutil.h> // Helps with filters that manage windows
  164. //#include <winctrl.h> // Implements the IVideoWindow interface
  165. //#include <videoctl.h> // Specifically video related classes
  166. const LONGLONG MAX_TIME = 0x7FFFFFFFFFFFFFFF; /* Maximum LONGLONG value */
  167. //#include <refclock.h> // Base clock class
  168. //#include <sysclock.h> // System clock
  169. //#include <pstream.h> // IPersistStream helper class
  170. //#include <vtrans.h> // Video Transform Filter base class
  171. //#include <amextra.h>
  172. //#include <cprop.h> // Base property page class
  173. //#include <strmctl.h> // IAMStreamControl support
  174. //#include <edevdefs.h> // External device control interface defines
  175. //#include <audevcod.h> // audio filter device error event codes
  176. #ifndef _MSC_VER
  177. #define min(a,b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
  178. #include <amvideo2.h>
  179. #endif
  180. #else
  181. #ifdef DEBUG
  182. #pragma message("STREAMS.H included TWICE")
  183. #endif
  184. #endif // __STREAMS__