summaryrefslogtreecommitdiffstats
path: root/plugins/pluginWinAudioDSP/plugin_audio_dsp_mediabuffer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pluginWinAudioDSP/plugin_audio_dsp_mediabuffer.cxx')
-rwxr-xr-xplugins/pluginWinAudioDSP/plugin_audio_dsp_mediabuffer.cxx59
1 files changed, 22 insertions, 37 deletions
diff --git a/plugins/pluginWinAudioDSP/plugin_audio_dsp_mediabuffer.cxx b/plugins/pluginWinAudioDSP/plugin_audio_dsp_mediabuffer.cxx
index 34e5b4d..b4a1726 100755
--- a/plugins/pluginWinAudioDSP/plugin_audio_dsp_mediabuffer.cxx
+++ b/plugins/pluginWinAudioDSP/plugin_audio_dsp_mediabuffer.cxx
@@ -1,18 +1,18 @@
/* Copyright (C) 2013 Mamadou DIOP
* Copyright (C) 2013 Doubango Telecom <http://www.doubango.org>
-*
+*
* This file is part of Open Source Doubango Framework.
*
* DOUBANGO is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
-*
+*
* DOUBANGO is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-*
+*
* You should have received a copy of the GNU General Public License
* along with DOUBANGO.
*/
@@ -25,48 +25,42 @@ AudioDSPMediaBuffer::AudioDSPMediaBuffer(DWORD cbMaxLength, HRESULT& hr) :
m_pbData(NULL)
{
m_pbData = new BYTE[cbMaxLength];
- if (!m_pbData)
- {
+ if (!m_pbData) {
hr = E_OUTOFMEMORY;
}
}
AudioDSPMediaBuffer::~AudioDSPMediaBuffer()
{
- if (m_pbData)
- {
+ if (m_pbData) {
delete [] m_pbData;
}
}
-// Function to create a new IMediaBuffer object and return
+// Function to create a new IMediaBuffer object and return
// an AddRef'd interface pointer.
HRESULT AudioDSPMediaBuffer::Create(long cbMaxLen, IMediaBuffer **ppBuffer)
{
HRESULT hr = S_OK;
AudioDSPMediaBuffer *pBuffer = NULL;
- if (ppBuffer == NULL)
- {
+ if (ppBuffer == NULL) {
return E_POINTER;
}
pBuffer = new AudioDSPMediaBuffer(cbMaxLen, hr);
- if (pBuffer == NULL)
- {
+ if (pBuffer == NULL) {
hr = E_OUTOFMEMORY;
}
- if (SUCCEEDED(hr))
- {
- *ppBuffer = pBuffer;
- (*ppBuffer)->AddRef();
+ if (SUCCEEDED(hr)) {
+ *ppBuffer = pBuffer;
+ (*ppBuffer)->AddRef();
}
- if (pBuffer)
- {
+ if (pBuffer) {
pBuffer->Release();
}
return hr;
@@ -75,18 +69,15 @@ HRESULT AudioDSPMediaBuffer::Create(long cbMaxLen, IMediaBuffer **ppBuffer)
// IUnknown methods.
STDMETHODIMP AudioDSPMediaBuffer::QueryInterface(REFIID riid, void **ppv)
{
- if (ppv == NULL)
- {
+ if (ppv == NULL) {
return E_POINTER;
}
- else if (riid == IID_IMediaBuffer || riid == IID_IUnknown)
- {
+ else if (riid == IID_IMediaBuffer || riid == IID_IUnknown) {
*ppv = static_cast<IMediaBuffer *>(this);
AddRef();
return S_OK;
}
- else
- {
+ else {
*ppv = NULL;
return E_NOINTERFACE;
}
@@ -100,19 +91,17 @@ STDMETHODIMP_(ULONG) AudioDSPMediaBuffer::AddRef()
STDMETHODIMP_(ULONG) AudioDSPMediaBuffer::Release()
{
LONG lRef = InterlockedDecrement(&m_nRefCount);
- if (lRef == 0)
- {
+ if (lRef == 0) {
delete this;
// m_cRef is no longer valid! Return lRef.
}
- return lRef;
+ return lRef;
}
// IMediaBuffer methods.
STDMETHODIMP AudioDSPMediaBuffer::SetLength(DWORD cbLength)
{
- if (cbLength > m_cbMaxLength)
- {
+ if (cbLength > m_cbMaxLength) {
return E_INVALIDARG;
}
m_cbLength = cbLength;
@@ -121,8 +110,7 @@ STDMETHODIMP AudioDSPMediaBuffer::SetLength(DWORD cbLength)
STDMETHODIMP AudioDSPMediaBuffer::GetMaxLength(DWORD *pcbMaxLength)
{
- if (pcbMaxLength == NULL)
- {
+ if (pcbMaxLength == NULL) {
return E_POINTER;
}
*pcbMaxLength = m_cbMaxLength;
@@ -132,16 +120,13 @@ STDMETHODIMP AudioDSPMediaBuffer::GetMaxLength(DWORD *pcbMaxLength)
STDMETHODIMP AudioDSPMediaBuffer::GetBufferAndLength(BYTE **ppbBuffer, DWORD *pcbLength)
{
// Either parameter can be NULL, but not both.
- if (ppbBuffer == NULL && pcbLength == NULL)
- {
+ if (ppbBuffer == NULL && pcbLength == NULL) {
return E_POINTER;
}
- if (ppbBuffer)
- {
+ if (ppbBuffer) {
*ppbBuffer = m_pbData;
}
- if (pcbLength)
- {
+ if (pcbLength) {
*pcbLength = m_cbLength;
}
return S_OK;
OpenPOWER on IntegriCloud