1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/directshow/AudioSinkInputPin.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 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(AudioSinkInputPin_h_) 1.11 +#define AudioSinkInputPin_h_ 1.12 + 1.13 +#include "BaseInputPin.h" 1.14 +#include "DirectShowUtils.h" 1.15 +#include "mozilla/RefPtr.h" 1.16 +#include "nsAutoPtr.h" 1.17 + 1.18 +namespace mozilla { 1.19 + 1.20 +namespace media { 1.21 + class MediaType; 1.22 +} 1.23 + 1.24 +class AudioSinkFilter; 1.25 +class SampleSink; 1.26 + 1.27 + 1.28 +// Input pin for capturing audio output of a DirectShow filter graph. 1.29 +// This is the input pin for the AudioSinkFilter. 1.30 +class AudioSinkInputPin: public mozilla::media::BaseInputPin 1.31 +{ 1.32 +public: 1.33 + AudioSinkInputPin(wchar_t* aObjectName, 1.34 + AudioSinkFilter* aFilter, 1.35 + mozilla::CriticalSection* aLock, 1.36 + HRESULT* aOutResult); 1.37 + virtual ~AudioSinkInputPin(); 1.38 + 1.39 + HRESULT GetMediaType (IN int iPos, OUT mozilla::media::MediaType * pmt); 1.40 + HRESULT CheckMediaType (IN const mozilla::media::MediaType * pmt); 1.41 + STDMETHODIMP Receive (IN IMediaSample *); 1.42 + STDMETHODIMP BeginFlush() MOZ_OVERRIDE; 1.43 + STDMETHODIMP EndFlush() MOZ_OVERRIDE; 1.44 + 1.45 + // Called when we start decoding a new segment, that happens directly after 1.46 + // a seek. This captures the segment's start time. Samples decoded by the 1.47 + // MP3 decoder have their timestamps offset from the segment start time. 1.48 + // Storing the segment start time enables us to set each sample's MediaTime 1.49 + // as an offset in the stream relative to the start of the stream, rather 1.50 + // than the start of the segment, i.e. its absolute time in the stream. 1.51 + STDMETHODIMP NewSegment(REFERENCE_TIME tStart, 1.52 + REFERENCE_TIME tStop, 1.53 + double dRate) MOZ_OVERRIDE; 1.54 + 1.55 + STDMETHODIMP EndOfStream() MOZ_OVERRIDE; 1.56 + 1.57 + // Returns the IMediaSeeking interface of the connected output pin. 1.58 + // We forward seeking requests upstream from the sink to the source 1.59 + // filters. 1.60 + TemporaryRef<IMediaSeeking> GetConnectedPinSeeking(); 1.61 + 1.62 + SampleSink* GetSampleSink(); 1.63 + 1.64 +private: 1.65 + AudioSinkFilter* GetAudioSinkFilter(); 1.66 + 1.67 + // Sets the media time on the media sample, relative to the segment 1.68 + // start time. 1.69 + HRESULT SetAbsoluteMediaTime(IMediaSample* aSample); 1.70 + 1.71 + nsAutoPtr<SampleSink> mSampleSink; 1.72 + 1.73 + // Synchronized by the filter lock; BaseInputPin::mLock. 1.74 + REFERENCE_TIME mSegmentStartTime; 1.75 +}; 1.76 + 1.77 +} // namespace mozilla 1.78 +#endif // AudioSinkInputPin_h_