AudioSwitcher.h

00001 // Copyright 2003 Gabest.
00002 // http://www.gabest.org
00003 //
00004 // This program is free software; you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation; either version 2 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
00017 // http://www.gnu.org/copyleft/gpl.html
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         // IAudioSwitcherFilter
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 };

Generated on Tue Dec 13 14:47:26 2005 for guliverkli by  doxygen 1.4.5