mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-03 03:19:08 +08:00
27 lines
480 B
C++
27 lines
480 B
C++
#include "DirectShowUtils.h"
|
|
|
|
void FreeMediaTypeHelper(AM_MEDIA_TYPE& mt)
|
|
{
|
|
if (mt.cbFormat != 0)
|
|
{
|
|
CoTaskMemFree(mt.pbFormat);
|
|
mt.cbFormat = 0;
|
|
mt.pbFormat = nullptr;
|
|
}
|
|
if (mt.pUnk != nullptr)
|
|
{
|
|
mt.pUnk->Release();
|
|
mt.pUnk = nullptr;
|
|
}
|
|
}
|
|
|
|
void DeleteMediaTypeHelper(AM_MEDIA_TYPE* pmt)
|
|
{
|
|
if (!pmt)
|
|
{
|
|
return;
|
|
}
|
|
FreeMediaTypeHelper(*pmt);
|
|
CoTaskMemFree(const_cast<AM_MEDIA_TYPE*>(pmt));
|
|
}
|