本文整理汇总了C++中CopyMediaType函数的典型用法代码示例。如果您正苦于以下问题:C++ CopyMediaType函数的具体用法?C++ CopyMediaType怎么用?C++ CopyMediaType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CopyMediaType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyMediaType
//
// CheckInputType
//
// Check the input type is OK - return an error otherwise
//
HRESULT CAudioTimeScale::CheckInputType(const CMediaType *mtIn)
{
// check this is an audio format that we can support
if (*mtIn->FormatType() != FORMAT_WaveFormatEx) {
return E_INVALIDARG;
}
// Can we transform this type
if (CanPerformTransform(mtIn)) {
CopyMediaType(&m_mt, mtIn);
return NOERROR;
}
return E_FAIL;
}
示例2: FreeMediaType
STDMETHODIMP CapturePin::QueryAccept(const AM_MEDIA_TYPE *pmt)
{
if(pmt->majortype != expectedMajorType)
return S_FALSE;
if(!IsValidMediaType(pmt))
return S_FALSE;
if(connectedPin)
{
FreeMediaType(connectedMediaType);
CopyMediaType(&connectedMediaType, pmt);
}
return S_OK;
}
示例3: lock
HRESULT CSampleSender::SetAcceptedMediaType( const CMediaType * pmt )
{
CAutoLock lock( &m_Lock );
if( !pmt )
{
m_mtAccept = CMediaType( );
return NOERROR;
}
HRESULT hr;
hr = CopyMediaType( &m_mtAccept, pmt );
return hr;
}
示例4: CMediaSample_SetMediaType
/**
* \brief IMediaType::SetMediaType (specifies media type for sample)
*
* \param[in] This pointer to CMediaSample object
* \param[in] pMediaType pointer to AM_MEDIA_TYPE specifies new media type
*
* \return S_OK success
* \return E_OUTOFMEMORY insufficient memory
*
*/
static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This,
AM_MEDIA_TYPE *pMediaType)
{
AM_MEDIA_TYPE* t;
Debug printf("CMediaSample_SetMediaType(%p) called\n", This);
if (!pMediaType)
return E_INVALIDARG;
t = &((CMediaSample*)This)->media_type;
if(((CMediaSample*)This)->type_valid)
FreeMediaType(t);
CopyMediaType(t,pMediaType);
((CMediaSample*) This)->type_valid=1;
return 0;
}
示例5: CreateMediaType
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const * pSrc)
{
AM_MEDIA_TYPE * pDest;
pDest = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
if (!pDest)
return NULL;
if (FAILED(CopyMediaType(pDest, pSrc)))
{
CoTaskMemFree(pDest);
return NULL;
}
return pDest;
}
示例6: CopyMediaType
HRESULT CBufferFilter::GetMediaType(int iPosition, CMediaType* pMediaType)
{
if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
// TODO: offer all input types from upstream and allow reconnection at least in stopped state
if (iPosition < 0) {
return E_INVALIDARG;
}
if (iPosition > 0) {
return VFW_S_NO_MORE_ITEMS;
}
CopyMediaType(pMediaType, &m_pInput->CurrentMediaType());
return S_OK;
}
示例7: CreateMediaType
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc)
{
ASSERT(pSrc);
// Allocate a block of memory for the media type
AM_MEDIA_TYPE *pMediaType =
(AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
if (pMediaType == NULL) {
return NULL;
}
// Copy the variable length format block
CopyMediaType(pMediaType,pSrc);
return pMediaType;
}
示例8: StdMediaSample2_GetMediaType
static HRESULT WINAPI StdMediaSample2_GetMediaType(IMediaSample2 * iface, AM_MEDIA_TYPE ** ppMediaType)
{
StdMediaSample2 *This = (StdMediaSample2 *)iface;
TRACE("(%p)\n", ppMediaType);
if (!This->props.pMediaType) {
/* Make sure we return a NULL pointer (required by native Quartz dll) */
if (ppMediaType)
*ppMediaType = NULL;
return S_FALSE;
}
if (!(*ppMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
return E_OUTOFMEMORY;
return CopyMediaType(*ppMediaType, This->props.pMediaType);
}
示例9: VfwPin_GetMediaType
static HRESULT WINAPI VfwPin_GetMediaType(BasePin *pin, int iPosition, AM_MEDIA_TYPE *pmt)
{
VfwPinImpl *This = impl_from_BasePin(pin);
AM_MEDIA_TYPE *vfw_pmt;
HRESULT hr;
if (iPosition < 0)
return E_INVALIDARG;
if (iPosition > 0)
return VFW_S_NO_MORE_ITEMS;
hr = qcap_driver_get_format(This->parent->driver_info, &vfw_pmt);
if (SUCCEEDED(hr)) {
CopyMediaType(pmt, vfw_pmt);
DeleteMediaType(vfw_pmt);
}
return hr;
}
示例10: StdMediaSample2_SetMediaType
static HRESULT WINAPI StdMediaSample2_SetMediaType(IMediaSample2 * iface, AM_MEDIA_TYPE * pMediaType)
{
StdMediaSample2 *This = impl_from_IMediaSample2(iface);
TRACE("(%p)->(%p)\n", iface, pMediaType);
if (This->props.pMediaType)
{
FreeMediaType(This->props.pMediaType);
This->props.pMediaType = NULL;
}
if (!pMediaType)
return S_FALSE;
if (!(This->props.pMediaType = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))))
return E_OUTOFMEMORY;
return CopyMediaType(This->props.pMediaType, pMediaType);
}
示例11: CheckPointer
/* Return the media type of the connection */
STDMETHODIMP
CBasePin::ConnectionMediaType(
AM_MEDIA_TYPE *pmt
)
{
CheckPointer(pmt,E_POINTER);
ValidateReadWritePtr(pmt,sizeof(AM_MEDIA_TYPE));
CComAutoLock cObjectLock(m_pLock);
/* Copy constructor of m_mt allocates the memory */
if (IsConnected()) {
CopyMediaType( pmt, &m_mt );
return S_OK;
} else {
((CMediaType *)pmt)->InitMediaType();
return VFW_E_NOT_CONNECTED;
}
}
示例12: CorrectMediaType
void CorrectMediaType(AM_MEDIA_TYPE* pmt)
{
if(!pmt) return;
CMediaType mt(*pmt);
if(mt.formattype == FORMAT_VideoInfo)
{
VIDEOINFOHEADER* vih = (VIDEOINFOHEADER*)mt.pbFormat;
for(int i = 0; i < VIHSIZE; i++)
{
if(mt.subtype == *vihs[i].subtype
&& vih->bmiHeader.biCompression == vihs[i].vih.bmiHeader.biCompression)
{
mt.AllocFormatBuffer(vihs[i].size);
memcpy(mt.pbFormat, &vihs[i], vihs[i].size);
memcpy(mt.pbFormat, pmt->pbFormat, sizeof(VIDEOINFOHEADER));
break;
}
}
}
else if(mt.formattype == FORMAT_VideoInfo2)
{
VIDEOINFOHEADER2* vih2 = (VIDEOINFOHEADER2*)mt.pbFormat;
for(int i = 0; i < VIHSIZE; i++)
{
if(mt.subtype == *vih2s[i].subtype
&& vih2->bmiHeader.biCompression == vih2s[i].vih.bmiHeader.biCompression)
{
mt.AllocFormatBuffer(vih2s[i].size);
memcpy(mt.pbFormat, &vih2s[i], vih2s[i].size);
memcpy(mt.pbFormat, pmt->pbFormat, sizeof(VIDEOINFOHEADER2));
break;
}
}
}
CopyMediaType(pmt, &mt);
}
示例13: CreateMediaType
AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc)
{
_ASSERT(pSrc);
// Allocate a block of memory for the media type
AM_MEDIA_TYPE *pMediaType =
(AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
if (pMediaType == NULL) {
return NULL;
}
// Copy the variable length format block
HRESULT hr = CopyMediaType(pMediaType,pSrc);
if (FAILED(hr)) {
CoTaskMemFree((PVOID)pMediaType);
return NULL;
}
return pMediaType;
}
示例14: EnumMediaTypes_Construct
HRESULT WINAPI EnumMediaTypes_Construct(BasePin *basePin, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum)
{
ULONG i;
IEnumMediaTypesImpl * pEnumMediaTypes = CoTaskMemAlloc(sizeof(IEnumMediaTypesImpl));
AM_MEDIA_TYPE amt;
if (!pEnumMediaTypes)
{
*ppEnum = NULL;
return E_OUTOFMEMORY;
}
pEnumMediaTypes->IEnumMediaTypes_iface.lpVtbl = &IEnumMediaTypesImpl_Vtbl;
pEnumMediaTypes->refCount = 1;
pEnumMediaTypes->uIndex = 0;
pEnumMediaTypes->enumMediaFunction = enumFunc;
pEnumMediaTypes->mediaVersionFunction = versionFunc;
IPin_AddRef(&basePin->IPin_iface);
pEnumMediaTypes->basePin = basePin;
i = 0;
while (enumFunc(basePin, i, &amt) == S_OK) i++;
pEnumMediaTypes->enumMediaDetails.cMediaTypes = i;
pEnumMediaTypes->enumMediaDetails.pMediaTypes = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE) * i);
for (i = 0; i < pEnumMediaTypes->enumMediaDetails.cMediaTypes; i++)
{
enumFunc(basePin,i,&amt);
if (FAILED(CopyMediaType(&pEnumMediaTypes->enumMediaDetails.pMediaTypes[i], &amt)))
{
while (i--)
FreeMediaType(&pEnumMediaTypes->enumMediaDetails.pMediaTypes[i]);
CoTaskMemFree(pEnumMediaTypes->enumMediaDetails.pMediaTypes);
return E_OUTOFMEMORY;
}
}
*ppEnum = &pEnumMediaTypes->IEnumMediaTypes_iface;
pEnumMediaTypes->currentVersion = versionFunc(basePin);
return S_OK;
}
示例15: CopyMediaType
HRESULT CDeCSSFilter::GetMediaType(int iPosition, CMediaType* pmt)
{
if (m_pInput->IsConnected() == FALSE) {
return E_UNEXPECTED;
}
if (iPosition < 0) {
return E_INVALIDARG;
}
if (iPosition > 1) {
return VFW_S_NO_MORE_ITEMS;
}
CopyMediaType(pmt, &m_pInput->CurrentMediaType());
if (iPosition == 0) {
pmt->majortype = MEDIATYPE_MPEG2_PACK;
}
if (iPosition == 1) {
pmt->majortype = MEDIATYPE_MPEG2_PES;
}
return S_OK;
}