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