content/media/directshow/AudioSinkFilter.h

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

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

mercurial