michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #if !defined(AudioSinkFilter_h_) michael@0: #define AudioSinkFilter_h_ michael@0: michael@0: #include "BaseFilter.h" michael@0: #include "DirectShowUtils.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "mozilla/RefPtr.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: class AudioSinkInputPin; michael@0: class SampleSink; michael@0: michael@0: // Filter that acts as the end of the graph. Audio samples input into michael@0: // this filter block the calling thread, and the calling thread is michael@0: // unblocked when the decode thread extracts the sample. The samples michael@0: // input into this filter are stored in the SampleSink, where the blocking michael@0: // is implemented. The input pin owns the SampleSink. michael@0: class AudioSinkFilter: public mozilla::media::BaseFilter, michael@0: public IMediaSeeking michael@0: { michael@0: michael@0: public: michael@0: AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult); michael@0: virtual ~AudioSinkFilter(); michael@0: michael@0: // Gets the input pin's sample sink. michael@0: SampleSink* GetSampleSink(); michael@0: michael@0: // IUnknown implementation. michael@0: STDMETHODIMP QueryInterface(REFIID aIId, void **aInterface); michael@0: STDMETHODIMP_(ULONG) AddRef(); michael@0: STDMETHODIMP_(ULONG) Release(); michael@0: michael@0: // -------------------------------------------------------------------- michael@0: // CBaseFilter methods michael@0: int GetPinCount (); michael@0: mozilla::media::BasePin* GetPin ( IN int Index); michael@0: STDMETHODIMP Pause (); michael@0: STDMETHODIMP Stop (); michael@0: STDMETHODIMP GetClassID ( OUT CLSID * pCLSID); michael@0: STDMETHODIMP Run(REFERENCE_TIME tStart); michael@0: // IMediaSeeking Methods... michael@0: michael@0: // We defer to SourceFilter, but we must expose the interface on michael@0: // the output pins. Seeking commands come upstream from the renderers, michael@0: // but they must be actioned at the source filters. michael@0: STDMETHODIMP GetCapabilities(DWORD* aCapabilities); michael@0: STDMETHODIMP CheckCapabilities(DWORD* aCapabilities); michael@0: STDMETHODIMP IsFormatSupported(const GUID* aFormat); michael@0: STDMETHODIMP QueryPreferredFormat(GUID* aFormat); michael@0: STDMETHODIMP GetTimeFormat(GUID* aFormat); michael@0: STDMETHODIMP IsUsingTimeFormat(const GUID* aFormat); michael@0: STDMETHODIMP SetTimeFormat(const GUID* aFormat); michael@0: STDMETHODIMP GetDuration(LONGLONG* pDuration); michael@0: STDMETHODIMP GetStopPosition(LONGLONG* pStop); michael@0: STDMETHODIMP GetCurrentPosition(LONGLONG* aCurrent); michael@0: STDMETHODIMP ConvertTimeFormat(LONGLONG* aTarget, michael@0: const GUID* aTargetFormat, michael@0: LONGLONG aSource, michael@0: const GUID* aSourceFormat); michael@0: STDMETHODIMP SetPositions(LONGLONG* aCurrent, michael@0: DWORD aCurrentFlags, michael@0: LONGLONG* aStop, michael@0: DWORD aStopFlags); michael@0: STDMETHODIMP GetPositions(LONGLONG* aCurrent, michael@0: LONGLONG* aStop); michael@0: STDMETHODIMP GetAvailable(LONGLONG* aEarliest, michael@0: LONGLONG* aLatest); michael@0: STDMETHODIMP SetRate(double aRate); michael@0: STDMETHODIMP GetRate(double* aRate); michael@0: STDMETHODIMP GetPreroll(LONGLONG* aPreroll); michael@0: michael@0: // -------------------------------------------------------------------- michael@0: // class factory calls this michael@0: static IUnknown * CreateInstance (IN LPUNKNOWN punk, OUT HRESULT * phr); michael@0: michael@0: private: michael@0: CriticalSection mFilterCritSec; michael@0: michael@0: // Note: The input pin defers its refcounting to the sink filter, so when michael@0: // the input pin is addrefed, what actually happens is the sink filter is michael@0: // addrefed. michael@0: nsAutoPtr mInputPin; michael@0: }; michael@0: michael@0: } // namespace mozilla michael@0: #endif // AudioSinkFilter_h_