Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #if !defined(AudioSinkFilter_h_) |
michael@0 | 8 | #define AudioSinkFilter_h_ |
michael@0 | 9 | |
michael@0 | 10 | #include "BaseFilter.h" |
michael@0 | 11 | #include "DirectShowUtils.h" |
michael@0 | 12 | #include "nsAutoPtr.h" |
michael@0 | 13 | #include "mozilla/RefPtr.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | |
michael@0 | 17 | class AudioSinkInputPin; |
michael@0 | 18 | class SampleSink; |
michael@0 | 19 | |
michael@0 | 20 | // Filter that acts as the end of the graph. Audio samples input into |
michael@0 | 21 | // this filter block the calling thread, and the calling thread is |
michael@0 | 22 | // unblocked when the decode thread extracts the sample. The samples |
michael@0 | 23 | // input into this filter are stored in the SampleSink, where the blocking |
michael@0 | 24 | // is implemented. The input pin owns the SampleSink. |
michael@0 | 25 | class AudioSinkFilter: public mozilla::media::BaseFilter, |
michael@0 | 26 | public IMediaSeeking |
michael@0 | 27 | { |
michael@0 | 28 | |
michael@0 | 29 | public: |
michael@0 | 30 | AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult); |
michael@0 | 31 | virtual ~AudioSinkFilter(); |
michael@0 | 32 | |
michael@0 | 33 | // Gets the input pin's sample sink. |
michael@0 | 34 | SampleSink* GetSampleSink(); |
michael@0 | 35 | |
michael@0 | 36 | // IUnknown implementation. |
michael@0 | 37 | STDMETHODIMP QueryInterface(REFIID aIId, void **aInterface); |
michael@0 | 38 | STDMETHODIMP_(ULONG) AddRef(); |
michael@0 | 39 | STDMETHODIMP_(ULONG) Release(); |
michael@0 | 40 | |
michael@0 | 41 | // -------------------------------------------------------------------- |
michael@0 | 42 | // CBaseFilter methods |
michael@0 | 43 | int GetPinCount (); |
michael@0 | 44 | mozilla::media::BasePin* GetPin ( IN int Index); |
michael@0 | 45 | STDMETHODIMP Pause (); |
michael@0 | 46 | STDMETHODIMP Stop (); |
michael@0 | 47 | STDMETHODIMP GetClassID ( OUT CLSID * pCLSID); |
michael@0 | 48 | STDMETHODIMP Run(REFERENCE_TIME tStart); |
michael@0 | 49 | // IMediaSeeking Methods... |
michael@0 | 50 | |
michael@0 | 51 | // We defer to SourceFilter, but we must expose the interface on |
michael@0 | 52 | // the output pins. Seeking commands come upstream from the renderers, |
michael@0 | 53 | // but they must be actioned at the source filters. |
michael@0 | 54 | STDMETHODIMP GetCapabilities(DWORD* aCapabilities); |
michael@0 | 55 | STDMETHODIMP CheckCapabilities(DWORD* aCapabilities); |
michael@0 | 56 | STDMETHODIMP IsFormatSupported(const GUID* aFormat); |
michael@0 | 57 | STDMETHODIMP QueryPreferredFormat(GUID* aFormat); |
michael@0 | 58 | STDMETHODIMP GetTimeFormat(GUID* aFormat); |
michael@0 | 59 | STDMETHODIMP IsUsingTimeFormat(const GUID* aFormat); |
michael@0 | 60 | STDMETHODIMP SetTimeFormat(const GUID* aFormat); |
michael@0 | 61 | STDMETHODIMP GetDuration(LONGLONG* pDuration); |
michael@0 | 62 | STDMETHODIMP GetStopPosition(LONGLONG* pStop); |
michael@0 | 63 | STDMETHODIMP GetCurrentPosition(LONGLONG* aCurrent); |
michael@0 | 64 | STDMETHODIMP ConvertTimeFormat(LONGLONG* aTarget, |
michael@0 | 65 | const GUID* aTargetFormat, |
michael@0 | 66 | LONGLONG aSource, |
michael@0 | 67 | const GUID* aSourceFormat); |
michael@0 | 68 | STDMETHODIMP SetPositions(LONGLONG* aCurrent, |
michael@0 | 69 | DWORD aCurrentFlags, |
michael@0 | 70 | LONGLONG* aStop, |
michael@0 | 71 | DWORD aStopFlags); |
michael@0 | 72 | STDMETHODIMP GetPositions(LONGLONG* aCurrent, |
michael@0 | 73 | LONGLONG* aStop); |
michael@0 | 74 | STDMETHODIMP GetAvailable(LONGLONG* aEarliest, |
michael@0 | 75 | LONGLONG* aLatest); |
michael@0 | 76 | STDMETHODIMP SetRate(double aRate); |
michael@0 | 77 | STDMETHODIMP GetRate(double* aRate); |
michael@0 | 78 | STDMETHODIMP GetPreroll(LONGLONG* aPreroll); |
michael@0 | 79 | |
michael@0 | 80 | // -------------------------------------------------------------------- |
michael@0 | 81 | // class factory calls this |
michael@0 | 82 | static IUnknown * CreateInstance (IN LPUNKNOWN punk, OUT HRESULT * phr); |
michael@0 | 83 | |
michael@0 | 84 | private: |
michael@0 | 85 | CriticalSection mFilterCritSec; |
michael@0 | 86 | |
michael@0 | 87 | // Note: The input pin defers its refcounting to the sink filter, so when |
michael@0 | 88 | // the input pin is addrefed, what actually happens is the sink filter is |
michael@0 | 89 | // addrefed. |
michael@0 | 90 | nsAutoPtr<AudioSinkInputPin> mInputPin; |
michael@0 | 91 | }; |
michael@0 | 92 | |
michael@0 | 93 | } // namespace mozilla |
michael@0 | 94 | #endif // AudioSinkFilter_h_ |