Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.4 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1992 - 1997 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. #ifndef __INFTEE__
  12. #define __INFTEE__
  13. extern const AMOVIESETUP_FILTER sudInfTee;
  14. class CTee;
  15. class CTeeOutputPin;
  16. // class for the Tee filter's Input pin
  17. class CTeeInputPin : public CBaseInputPin
  18. {
  19. friend class CTeeOutputPin;
  20. CTee *m_pTee; // Main filter object
  21. BOOL m_bInsideCheckMediaType; // Re-entrancy control
  22. public:
  23. // Constructor and destructor
  24. CTeeInputPin(TCHAR *pObjName,
  25. CTee *pTee,
  26. HRESULT *phr,
  27. LPCWSTR pPinName);
  28. #ifdef DEBUG
  29. ~CTeeInputPin();
  30. #endif
  31. // Used to check the input pin connection
  32. HRESULT CheckMediaType(const CMediaType *pmt);
  33. HRESULT SetMediaType(const CMediaType *pmt);
  34. HRESULT BreakConnect();
  35. // Reconnect outputs if necessary at end of completion
  36. virtual HRESULT CompleteConnect(IPin *pReceivePin);
  37. STDMETHODIMP NotifyAllocator(IMemAllocator *pAllocator, BOOL bReadOnly);
  38. // Pass through calls downstream
  39. STDMETHODIMP EndOfStream();
  40. STDMETHODIMP BeginFlush();
  41. STDMETHODIMP EndFlush();
  42. STDMETHODIMP NewSegment(
  43. REFERENCE_TIME tStart,
  44. REFERENCE_TIME tStop,
  45. double dRate);
  46. // Handles the next block of data from the stream
  47. STDMETHODIMP Receive(IMediaSample *pSample);
  48. };
  49. // Class for the Tee filter's Output pins.
  50. class CTeeOutputPin : public CBaseOutputPin
  51. {
  52. friend class CTeeInputPin;
  53. friend class CTee;
  54. CTee *m_pTee; // Main filter object pointer
  55. IUnknown *m_pPosition; // Pass seek calls upstream
  56. BOOL m_bHoldsSeek; // Is this the one seekable stream
  57. COutputQueue *m_pOutputQueue; // Streams data to the peer pin
  58. BOOL m_bInsideCheckMediaType; // Re-entrancy control
  59. LONG m_cOurRef; // We maintain reference counting
  60. public:
  61. // Constructor and destructor
  62. CTeeOutputPin(TCHAR *pObjName,
  63. CTee *pTee,
  64. HRESULT *phr,
  65. LPCWSTR pPinName,
  66. INT PinNumber);
  67. #ifdef DEBUG
  68. ~CTeeOutputPin();
  69. #endif
  70. // Override to expose IMediaPosition
  71. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppvoid);
  72. // Override since the life time of pins and filters are not the same
  73. STDMETHODIMP_(ULONG) NonDelegatingAddRef();
  74. STDMETHODIMP_(ULONG) NonDelegatingRelease();
  75. // Override to enumerate media types
  76. STDMETHODIMP EnumMediaTypes(IEnumMediaTypes **ppEnum);
  77. // Check that we can support an output type
  78. HRESULT CheckMediaType(const CMediaType *pmt);
  79. HRESULT SetMediaType(const CMediaType *pmt);
  80. // Negotiation to use our input pins allocator
  81. HRESULT DecideAllocator(IMemInputPin *pPin, IMemAllocator **ppAlloc);
  82. HRESULT DecideBufferSize(IMemAllocator *pMemAllocator,
  83. ALLOCATOR_PROPERTIES * ppropInputRequest);
  84. // Used to create output queue objects
  85. HRESULT Active();
  86. HRESULT Inactive();
  87. // Overriden to create and destroy output pins
  88. HRESULT CompleteConnect(IPin *pReceivePin);
  89. // Overriden to pass data to the output queues
  90. HRESULT Deliver(IMediaSample *pMediaSample);
  91. HRESULT DeliverEndOfStream();
  92. HRESULT DeliverBeginFlush();
  93. HRESULT DeliverEndFlush();
  94. HRESULT DeliverNewSegment(
  95. REFERENCE_TIME tStart,
  96. REFERENCE_TIME tStop,
  97. double dRate);
  98. // Overriden to handle quality messages
  99. STDMETHODIMP Notify(IBaseFilter *pSender, Quality q);
  100. };
  101. // Class for the Tee filter
  102. class CTee: public CCritSec, public CBaseFilter
  103. {
  104. // Let the pins access our internal state
  105. friend class CTeeInputPin;
  106. friend class CTeeOutputPin;
  107. typedef CGenericList <CTeeOutputPin> COutputList;
  108. // Declare an input pin.
  109. CTeeInputPin m_Input;
  110. INT m_NumOutputPins; // Current output pin count
  111. COutputList m_OutputPinsList; // List of the output pins
  112. INT m_NextOutputPinNumber; // Increases monotonically.
  113. LONG m_lCanSeek; // Seekable output pin
  114. IMemAllocator *m_pAllocator; // Allocator from our input pin
  115. public:
  116. CTee(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *hr);
  117. ~CTee();
  118. CBasePin *GetPin(int n);
  119. int GetPinCount();
  120. // Function needed for the class factory
  121. static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
  122. // Send EndOfStream if no input connection
  123. STDMETHODIMP Run(REFERENCE_TIME tStart);
  124. STDMETHODIMP Pause();
  125. STDMETHODIMP Stop();
  126. protected:
  127. // The following manage the list of output pins
  128. void InitOutputPinsList();
  129. CTeeOutputPin *GetPinNFromList(int n);
  130. CTeeOutputPin *CreateNextOutputPin(CTee *pTee);
  131. void DeleteOutputPin(CTeeOutputPin *pPin);
  132. int GetNumFreePins();
  133. };
  134. #endif // __INFTEE__