4#if defined(ENABLE_OPENNI) || defined(ENABLE_OPENNI2)
17COpenNiMedia::COpenNiMedia(
void)
23HRESULT STDMETHODCALLTYPE COpenNiMedia::GetOutputCurrentType(DWORD index, DMO_MEDIA_TYPE *pmt)
30HRESULT STDMETHODCALLTYPE COpenNiMedia::ProcessOutput(DWORD dwFlags, DWORD oputBufferCount, DMO_OUTPUT_DATA_BUFFER *outputBuffers, DWORD *pdwStatus)
37HRESULT STDMETHODCALLTYPE COpenNiMedia::SetOutputType(DWORD index,
const DMO_MEDIA_TYPE *pmt, DWORD flags)
49COpenNiAudio::COpenNiAudio(COpenNiTool* tool)
55 m_mediaObj =
new COpenNiMedia();
58 if (tool!=NULL) init(tool);
63COpenNiAudio::~COpenNiAudio(
void)
65 DEBUG_ERROR(
"DESTRUCTOR: COpenNiAudio: START\n");
69 DEBUG_ERROR(
"DESTRUCTOR: COpenNiAudio: END\n");
74BOOL COpenNiAudio::init(COpenNiTool* tool)
76 if (tool==NULL)
return FALSE;
107void COpenNiAudio::free(
void)
120BOOL COpenNiAudio::setMediaType(
void)
122 WAVEFORMATEX format = getAudioFormat();
139void COpenNiAudio::getAudioData(Buffer* pbuf)
141 if (m_pStream==NULL || pbuf==NULL)
return;
145 m_pStream->Read((
void*)pbuf->buf, (ULONG)pbuf->bufsz, &len);
146 pbuf->vldsz = (int)len;
153WAVEFORMATEX COpenNiAudio::getAudioFormat(
void)
155 WORD blockAlign = ((OpenNiAudioBitsPerSample+7)/8)*OpenNiAudioChannels;
156 DWORD avgBytesPerSec = blockAlign*OpenNiAudioSamplesPerSec;
158 WAVEFORMATEX format = {
159 OpenNiAudioFormat, OpenNiAudioChannels, OpenNiAudioSamplesPerSec,
160 avgBytesPerSec, blockAlign, OpenNiAudioBitsPerSample, 0
void releaseNull(T *&ptr)