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.

228 lines
6.2 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) Microsoft Corporation, 1992 - 1997 All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11. #ifndef __TVAUDIO__
  12. #define __TVAUDIO__
  13. #define MODE_MONO_STEREO_MASK (KS_TVAUDIO_MODE_MONO | KS_TVAUDIO_MODE_STEREO)
  14. #define MODE_LANGUAGE_MASK (KS_TVAUDIO_MODE_LANG_A | KS_TVAUDIO_MODE_LANG_B | KS_TVAUDIO_MODE_LANG_C )
  15. class TVAudio;
  16. class TVAudioOutputPin;
  17. class TVAudioInputPin;
  18. // class for the TVAudio filter's Input pin
  19. class TVAudioInputPin
  20. : public CBaseInputPin
  21. , public CKsSupport
  22. {
  23. protected:
  24. TVAudio *m_pTVAudio; // Main filter object
  25. KSPIN_MEDIUM m_Medium;
  26. public:
  27. // Constructor and destructor
  28. TVAudioInputPin(TCHAR *pObjName,
  29. TVAudio *pTVAudio,
  30. HRESULT *phr,
  31. LPCWSTR pPinName);
  32. ~TVAudioInputPin();
  33. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
  34. // Used to check the input pin connection
  35. HRESULT CheckConnect (IPin *pReceivePin);
  36. HRESULT CheckMediaType(const CMediaType *pmt);
  37. HRESULT SetMediaType(const CMediaType *pmt);
  38. HRESULT BreakConnect();
  39. // Reconnect outputs if necessary at end of completion
  40. virtual HRESULT CompleteConnect(IPin *pReceivePin);
  41. // Handles the next block of data from the stream
  42. STDMETHODIMP Receive(IMediaSample *pSample);
  43. void SetPinMedium (const KSPIN_MEDIUM *Medium)
  44. {
  45. if (Medium == NULL) {
  46. m_Medium.Set = GUID_NULL;
  47. m_Medium.Id = 0;
  48. m_Medium.Flags = 0;
  49. }
  50. else {
  51. m_Medium = *Medium;
  52. }
  53. SetKsMedium (&m_Medium);
  54. };
  55. };
  56. // Class for the TVAudio filter's Output pins.
  57. class TVAudioOutputPin
  58. : public CBaseOutputPin
  59. , public CKsSupport
  60. {
  61. friend class TVAudioInputPin;
  62. friend class TVAudio;
  63. protected:
  64. TVAudio *m_pTVAudio; // Main filter object pointer
  65. KSPIN_MEDIUM m_Medium;
  66. public:
  67. // Constructor and destructor
  68. TVAudioOutputPin(TCHAR *pObjName,
  69. TVAudio *pTVAudio,
  70. HRESULT *phr,
  71. LPCWSTR pPinName);
  72. ~TVAudioOutputPin();
  73. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
  74. HRESULT DecideBufferSize(IMemAllocator * pAlloc,ALLOCATOR_PROPERTIES * ppropInputRequest);
  75. // Override to enumerate media types
  76. STDMETHODIMP EnumMediaTypes(IEnumMediaTypes **ppEnum);
  77. HRESULT GetMediaType(int iPosition,CMediaType *pMediaType);
  78. // Check that we can support an output type
  79. HRESULT CheckMediaType(const CMediaType *pmt);
  80. HRESULT SetMediaType(const CMediaType *pmt);
  81. // Overriden to create and destroy output pins
  82. HRESULT CheckConnect (IPin *pReceivePin);
  83. HRESULT CompleteConnect(IPin *pReceivePin);
  84. void SetPinMedium (const KSPIN_MEDIUM *Medium)
  85. {
  86. if (Medium == NULL) {
  87. m_Medium.Set = GUID_NULL;
  88. m_Medium.Id = 0;
  89. m_Medium.Flags = 0;
  90. }
  91. else {
  92. m_Medium = *Medium;
  93. }
  94. SetKsMedium (&m_Medium);
  95. };
  96. };
  97. // Class for the TVAudio filter
  98. class TVAudio:
  99. public CCritSec,
  100. public IAMTVAudio,
  101. public CBaseFilter,
  102. public CPersistStream,
  103. public IPersistPropertyBag,
  104. public ISpecifyPropertyPages
  105. {
  106. public:
  107. DECLARE_IUNKNOWN;
  108. // Basic COM - used here to reveal our property interface.
  109. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
  110. // Function needed for the class factory
  111. static CUnknown * WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
  112. //
  113. // --- IAMTVAudio ---
  114. //
  115. STDMETHODIMP GetHardwareSupportedTVAudioModes(
  116. /* [out] */ long __RPC_FAR *plModes);
  117. STDMETHODIMP GetAvailableTVAudioModes(
  118. /* [out] */ long __RPC_FAR *plModes);
  119. STDMETHODIMP get_TVAudioMode(
  120. /* [out] */ long __RPC_FAR *plMode);
  121. STDMETHODIMP put_TVAudioMode(
  122. /* [in] */ long lMode);
  123. STDMETHODIMP RegisterNotificationCallBack(
  124. /* [in] */ IAMTunerNotification __RPC_FAR *pNotify,
  125. /* [in] */ long lEvents);
  126. STDMETHODIMP UnRegisterNotificationCallBack(
  127. IAMTunerNotification __RPC_FAR *pNotify);
  128. // --- IPersistPropertyBag ---
  129. STDMETHODIMP InitNew(void) ;
  130. STDMETHODIMP Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErrorLog) ;
  131. STDMETHODIMP Save(LPPROPERTYBAG pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties) ;
  132. STDMETHODIMP GetClassID(CLSID *pClsId) ;
  133. //
  134. // --- CPersistStream ---
  135. //
  136. HRESULT WriteToStream(IStream *pStream);
  137. HRESULT ReadFromStream(IStream *pStream);
  138. DWORD GetSoftwareVersion(void);
  139. int SizeMax();
  140. //
  141. // --- ISpecifyPropertyPages ---
  142. //
  143. STDMETHODIMP GetPages(CAUUID *pPages);
  144. private:
  145. // Let the pins access our internal state
  146. friend class TVAudioInputPin;
  147. friend class TVAudioOutputPin;
  148. TVAudioInputPin *m_pTVAudioInputPin;
  149. TVAudioOutputPin *m_pTVAudioOutputPin;
  150. KSPROPERTY_TVAUDIO_CAPS_S m_Caps;
  151. KSPROPERTY_TVAUDIO_S m_Mode;
  152. // KS Stuff.
  153. HANDLE m_hDevice;
  154. TCHAR *m_pDeviceName;
  155. int CreateDevice(void);
  156. BOOL CreatePins ();
  157. TVAudio(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *hr);
  158. ~TVAudio();
  159. CBasePin *GetPin(int n);
  160. int GetPinCount(void);
  161. int GetDevicePinCount(void);
  162. // persist stream saved from IPersistPropertyBag::Load
  163. IPersistStream *m_pPersistStreamDevice;
  164. };
  165. #endif // __TVAUDIO__