content/media/directshow/AudioSinkFilter.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/directshow/AudioSinkFilter.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,94 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#if !defined(AudioSinkFilter_h_)
    1.11 +#define AudioSinkFilter_h_
    1.12 +
    1.13 +#include "BaseFilter.h"
    1.14 +#include "DirectShowUtils.h"
    1.15 +#include "nsAutoPtr.h"
    1.16 +#include "mozilla/RefPtr.h"
    1.17 +
    1.18 +namespace mozilla {
    1.19 +
    1.20 +class AudioSinkInputPin;
    1.21 +class SampleSink;
    1.22 +
    1.23 +// Filter that acts as the end of the graph. Audio samples input into
    1.24 +// this filter block the calling thread, and the calling thread is
    1.25 +// unblocked when the decode thread extracts the sample. The samples
    1.26 +// input into this filter are stored in the SampleSink, where the blocking
    1.27 +// is implemented. The input pin owns the SampleSink.
    1.28 +class AudioSinkFilter: public mozilla::media::BaseFilter,
    1.29 +                       public IMediaSeeking
    1.30 +{
    1.31 +
    1.32 +public:
    1.33 +  AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult);
    1.34 +  virtual ~AudioSinkFilter();
    1.35 +
    1.36 +  // Gets the input pin's sample sink.
    1.37 +  SampleSink* GetSampleSink();
    1.38 +
    1.39 +  // IUnknown implementation.
    1.40 +  STDMETHODIMP QueryInterface(REFIID aIId, void **aInterface);
    1.41 +  STDMETHODIMP_(ULONG) AddRef();
    1.42 +  STDMETHODIMP_(ULONG) Release();
    1.43 +
    1.44 +  //  --------------------------------------------------------------------
    1.45 +  //  CBaseFilter methods
    1.46 +  int GetPinCount ();
    1.47 +  mozilla::media::BasePin* GetPin ( IN int Index);
    1.48 +  STDMETHODIMP Pause ();
    1.49 +  STDMETHODIMP Stop ();
    1.50 +  STDMETHODIMP GetClassID ( OUT CLSID * pCLSID);
    1.51 +  STDMETHODIMP Run(REFERENCE_TIME tStart);
    1.52 +  // IMediaSeeking Methods...
    1.53 +
    1.54 +  // We defer to SourceFilter, but we must expose the interface on
    1.55 +  // the output pins. Seeking commands come upstream from the renderers,
    1.56 +  // but they must be actioned at the source filters.
    1.57 +  STDMETHODIMP GetCapabilities(DWORD* aCapabilities);
    1.58 +  STDMETHODIMP CheckCapabilities(DWORD* aCapabilities);
    1.59 +  STDMETHODIMP IsFormatSupported(const GUID* aFormat);
    1.60 +  STDMETHODIMP QueryPreferredFormat(GUID* aFormat);
    1.61 +  STDMETHODIMP GetTimeFormat(GUID* aFormat);
    1.62 +  STDMETHODIMP IsUsingTimeFormat(const GUID* aFormat);
    1.63 +  STDMETHODIMP SetTimeFormat(const GUID* aFormat);
    1.64 +  STDMETHODIMP GetDuration(LONGLONG* pDuration);
    1.65 +  STDMETHODIMP GetStopPosition(LONGLONG* pStop);
    1.66 +  STDMETHODIMP GetCurrentPosition(LONGLONG* aCurrent);
    1.67 +  STDMETHODIMP ConvertTimeFormat(LONGLONG* aTarget,
    1.68 +                                 const GUID* aTargetFormat,
    1.69 +                                 LONGLONG aSource,
    1.70 +                                 const GUID* aSourceFormat);
    1.71 +  STDMETHODIMP SetPositions(LONGLONG* aCurrent,
    1.72 +                            DWORD aCurrentFlags,
    1.73 +                            LONGLONG* aStop,
    1.74 +                            DWORD aStopFlags);
    1.75 +  STDMETHODIMP GetPositions(LONGLONG* aCurrent,
    1.76 +                            LONGLONG* aStop);
    1.77 +  STDMETHODIMP GetAvailable(LONGLONG* aEarliest,
    1.78 +                            LONGLONG* aLatest);
    1.79 +  STDMETHODIMP SetRate(double aRate);
    1.80 +  STDMETHODIMP GetRate(double* aRate);
    1.81 +  STDMETHODIMP GetPreroll(LONGLONG* aPreroll);
    1.82 +
    1.83 +  //  --------------------------------------------------------------------
    1.84 +  //  class factory calls this
    1.85 +  static IUnknown * CreateInstance (IN LPUNKNOWN punk, OUT HRESULT * phr);
    1.86 +
    1.87 +private:
    1.88 +  CriticalSection mFilterCritSec;
    1.89 +
    1.90 +  // Note: The input pin defers its refcounting to the sink filter, so when
    1.91 +  // the input pin is addrefed, what actually happens is the sink filter is
    1.92 +  // addrefed.
    1.93 +  nsAutoPtr<AudioSinkInputPin> mInputPin;
    1.94 +};
    1.95 +
    1.96 +} // namespace mozilla
    1.97 +#endif // AudioSinkFilter_h_

mercurial