00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #pragma once
00020
00021 #include "StreamSwitcher.h"
00022
00023 [uuid("CEDB2890-53AE-4231-91A3-B0AAFCD1DBDE")]
00024 interface IAudioSwitcherFilter : public IUnknown
00025 {
00026 STDMETHOD(GetInputSpeakerConfig) (DWORD* pdwChannelMask) = 0;
00027 STDMETHOD(GetSpeakerConfig) (bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
00028 STDMETHOD(SetSpeakerConfig) (bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]) = 0;
00029 STDMETHOD_(int, GetNumberOfInputChannels) () = 0;
00030 STDMETHOD_(bool, IsDownSamplingTo441Enabled) () = 0;
00031 STDMETHOD(EnableDownSamplingTo441) (bool fEnable) = 0;
00032 STDMETHOD_(REFERENCE_TIME, GetAudioTimeShift) () = 0;
00033 STDMETHOD(SetAudioTimeShift) (REFERENCE_TIME rtAudioTimeShift) = 0;
00034 };
00035
00036 class AudioStreamResampler;
00037
00038 [uuid("18C16B08-6497-420e-AD14-22D21C2CEAB7")]
00039 class CAudioSwitcherFilter : public CStreamSwitcherFilter, public IAudioSwitcherFilter
00040 {
00041 typedef struct {DWORD Speaker, Channel;} ChMap;
00042 CArray<ChMap> m_chs[18];
00043
00044 bool m_fCustomChannelMapping;
00045 DWORD m_pSpeakerToChannelMap[18][18];
00046 bool m_fDownSampleTo441;
00047 REFERENCE_TIME m_rtAudioTimeShift;
00048 CAutoPtrArray<AudioStreamResampler> m_pResamplers;
00049
00050 REFERENCE_TIME m_rtNextStart, m_rtNextStop;
00051
00052 public:
00053 CAudioSwitcherFilter(LPUNKNOWN lpunk, HRESULT* phr);
00054
00055 DECLARE_IUNKNOWN
00056 STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
00057
00058 HRESULT CheckMediaType(const CMediaType* pmt);
00059 HRESULT Transform(IMediaSample* pIn, IMediaSample* pOut);
00060 CMediaType CreateNewOutputMediaType(CMediaType mt, long& cbBuffer);
00061 void OnNewOutputMediaType(const CMediaType& mtIn, const CMediaType& mtOut);
00062
00063
00064 STDMETHODIMP GetInputSpeakerConfig(DWORD* pdwChannelMask);
00065 STDMETHODIMP GetSpeakerConfig(bool* pfCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]);
00066 STDMETHODIMP SetSpeakerConfig(bool fCustomChannelMapping, DWORD pSpeakerToChannelMap[18][18]);
00067 STDMETHODIMP_(int) GetNumberOfInputChannels();
00068 STDMETHODIMP_(bool) IsDownSamplingTo441Enabled();
00069 STDMETHODIMP EnableDownSamplingTo441(bool fEnable);
00070 STDMETHODIMP_(REFERENCE_TIME) GetAudioTimeShift();
00071 STDMETHODIMP SetAudioTimeShift(REFERENCE_TIME rtAudioTimeShift);
00072 };