content/media/directshow/AudioSinkInputPin.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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(AudioSinkInputPin_h_)
     8 #define AudioSinkInputPin_h_
    10 #include "BaseInputPin.h"
    11 #include "DirectShowUtils.h"
    12 #include "mozilla/RefPtr.h"
    13 #include "nsAutoPtr.h"
    15 namespace mozilla {
    17 namespace media {
    18   class MediaType;
    19 }
    21 class AudioSinkFilter;
    22 class SampleSink;
    25 // Input pin for capturing audio output of a DirectShow filter graph.
    26 // This is the input pin for the AudioSinkFilter.
    27 class AudioSinkInputPin: public mozilla::media::BaseInputPin
    28 {
    29 public:
    30   AudioSinkInputPin(wchar_t* aObjectName,
    31                     AudioSinkFilter* aFilter,
    32                     mozilla::CriticalSection* aLock,
    33                     HRESULT* aOutResult);
    34   virtual ~AudioSinkInputPin();
    36   HRESULT GetMediaType (IN int iPos, OUT mozilla::media::MediaType * pmt);
    37   HRESULT CheckMediaType (IN const mozilla::media::MediaType * pmt);
    38   STDMETHODIMP Receive (IN IMediaSample *);
    39   STDMETHODIMP BeginFlush() MOZ_OVERRIDE;
    40   STDMETHODIMP EndFlush() MOZ_OVERRIDE;
    42   // Called when we start decoding a new segment, that happens directly after
    43   // a seek. This captures the segment's start time. Samples decoded by the
    44   // MP3 decoder have their timestamps offset from the segment start time.
    45   // Storing the segment start time enables us to set each sample's MediaTime
    46   // as an offset in the stream relative to the start of the stream, rather
    47   // than the start of the segment, i.e. its absolute time in the stream.
    48   STDMETHODIMP NewSegment(REFERENCE_TIME tStart,
    49                           REFERENCE_TIME tStop,
    50                           double dRate) MOZ_OVERRIDE;
    52   STDMETHODIMP EndOfStream() MOZ_OVERRIDE;
    54   // Returns the IMediaSeeking interface of the connected output pin.
    55   // We forward seeking requests upstream from the sink to the source
    56   // filters.
    57   TemporaryRef<IMediaSeeking> GetConnectedPinSeeking();
    59   SampleSink* GetSampleSink();
    61 private:
    62   AudioSinkFilter* GetAudioSinkFilter();
    64   // Sets the media time on the media sample, relative to the segment
    65   // start time.
    66   HRESULT SetAbsoluteMediaTime(IMediaSample* aSample);
    68   nsAutoPtr<SampleSink> mSampleSink;
    70   // Synchronized by the filter lock; BaseInputPin::mLock.
    71   REFERENCE_TIME mSegmentStartTime;
    72 };
    74 } // namespace mozilla
    75 #endif // AudioSinkInputPin_h_

mercurial