Commit 2e283d09 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Remove tabs, reformat, merge comments.

parent b6bc6aa6
...@@ -32,152 +32,173 @@ ...@@ -32,152 +32,173 @@
WINE_DEFAULT_DEBUG_CHANNEL(msdmo); WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
/*********************************************************************** /***********************************************************************
* MoCreateMediaType (MSDMO.@) * MoCreateMediaType (MSDMO.@)
*
* Allocate a new media type structure
*/ */
HRESULT WINAPI MoCreateMediaType(DMO_MEDIA_TYPE** ppmedia, DWORD cbFormat) HRESULT WINAPI MoCreateMediaType(DMO_MEDIA_TYPE** ppmedia, DWORD cbFormat)
{ {
HRESULT hr; HRESULT r;
TRACE("(%p,%lu)\n", ppmedia, cbFormat); TRACE("%p %lu\n", ppmedia, cbFormat);
if (ppmedia == NULL) if (!ppmedia)
return E_POINTER; return E_POINTER;
*ppmedia = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE)); *ppmedia = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
if (*ppmedia == NULL) if (!*ppmedia)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hr = MoInitMediaType(*ppmedia, cbFormat); r = MoInitMediaType(*ppmedia, cbFormat);
if (FAILED(hr)) { if (FAILED(r))
CoTaskMemFree(*ppmedia); {
*ppmedia = NULL; CoTaskMemFree(*ppmedia);
} *ppmedia = NULL;
}
return hr; return r;
} }
/*********************************************************************** /***********************************************************************
* MoInitMediaType (MSDMO.@) * MoInitMediaType (MSDMO.@)
*
* Initialize media type structure
*/ */
HRESULT WINAPI MoInitMediaType(DMO_MEDIA_TYPE* pmedia, DWORD cbFormat) HRESULT WINAPI MoInitMediaType(DMO_MEDIA_TYPE* pmedia, DWORD cbFormat)
{ {
TRACE("(%p,%lu)\n", pmedia,cbFormat); TRACE("%p %lu\n", pmedia, cbFormat);
if (pmedia == NULL) if (!pmedia)
return E_POINTER; return E_POINTER;
memset(pmedia, 0, sizeof(DMO_MEDIA_TYPE)); memset(pmedia, 0, sizeof(DMO_MEDIA_TYPE));
if (cbFormat > 0) { if (cbFormat > 0)
pmedia->pbFormat = CoTaskMemAlloc(cbFormat); {
if (pmedia->pbFormat == NULL) pmedia->pbFormat = CoTaskMemAlloc(cbFormat);
return E_OUTOFMEMORY; if (!pmedia->pbFormat)
return E_OUTOFMEMORY;
pmedia->cbFormat = cbFormat; pmedia->cbFormat = cbFormat;
} }
return S_OK; return S_OK;
} }
/*********************************************************************** /***********************************************************************
* MoDeleteMediaType (MSDMO.@) * MoDeleteMediaType (MSDMO.@)
*
* Delete a media type structure
*/ */
HRESULT WINAPI MoDeleteMediaType(DMO_MEDIA_TYPE* pmedia) HRESULT WINAPI MoDeleteMediaType(DMO_MEDIA_TYPE* pmedia)
{ {
TRACE("(%p)\n", pmedia); TRACE("%p\n", pmedia);
if (pmedia == NULL) if (!pmedia)
return E_POINTER; return E_POINTER;
MoFreeMediaType(pmedia); MoFreeMediaType(pmedia);
CoTaskMemFree(pmedia); CoTaskMemFree(pmedia);
return S_OK; return S_OK;
} }
/*********************************************************************** /***********************************************************************
* MoFreeMediaType (MSDMO.@) * MoFreeMediaType (MSDMO.@)
*
* Free allocated members of a media type structure
*/ */
HRESULT WINAPI MoFreeMediaType(DMO_MEDIA_TYPE* pmedia) HRESULT WINAPI MoFreeMediaType(DMO_MEDIA_TYPE* pmedia)
{ {
TRACE("(%p)\n", pmedia); TRACE("%p\n", pmedia);
if (pmedia == NULL) if (!pmedia)
return E_POINTER; return E_POINTER;
if (pmedia->pUnk != NULL) { if (pmedia->pUnk)
IUnknown_Release(pmedia->pUnk); {
pmedia->pUnk = NULL; IUnknown_Release(pmedia->pUnk);
} pmedia->pUnk = NULL;
}
if (pmedia->pbFormat != NULL) { if (pmedia->pbFormat)
CoTaskMemFree(pmedia->pbFormat); {
pmedia->pbFormat = NULL; CoTaskMemFree(pmedia->pbFormat);
} pmedia->pbFormat = NULL;
}
return S_OK; return S_OK;
} }
/*********************************************************************** /***********************************************************************
* MoDuplicateMediaType (MSDMO.@) * MoDuplicateMediaType (MSDMO.@)
*
* Duplicates a media type structure
*/ */
HRESULT WINAPI MoDuplicateMediaType(DMO_MEDIA_TYPE** ppdst, HRESULT WINAPI MoDuplicateMediaType(DMO_MEDIA_TYPE** ppdst,
const DMO_MEDIA_TYPE* psrc) const DMO_MEDIA_TYPE* psrc)
{ {
HRESULT hr; HRESULT r;
TRACE("(%p,%p)\n", ppdst, psrc); TRACE("%p %p\n", ppdst, psrc);
if (ppdst == NULL || psrc == NULL) if (!ppdst || !psrc)
return E_POINTER; return E_POINTER;
*ppdst = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE)); *ppdst = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
if (*ppdst == NULL) if (!*ppdst)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
hr = MoCopyMediaType(*ppdst, psrc); r = MoCopyMediaType(*ppdst, psrc);
if (FAILED(hr)) { if (FAILED(r))
MoFreeMediaType(*ppdst); {
*ppdst = NULL; MoFreeMediaType(*ppdst);
} *ppdst = NULL;
}
return hr; return r;
} }
/*********************************************************************** /***********************************************************************
* MoCopyMediaType (MSDMO.@) * MoCopyMediaType (MSDMO.@)
*
* Copy a new media type structure
*/ */
HRESULT WINAPI MoCopyMediaType(DMO_MEDIA_TYPE* pdst, HRESULT WINAPI MoCopyMediaType(DMO_MEDIA_TYPE* pdst,
const DMO_MEDIA_TYPE* psrc) const DMO_MEDIA_TYPE* psrc)
{ {
TRACE("(%p,%p)\n", pdst, psrc); TRACE("%p %p\n", pdst, psrc);
if (pdst == NULL || psrc == NULL) if (!pdst || !psrc)
return E_POINTER; return E_POINTER;
memcpy(&pdst->majortype, &psrc->majortype, sizeof(psrc->majortype)); memcpy(&pdst->majortype, &psrc->majortype, sizeof(psrc->majortype));
memcpy(&pdst->subtype, &psrc->subtype, sizeof(psrc->subtype)); memcpy(&pdst->subtype, &psrc->subtype, sizeof(psrc->subtype));
memcpy(&pdst->formattype, &psrc->formattype, sizeof(psrc->formattype)); memcpy(&pdst->formattype, &psrc->formattype, sizeof(psrc->formattype));
pdst->bFixedSizeSamples = psrc->bFixedSizeSamples; pdst->bFixedSizeSamples = psrc->bFixedSizeSamples;
pdst->bTemporalCompression = psrc->bTemporalCompression; pdst->bTemporalCompression = psrc->bTemporalCompression;
pdst->lSampleSize = psrc->lSampleSize; pdst->lSampleSize = psrc->lSampleSize;
pdst->cbFormat = psrc->cbFormat; pdst->cbFormat = psrc->cbFormat;
if (psrc->pbFormat != NULL && psrc->cbFormat > 0) { if (psrc->pbFormat && psrc->cbFormat > 0)
pdst->pbFormat = CoTaskMemAlloc(psrc->cbFormat); {
if (pdst->pbFormat == NULL) pdst->pbFormat = CoTaskMemAlloc(psrc->cbFormat);
return E_OUTOFMEMORY; if (!pdst->pbFormat)
return E_OUTOFMEMORY;
memcpy(pdst->pbFormat, psrc->pbFormat, psrc->cbFormat);
} else memcpy(pdst->pbFormat, psrc->pbFormat, psrc->cbFormat);
pdst->pbFormat = NULL; }
else
if (psrc->pUnk != NULL) { pdst->pbFormat = NULL;
pdst->pUnk = psrc->pUnk;
IUnknown_AddRef(pdst->pUnk); if (psrc->pUnk)
} else {
pdst->pUnk = NULL; pdst->pUnk = psrc->pUnk;
IUnknown_AddRef(pdst->pUnk);
return S_OK; }
else
pdst->pUnk = NULL;
return S_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment