Lines Matching full:hr
35 …HRESULT hr = Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(… in create() local
36 if (FAILED(hr)) return nullptr; in create()
38 if (SUCCEEDED(hr)) in create()
39 hr = objFactory.As(&spPropVal); in create()
40 if (SUCCEEDED(hr)) { in create()
41 hr = winrt_type<_Type>::create(spPropVal.Get(), _ObjInCtx, _PObj.GetAddressOf()); in create()
42 if (SUCCEEDED(hr)) in create()
75 …HRESULT hr = Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(… in create() local
76 if (FAILED(hr)) return nullptr; in create()
78 if (SUCCEEDED(hr)) in create()
79 hr = objFactory.As(&spPropVal); in create()
80 if (SUCCEEDED(hr)) { in create()
81 … hr = winrt_array_type<_Type>::create(spPropVal.Get(), N, _ObjInCtx, _PObj.GetAddressOf()); in create()
82 if (SUCCEEDED(hr)) in create()
387 #define BEGIN_CALL_IN_CONTEXT(hr, var, ...) hr = S_OK;\ argument
389 #define END_CALL_IN_CONTEXT(hr) if (FAILED(hr)) throw Platform::Exception::CreateException(hr);\ argument
394 #define BEGIN_CALL_IN_CONTEXT(hr, var, ...) hr = var._CallInContext([__VA_ARGS__]() -> HRESULT { argument
395 #define END_CALL_IN_CONTEXT(hr) return hr;\ argument
439 #define END_CREATE_ASYNC(hr) if (FAILED(hr)) throw Platform::Exception::CreateException(hr);\ argument
466 #define GET_WRL_OBJ_FROM_REF(objtype, obj, orig, hr) objtype^ obj = orig;\ argument
467 hr = S_OK;
468 #define GET_WRL_OBJ_FROM_OBJ(objtype, obj, orig, hr) objtype^ obj = safe_cast<objtype^>(orig);\ argument
469 hr = S_OK;
471 #define WRL_PROP_GET(obj, prop, arg, hr) arg = obj->##prop;\ argument
472 hr = S_OK;
473 #define WRL_PROP_PUT(obj, prop, arg, hr) obj->##prop = arg;\ argument
474 hr = S_OK;
475 #define WRL_METHOD_BASE(obj, method, ret, hr) ret = obj->##method();\ argument
476 hr = S_OK;
477 #define WRL_METHOD(obj, method, ret, hr, ...) ret = obj->##method(__VA_ARGS__);\ argument
478 hr = S_OK;
479 #define WRL_METHOD_NORET_BASE(obj, method, hr) obj->##method();\ argument
480 hr = S_OK;
481 #define WRL_METHOD_NORET(obj, method, hr, ...) obj->##method(__VA_ARGS__);\ argument
482 hr = S_OK;
491 #define ACTIVATE_OBJ(rtclass, objtype, obj, hr) MAKE_WRL_OBJ(objtype) obj = ref new objtype();\ argument
492 hr = S_OK;
493 #define ACTIVATE_STATIC_OBJ(rtclass, objtype, obj, hr) objtype obj;\ argument
494 hr = S_OK;
529 #define END_CREATE_ASYNC(hr) return hr;\ argument
556 #define GET_WRL_OBJ_FROM_REF(objtype, obj, orig, hr) Microsoft::WRL::ComPtr<objtype> obj;\ argument
557 hr = orig->QueryInterface(__uuidof(objtype), &obj);
558 #define GET_WRL_OBJ_FROM_OBJ(objtype, obj, orig, hr) Microsoft::WRL::ComPtr<objtype> obj;\ argument
559 hr = orig.As(&obj);
561 #define WRL_PROP_GET(obj, prop, arg, hr) hr = obj->get_##prop(&arg); argument
562 #define WRL_PROP_PUT(obj, prop, arg, hr) hr = obj->put_##prop(arg); argument
563 #define WRL_METHOD_BASE(obj, method, ret, hr) hr = obj->##method(&ret); argument
564 #define WRL_METHOD(obj, method, ret, hr, ...) hr = obj->##method(__VA_ARGS__, &ret); argument
565 #define WRL_METHOD_NORET_BASE(obj, method, hr) hr = obj->##method(); argument
574 #define ACTIVATE_OBJ(rtclass, objtype, obj, hr) MAKE_WRL_OBJ(objtype) obj;\ argument
577 …hr = Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(rtclass)…
578 if (SUCCEEDED(hr)) {\
580 hr = objFactory->ActivateInstance(pInsp.GetAddressOf());\
581 if (SUCCEEDED(hr)) hr = pInsp.As(&obj);\
584 #define ACTIVATE_STATIC_OBJ(rtclass, objtype, obj, hr) objtype obj;\ argument
587 …hr = Windows::Foundation::GetActivationFactory(Microsoft::WRL::Wrappers::HStringReference(rtclass)…
588 if (SUCCEEDED(hr)) {\
589 if (SUCCEEDED(hr)) hr = objFactory.As(&obj);\
727 CBaseAttributes(HRESULT& hr, UINT32 cInitialSize = 0) in CBaseAttributes() argument
729 hr = Initialize(cInitialSize); in CBaseAttributes()
739 CBaseAttributes(HRESULT& hr, IUnknown *pUnk) in CBaseAttributes() argument
741 hr = Initialize(pUnk); in CBaseAttributes()
997 HRESULT hr = S_OK; in SerializeToBlob() local
1001 CHECK_HR(hr = MFGetAttributesAsBlobSize(_spAttributes.Get(), &cbSize)); in SerializeToBlob()
1006 CHECK_HR(hr = E_OUTOFMEMORY); in SerializeToBlob()
1009 CHECK_HR(hr = MFGetAttributesAsBlob(_spAttributes.Get(), pBuffer, cbSize)); in SerializeToBlob()
1015 if (FAILED(hr)) in SerializeToBlob()
1021 return hr; in SerializeToBlob()
1087 HRESULT hr = S_OK; in STDMETHOD() local
1092 hr = RuntimeClassT::QueryInterface(riid, ppv); in STDMETHOD()
1110 hr = E_NOINTERFACE; in STDMETHOD()
1114 return hr; in STDMETHOD()
1136 HRESULT hr = S_OK; in MarshalQI() local
1140 hr = CoCreateFreeThreadedMarshaler((IMFStreamSink*)this, &m_spFTM); in MarshalQI()
1145 if (SUCCEEDED(hr)) { in MarshalQI()
1147 hr = E_UNEXPECTED; in MarshalQI()
1150 hr = m_spFTM.Get()->QueryInterface(riid, ppv); in MarshalQI()
1153 return hr; in MarshalQI()
1186 HRESULT hr; in Initialize() local
1188 hr = MFCreateEventQueue(&m_spEventQueue); in Initialize()
1189 if (SUCCEEDED(hr)) in Initialize()
1192 …hr = CBaseAttributes<>::GetUnknown(MF_STREAMSINK_MEDIASINKINTERFACE, __uuidof(IMFMediaSink), (LPVO… in Initialize()
1194 if (SUCCEEDED(hr)) { in Initialize()
1195 hr = pMedSink.Get()->QueryInterface(IID_PPV_ARGS(&m_pParent)); in Initialize()
1198 return hr; in Initialize()
1215 HRESULT hr = S_OK; in Start() local
1230 hr = QueueEvent(MEStreamSinkStarted, GUID_NULL, hr, NULL); in Start()
1231 if (SUCCEEDED(hr)) { in Start()
1232 hr = QueueEvent(MEStreamSinkRequestSample, GUID_NULL, hr, NULL); in Start()
1235 else hr = MF_E_NOT_INITIALIZED; in Start()
1237 return hr; in Start()
1245 HRESULT hr = S_OK; in Pause() local
1249 hr = QueueEvent(MEStreamSinkPaused, GUID_NULL, hr, NULL); in Pause()
1250 } else if (hr == State_TypeNotSet) in Pause()
1251 hr = MF_E_NOT_INITIALIZED; in Pause()
1253 hr = MF_E_INVALIDREQUEST; in Pause()
1255 return hr; in Pause()
1262 HRESULT hr = S_OK; in Restart() local
1266 hr = QueueEvent(MEStreamSinkStarted, GUID_NULL, hr, NULL); in Restart()
1267 if (SUCCEEDED(hr)) { in Restart()
1268 hr = QueueEvent(MEStreamSinkRequestSample, GUID_NULL, hr, NULL); in Restart()
1270 } else if (hr == State_TypeNotSet) in Restart()
1271 hr = MF_E_NOT_INITIALIZED; in Restart()
1273 hr = MF_E_INVALIDREQUEST; in Restart()
1275 return hr; in Restart()
1282 HRESULT hr = S_OK; in Stop() local
1285 hr = QueueEvent(MEStreamSinkStopped, GUID_NULL, hr, NULL); in Stop()
1287 else hr = MF_E_NOT_INITIALIZED; in Stop()
1289 return hr; in Stop()
1296 HRESULT hr = S_OK; in Shutdown() local
1298 …hr = m_pParent->GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (… in Shutdown()
1299 if (SUCCEEDED(hr)) { in Shutdown()
1300 hr = pSampleCallback->OnShutdown(); in Shutdown()
1304 hr = m_spEventQueue->Shutdown(); in Shutdown()
1311 return hr; in Shutdown()
1324 HRESULT hr = CheckShutdown(); in GetMediaSink() local
1326 if (SUCCEEDED(hr)) in GetMediaSink()
1329 …hr = CBaseAttributes<>::GetUnknown(MF_STREAMSINK_MEDIASINKINTERFACE, __uuidof(IMFMediaSink), (LPVO… in GetMediaSink()
1330 if (SUCCEEDED(hr)) { in GetMediaSink()
1336 DebugPrintOut(L"StreamSink::GetMediaSink: HRESULT=%i\n", hr); in GetMediaSink()
1337 return hr; in GetMediaSink()
1349 HRESULT hr = CheckShutdown(); in GetIdentifier() local
1351 if (SUCCEEDED(hr)) in GetIdentifier()
1353 hr = GetUINT32(MF_STREAMSINK_ID, (UINT32*)pdwIdentifier); in GetIdentifier()
1357 DebugPrintOut(L"StreamSink::GetIdentifier: HRESULT=%i\n", hr); in GetIdentifier()
1358 return hr; in GetIdentifier()
1370 HRESULT hr = CheckShutdown(); in GetMediaTypeHandler() local
1373 if (SUCCEEDED(hr)) in GetMediaTypeHandler()
1375 hr = QueryInterface(IID_IMFMediaTypeHandler, (void**)ppHandler); in GetMediaTypeHandler()
1379 DebugPrintOut(L"StreamSink::GetMediaTypeHandler: HRESULT=%i\n", hr); in GetMediaTypeHandler()
1380 return hr; in GetMediaTypeHandler()
1397 HRESULT hr = S_OK; in ProcessSample() local
1403 hr = MF_E_NOT_INITIALIZED; in ProcessSample()
1405 hr = MF_E_INVALIDREQUEST; in ProcessSample()
1407 if (SUCCEEDED(hr)) in ProcessSample()
1408 hr = CheckShutdown(); in ProcessSample()
1409 if (SUCCEEDED(hr)) { in ProcessSample()
1410 hr = pSample->ConvertToContiguousBuffer(&pInput); in ProcessSample()
1411 if (SUCCEEDED(hr)) { in ProcessSample()
1412 hr = pSample->GetSampleTime(&hnsTime); in ProcessSample()
1414 if (SUCCEEDED(hr)) { in ProcessSample()
1415 hr = pSample->GetSampleDuration(&hnsDuration); in ProcessSample()
1417 if (SUCCEEDED(hr)) { in ProcessSample()
1418 hr = GetMajorType(&guidMajorType); in ProcessSample()
1420 if (SUCCEEDED(hr)) { in ProcessSample()
1421 …hr = m_pParent->GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (… in ProcessSample()
1423 if (SUCCEEDED(hr)) { in ProcessSample()
1424 hr = pInput->Lock(&pSrc, &cbMaxLength, &cbCurrentLength); in ProcessSample()
1426 if (SUCCEEDED(hr)) { in ProcessSample()
1427 …hr = pSampleCallback->OnProcessSample(guidMajorType, 0, hnsTime, hnsDuration, pSrc, cbCurrentLengt… in ProcessSample()
1430 if (SUCCEEDED(hr)) { in ProcessSample()
1431 hr = QueueEvent(MEStreamSinkRequestSample, GUID_NULL, S_OK, NULL); in ProcessSample()
1435 return hr; in ProcessSample()
1445 HRESULT hr = S_OK; in PlaceMarker() local
1447 hr = MF_E_NOT_INITIALIZED; in PlaceMarker()
1449 if (SUCCEEDED(hr)) in PlaceMarker()
1450 hr = CheckShutdown(); in PlaceMarker()
1452 if (SUCCEEDED(hr)) in PlaceMarker()
1455 hr = QueueEvent(MEStreamSinkRequestSample, GUID_NULL, S_OK, NULL); in PlaceMarker()
1459 …DebugPrintOut(L"StreamSink::PlaceMarker: HRESULT=%i %s\n", hr, StreamSinkMarkerTypeMap.at(eMarkerT… in PlaceMarker()
1460 return hr; in PlaceMarker()
1466 HRESULT hr = CheckShutdown(); in Flush() local
1468 if (SUCCEEDED(hr)) in Flush()
1473 DebugPrintOut(L"StreamSink::Flush: HRESULT=%i\n", hr); in Flush()
1474 return hr; in Flush()
1484 HRESULT hr = S_OK; in GetEvent() local
1492 hr = CheckShutdown(); in GetEvent()
1495 if (SUCCEEDED(hr)) in GetEvent()
1503 if (SUCCEEDED(hr)) in GetEvent()
1505 hr = pQueue->GetEvent(dwFlags, ppEvent); in GetEvent()
1508 … if (SUCCEEDED(hr) && SUCCEEDED((*ppEvent)->GetType(&meType)) && meType == MEStreamSinkStopped) { in GetEvent()
1511 if (SUCCEEDED(hr)) in GetEvent()
1512 hr = (*ppEvent)->GetStatus(&hrStatus); in GetEvent()
1513 if (SUCCEEDED(hr)) in GetEvent()
1516 DebugPrintOut(L"StreamSink::GetEvent: HRESULT=%i\n", hr); in GetEvent()
1517 return hr; in GetEvent()
1522 HRESULT hr = S_OK; in BeginGetEvent() local
1526 hr = CheckShutdown(); in BeginGetEvent()
1528 if (SUCCEEDED(hr)) in BeginGetEvent()
1530 hr = m_spEventQueue->BeginGetEvent(pCallback, punkState); in BeginGetEvent()
1533 DebugPrintOut(L"StreamSink::BeginGetEvent: HRESULT=%i\n", hr); in BeginGetEvent()
1534 return hr; in BeginGetEvent()
1539 HRESULT hr = S_OK; in EndGetEvent() local
1543 hr = CheckShutdown(); in EndGetEvent()
1545 if (SUCCEEDED(hr)) in EndGetEvent()
1547 hr = m_spEventQueue->EndGetEvent(pResult, ppEvent); in EndGetEvent()
1551 … if (SUCCEEDED(hr) && SUCCEEDED((*ppEvent)->GetType(&meType)) && meType == MEStreamSinkStopped) { in EndGetEvent()
1556 if (SUCCEEDED(hr)) in EndGetEvent()
1557 hr = (*ppEvent)->GetStatus(&hrStatus); in EndGetEvent()
1558 if (SUCCEEDED(hr)) in EndGetEvent()
1561 DebugPrintOut(L"StreamSink::EndGetEvent: HRESULT=%i\n", hr); in EndGetEvent()
1562 return hr; in EndGetEvent()
1568 HRESULT hr = S_OK; in QueueEvent() local
1572 hr = CheckShutdown(); in QueueEvent()
1574 if (SUCCEEDED(hr)) in QueueEvent()
1576 hr = m_spEventQueue->QueueEventParamVar(met, guidExtendedType, hrStatus, pvValue); in QueueEvent()
1581 DebugPrintOut(L"StreamSink::QueueEvent: HRESULT=%i\n", hr); in QueueEvent()
1582 return hr; in QueueEvent()
1601 HRESULT hr = CheckShutdown(); in IsMediaTypeSupported() local
1603 if (SUCCEEDED(hr)) in IsMediaTypeSupported()
1605 hr = pMediaType->GetGUID(MF_MT_MAJOR_TYPE, &majorType); in IsMediaTypeSupported()
1609 if (SUCCEEDED(hr)) in IsMediaTypeSupported()
1613 hr = MF_E_INVALIDTYPE; in IsMediaTypeSupported()
1617 if (SUCCEEDED(hr) && m_spCurrentType != nullptr) in IsMediaTypeSupported()
1623 hr = MF_E_INVALIDTYPE; in IsMediaTypeSupported()
1632 if (ppMediaType && SUCCEEDED(hr)) { in IsMediaTypeSupported()
1634 hr = MFCreateMediaType(ppMediaType); in IsMediaTypeSupported()
1635 if (SUCCEEDED(hr)) { in IsMediaTypeSupported()
1636 … hr = m_pParent->GetUnknown(MF_MEDIASINK_PREFERREDTYPE, __uuidof(IMFMediaType), (LPVOID*)&pType); in IsMediaTypeSupported()
1638 if (SUCCEEDED(hr)) { in IsMediaTypeSupported()
1639 hr = pType->LockStore(); in IsMediaTypeSupported()
1642 if (SUCCEEDED(hr)) { in IsMediaTypeSupported()
1646 hr = pType->GetCount(&uiTotal); in IsMediaTypeSupported()
1647 for (uiCount = 0; SUCCEEDED(hr) && uiCount < uiTotal; uiCount++) { in IsMediaTypeSupported()
1650 hr = pType->GetItemByIndex(uiCount, &guid, &propval); in IsMediaTypeSupported()
1651 …if (SUCCEEDED(hr) && (guid == MF_MT_FRAME_SIZE || guid == MF_MT_MAJOR_TYPE || guid == MF_MT_PIXEL_… in IsMediaTypeSupported()
1653 hr = (*ppMediaType)->SetItem(guid, propval); in IsMediaTypeSupported()
1659 hr = pType->UnlockStore(); in IsMediaTypeSupported()
1663 DebugPrintOut(L"StreamSink::IsMediaTypeSupported: HRESULT=%i\n", hr); in IsMediaTypeSupported()
1664 return hr; in IsMediaTypeSupported()
1678 HRESULT hr = CheckShutdown(); in GetMediaTypeCount() local
1680 if (SUCCEEDED(hr)) in GetMediaTypeCount()
1687 DebugPrintOut(L"StreamSink::GetMediaTypeCount: HRESULT=%i\n", hr); in GetMediaTypeCount()
1688 return hr; in GetMediaTypeCount()
1703 HRESULT hr = CheckShutdown(); in GetMediaTypeByIndex() local
1707 hr = MF_E_NO_MORE_TYPES; in GetMediaTypeByIndex()
1710 //hr = m_spCurrentType.CopyTo(ppType); in GetMediaTypeByIndex()
1711 if (SUCCEEDED(hr)) { in GetMediaTypeByIndex()
1713 hr = MFCreateMediaType(ppType); in GetMediaTypeByIndex()
1714 if (SUCCEEDED(hr)) { in GetMediaTypeByIndex()
1715 … hr = m_pParent->GetUnknown(MF_MEDIASINK_PREFERREDTYPE, __uuidof(IMFMediaType), (LPVOID*)&pType); in GetMediaTypeByIndex()
1717 if (SUCCEEDED(hr)) { in GetMediaTypeByIndex()
1718 hr = pType->LockStore(); in GetMediaTypeByIndex()
1721 if (SUCCEEDED(hr)) { in GetMediaTypeByIndex()
1725 hr = pType->GetCount(&uiTotal); in GetMediaTypeByIndex()
1726 for (uiCount = 0; SUCCEEDED(hr) && uiCount < uiTotal; uiCount++) { in GetMediaTypeByIndex()
1729 hr = pType->GetItemByIndex(uiCount, &guid, &propval); in GetMediaTypeByIndex()
1730 …if (SUCCEEDED(hr) && (guid == MF_MT_FRAME_SIZE || guid == MF_MT_MAJOR_TYPE || guid == MF_MT_PIXEL_… in GetMediaTypeByIndex()
1732 hr = (*ppType)->SetItem(guid, propval); in GetMediaTypeByIndex()
1738 hr = pType->UnlockStore(); in GetMediaTypeByIndex()
1744 DebugPrintOut(L"StreamSink::GetMediaTypeByIndex: HRESULT=%i\n", hr); in GetMediaTypeByIndex()
1745 return hr; in GetMediaTypeByIndex()
1757 HRESULT hr = S_OK; in SetCurrentMediaType() local
1759 hr = MF_E_INVALIDREQUEST; in SetCurrentMediaType()
1760 if (SUCCEEDED(hr)) in SetCurrentMediaType()
1761 hr = CheckShutdown(); in SetCurrentMediaType()
1768 if (SUCCEEDED(hr)) in SetCurrentMediaType()
1770 hr = IsMediaTypeSupported(pMediaType, NULL); in SetCurrentMediaType()
1774 if (SUCCEEDED(hr)) in SetCurrentMediaType()
1776 hr = MFCreateMediaType(m_spCurrentType.ReleaseAndGetAddressOf()); in SetCurrentMediaType()
1777 if (SUCCEEDED(hr)) in SetCurrentMediaType()
1779 hr = pMediaType->CopyAllItems(m_spCurrentType.Get()); in SetCurrentMediaType()
1781 if (SUCCEEDED(hr)) in SetCurrentMediaType()
1783 hr = m_spCurrentType->GetGUID(MF_MT_SUBTYPE, &m_guiCurrentSubtype); in SetCurrentMediaType()
1786 if (SUCCEEDED(hr)) { in SetCurrentMediaType()
1787 hr = m_spCurrentType->GetMajorType(&guid); in SetCurrentMediaType()
1789 if (SUCCEEDED(hr) && guid == MFMediaType_Video) { in SetCurrentMediaType()
1790 …hr = MFGetAttributeSize(m_spCurrentType.Get(), MF_MT_FRAME_SIZE, &m_imageWidthInPixels, &m_imageHe… in SetCurrentMediaType()
1792 if (SUCCEEDED(hr)) in SetCurrentMediaType()
1799 DebugPrintOut(L"StreamSink::SetCurrentMediaType: HRESULT=%i\n", hr); in SetCurrentMediaType()
1800 return hr; in SetCurrentMediaType()
1812 HRESULT hr = CheckShutdown(); in GetCurrentMediaType() local
1814 if (SUCCEEDED(hr)) { in GetCurrentMediaType()
1816 hr = MF_E_NOT_INITIALIZED; in GetCurrentMediaType()
1820 if (SUCCEEDED(hr)) { in GetCurrentMediaType()
1821 hr = m_spCurrentType.CopyTo(ppMediaType); in GetCurrentMediaType()
1825 DebugPrintOut(L"StreamSink::GetCurrentMediaType: HRESULT=%i\n", hr); in GetCurrentMediaType()
1826 return hr; in GetCurrentMediaType()
1833 HRESULT hr; in GetMajorType() local
1839 … hr = m_pParent->GetUnknown(MF_MEDIASINK_PREFERREDTYPE, __uuidof(IMFMediaType), (LPVOID*)&pType); in GetMajorType()
1840 if (SUCCEEDED(hr)) { in GetMajorType()
1841 hr = pType->GetMajorType(pguidMajorType); in GetMajorType()
1843 DebugPrintOut(L"StreamSink::GetMajorType: HRESULT=%i\n", hr); in GetMajorType()
1844 return hr; in GetMajorType()
1887 // hr = list.GetItemPos(&item);
2322 HRESULT hr = List<Ptr>::InsertAfter(item, pBefore); in InsertAfter() local
2323 if (FAILED(hr) && item != nullptr) in InsertAfter()
2327 return hr; in InsertAfter()
2336 HRESULT hr = List<Ptr>::GetItem(pNode, &pItem); in GetItem() local
2337 if (SUCCEEDED(hr)) in GetItem()
2346 return hr; in GetItem()
2358 HRESULT hr = List<Ptr>::RemoveItem(pNode, &pItem); in RemoveItem() local
2360 if (SUCCEEDED(hr)) in RemoveItem()
2376 return hr; in RemoveItem()
2439 HRESULT hr = S_OK;
2451 hr = E_NOINTERFACE;
2454 return hr;
2482 HRESULT hr = S_OK; in SetProperties() local
2490 hr = pConfiguration->QueryInterface(IID_PPV_ARGS(&spSetting)); in SetProperties()
2491 if (FAILED(hr)) { in SetProperties()
2492 hr = E_FAIL; in SetProperties()
2495 if (SUCCEEDED(hr)) { in SetProperties()
2496 …hr = spSetting->Lookup(Microsoft::WRL::Wrappers::HStringReference(MF_PROP_SAMPLEGRABBERCALLBACK).G… in SetProperties()
2497 if (FAILED(hr)) { in SetProperties()
2498 hr = E_INVALIDARG; in SetProperties()
2500 if (SUCCEEDED(hr)) { in SetProperties()
2501 hr = SetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, spInsp.Get()); in SetProperties()
2504 if (SUCCEEDED(hr)) { in SetProperties()
2505 …hr = spSetting->Lookup(Microsoft::WRL::Wrappers::HStringReference(MF_PROP_VIDTYPE).Get(), spInsp.R… in SetProperties()
2506 if (FAILED(hr)) { in SetProperties()
2507 hr = E_INVALIDARG; in SetProperties()
2509 if (SUCCEEDED(hr)) { in SetProperties()
2510 if (SUCCEEDED(hr = spInsp.As(&spPropVal))) { in SetProperties()
2511 hr = spPropVal->GetUInt32(&uiType); in SetProperties()
2515 if (SUCCEEDED(hr)) { in SetProperties()
2516 …hr = spSetting->Lookup(Microsoft::WRL::Wrappers::HStringReference(MF_PROP_VIDENCPROPS).Get(), spIn… in SetProperties()
2517 if (FAILED(hr)) { in SetProperties()
2518 hr = E_INVALIDARG; in SetProperties()
2520 if (SUCCEEDED(hr)) { in SetProperties()
2521 hr = spInsp.As(&pMedEncProps); in SetProperties()
2524 if (SUCCEEDED(hr)) { in SetProperties()
2525 …hr = SetMediaStreamProperties((ABI::Windows::Media::Capture::MediaStreamType)uiType, pMedEncProps.… in SetProperties()
2529 return hr; in SetProperties()
2537 HRESULT hr = S_OK; in AddAttribute() local
2540 hr = pValue->get_Type(&type); in AddAttribute()
2543 if (SUCCEEDED(hr)) in AddAttribute()
2551 … hr = pValue->GetUInt8Array(&cbBlob, &pbBlog); in AddAttribute()
2552 if (SUCCEEDED(hr)) in AddAttribute()
2556 hr = E_INVALIDARG; in AddAttribute()
2560 … hr = pAttr->SetBlob(guidKey, pbBlog, cbBlob); in AddAttribute()
2570 hr = pValue->GetDouble(&value); in AddAttribute()
2571 if (SUCCEEDED(hr)) in AddAttribute()
2573 … hr = pAttr->SetDouble(guidKey, value); in AddAttribute()
2581 hr = pValue->GetGuid(&value); in AddAttribute()
2582 if (SUCCEEDED(hr)) in AddAttribute()
2584 … hr = pAttr->SetGUID(guidKey, value); in AddAttribute()
2592 hr = pValue->GetString(value.GetAddressOf()); in AddAttribute()
2593 if (SUCCEEDED(hr)) in AddAttribute()
2597 … hr = pAttr->SetString(guidKey, szValue); in AddAttribute()
2605 hr = pValue->GetUInt32(&value); in AddAttribute()
2606 if (SUCCEEDED(hr)) in AddAttribute()
2616 hr = pValue->GetUInt64(&value); in AddAttribute()
2617 if (SUCCEEDED(hr)) in AddAttribute()
2619 … hr = pAttr->SetUINT64(guidKey, value); in AddAttribute()
2627 hr = TYPE_E_TYPEMISMATCH; in AddAttribute()
2628 if (SUCCEEDED(hr)) in AddAttribute()
2639 return hr; in AddAttribute()
2643 HRESULT hr = S_OK; in ConvertPropertiesToMediaType() local
2655 hr = pMEP->get_Properties(spMap.GetAddressOf()); in ConvertPropertiesToMediaType()
2657 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2659 hr = spMap.As(&spIterable); in ConvertPropertiesToMediaType()
2661 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2663 hr = spIterable->First(&spIterator); in ConvertPropertiesToMediaType()
2665 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2671 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2673 hr = spIterator->get_HasCurrent(&hasCurrent); in ConvertPropertiesToMediaType()
2683 hr = spIterator->get_Current(&spKeyValuePair); in ConvertPropertiesToMediaType()
2684 if (FAILED(hr)) in ConvertPropertiesToMediaType()
2688 hr = spKeyValuePair->get_Key(&guidKey); in ConvertPropertiesToMediaType()
2689 if (FAILED(hr)) in ConvertPropertiesToMediaType()
2693 hr = spKeyValuePair->get_Value(&spValue); in ConvertPropertiesToMediaType()
2694 if (FAILED(hr)) in ConvertPropertiesToMediaType()
2698 hr = spValue.As(&spPropValue); in ConvertPropertiesToMediaType()
2699 if (FAILED(hr)) in ConvertPropertiesToMediaType()
2703 hr = AddAttribute(guidKey, spPropValue.Get(), spMT.Get()); in ConvertPropertiesToMediaType()
2704 if (FAILED(hr)) in ConvertPropertiesToMediaType()
2709 hr = spIterator->MoveNext(&hasCurrent); in ConvertPropertiesToMediaType()
2710 if (FAILED(hr)) in ConvertPropertiesToMediaType()
2717 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2723 hr = spMap->Lookup(MF_MT_MAJOR_TYPE, spValue.GetAddressOf()); in ConvertPropertiesToMediaType()
2725 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2727 hr = spValue.As(&spPropValue); in ConvertPropertiesToMediaType()
2729 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2731 hr = spPropValue->GetGuid(&guiMajorType); in ConvertPropertiesToMediaType()
2733 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2737 hr = E_UNEXPECTED; in ConvertPropertiesToMediaType()
2742 if (SUCCEEDED(hr)) in ConvertPropertiesToMediaType()
2747 return hr; in ConvertPropertiesToMediaType()
2753 HRESULT hr = S_OK; in SetMediaStreamProperties() local
2768 hr = ConvertPropertiesToMediaType(mediaEncodingProperties, &spMediaType); in SetMediaStreamProperties()
2769 if (SUCCEEDED(hr)) in SetMediaStreamProperties()
2771 … hr = AddStreamSink(GetStreamId(MediaStreamType), nullptr, spStreamSink.GetAddressOf()); in SetMediaStreamProperties()
2773 if (SUCCEEDED(hr)) { in SetMediaStreamProperties()
2774 hr = SetUnknown(MF_MEDIASINK_PREFERREDTYPE, spMediaType.Detach()); in SetMediaStreamProperties()
2778 return hr; in SetMediaStreamProperties()
2784 HRESULT hr; in GetCharacteristics() local
2787 if (SUCCEEDED(hr = CheckShutdown())) { in GetCharacteristics()
2792 DebugPrintOut(L"MediaSink::GetCharacteristics: HRESULT=%i\n", hr); in GetCharacteristics()
2793 return hr; in GetCharacteristics()
2801 HRESULT hr = CheckShutdown(); in AddStreamSink() local
2803 if (SUCCEEDED(hr)) in AddStreamSink()
2805 hr = GetStreamSinkById(dwStreamSinkIdentifier, &spMFStream); in AddStreamSink()
2808 if (SUCCEEDED(hr)) in AddStreamSink()
2810 hr = MF_E_STREAMSINK_EXISTS; in AddStreamSink()
2814 hr = S_OK; in AddStreamSink()
2817 if (SUCCEEDED(hr)) in AddStreamSink()
2822 hr = E_OUTOFMEMORY; in AddStreamSink()
2824 if (SUCCEEDED(hr)) in AddStreamSink()
2825 hr = pStream.As<IMFStreamSink>(&spMFStream); in AddStreamSink()
2829 hr = pSink->QueryInterface(IID_IMFStreamSink, (void**)spMFStream.GetAddressOf()); in AddStreamSink()
2830 if (SUCCEEDED(hr)) { in AddStreamSink()
2831 hr = spMFStream.As(&pStream); in AddStreamSink()
2833 if (FAILED(hr)) delete pSink; in AddStreamSink()
2840 if (SUCCEEDED(hr)) { in AddStreamSink()
2841 hr = pStream.As(&pAttr); in AddStreamSink()
2843 if (SUCCEEDED(hr)) { in AddStreamSink()
2844 hr = pAttr->SetUINT32(MF_STREAMSINK_ID, dwStreamSinkIdentifier); in AddStreamSink()
2845 if (SUCCEEDED(hr)) { in AddStreamSink()
2846 hr = pAttr->SetUnknown(MF_STREAMSINK_MEDIASINKINTERFACE, (IMFMediaSink*)this); in AddStreamSink()
2849 if (SUCCEEDED(hr)) { in AddStreamSink()
2850 hr = pStream->Initialize(); in AddStreamSink()
2853 if (SUCCEEDED(hr)) in AddStreamSink()
2863 hr = m_streams.GetItemPos(pos, &spCurr); in AddStreamSink()
2864 if (FAILED(hr)) in AddStreamSink()
2868 hr = spCurr->GetIdentifier(&dwCurrId); in AddStreamSink()
2869 if (FAILED(hr)) in AddStreamSink()
2880 if (SUCCEEDED(hr)) in AddStreamSink()
2882 hr = m_streams.InsertPos(pos, spMFStream.Get()); in AddStreamSink()
2886 if (SUCCEEDED(hr)) in AddStreamSink()
2891 DebugPrintOut(L"MediaSink::AddStreamSink: HRESULT=%i\n", hr); in AddStreamSink()
2892 return hr; in AddStreamSink()
2897 HRESULT hr = CheckShutdown(); in RemoveStreamSink() local
2902 if (SUCCEEDED(hr)) in RemoveStreamSink()
2906 hr = m_streams.GetItemPos(pos, &spStream); in RemoveStreamSink()
2909 if (FAILED(hr)) in RemoveStreamSink()
2914 hr = spStream->GetIdentifier(&dwId); in RemoveStreamSink()
2915 if (FAILED(hr) || dwId == dwStreamSinkIdentifier) in RemoveStreamSink()
2923 hr = MF_E_INVALIDSTREAMNUMBER; in RemoveStreamSink()
2927 if (SUCCEEDED(hr)) in RemoveStreamSink()
2929 hr = m_streams.Remove(pos, nullptr); in RemoveStreamSink()
2933 hr = S_OK; in RemoveStreamSink()
2935 hr = spStream.As(&spCustomSink); in RemoveStreamSink()
2937 if (SUCCEEDED(hr)) in RemoveStreamSink()
2938 hr = spCustomSink->Shutdown(); in RemoveStreamSink()
2941 DebugPrintOut(L"MediaSink::RemoveStreamSink: HRESULT=%i\n", hr); in RemoveStreamSink()
2942 return hr; in RemoveStreamSink()
2953 HRESULT hr = CheckShutdown(); in GetStreamSinkCount() local
2955 if (SUCCEEDED(hr)) in GetStreamSinkCount()
2961 DebugPrintOut(L"MediaSink::GetStreamSinkCount: HRESULT=%i\n", hr); in GetStreamSinkCount()
2962 return hr; in GetStreamSinkCount()
2981 HRESULT hr = CheckShutdown(); in GetStreamSinkByIndex() local
2983 if (SUCCEEDED(hr)) in GetStreamSinkByIndex()
2996 hr = MF_E_UNEXPECTED; in GetStreamSinkByIndex()
3000 hr = m_streams.GetItemPos(pos, &spStream); in GetStreamSinkByIndex()
3004 if (SUCCEEDED(hr)) in GetStreamSinkByIndex()
3009 DebugPrintOut(L"MediaSink::GetStreamSinkByIndex: HRESULT=%i\n", hr); in GetStreamSinkByIndex()
3010 return hr; in GetStreamSinkByIndex()
3021 HRESULT hr = CheckShutdown(); in GetStreamSinkById() local
3024 if (SUCCEEDED(hr)) in GetStreamSinkById()
3032 hr = m_streams.GetItemPos(pos, &spStream); in GetStreamSinkById()
3035 if (FAILED(hr)) in GetStreamSinkById()
3040 hr = spStream->GetIdentifier(&dwId); in GetStreamSinkById()
3041 if (FAILED(hr)) in GetStreamSinkById()
3054 hr = MF_E_INVALIDSTREAMNUMBER; in GetStreamSinkById()
3058 if (SUCCEEDED(hr)) in GetStreamSinkById()
3064 DebugPrintOut(L"MediaSink::GetStreamSinkById: HRESULT=%i\n", hr); in GetStreamSinkById()
3065 return hr; in GetStreamSinkById()
3072 HRESULT hr = CheckShutdown(); in SetPresentationClock() local
3076 if (SUCCEEDED(hr)) { in SetPresentationClock()
3078 hr = m_spClock->RemoveClockStateSink(this); in SetPresentationClock()
3083 if (SUCCEEDED(hr)) { in SetPresentationClock()
3085 hr = pPresentationClock->AddClockStateSink(this); in SetPresentationClock()
3090 if (SUCCEEDED(hr)) { in SetPresentationClock()
3094 …hr = GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (LPVOID*)pSa… in SetPresentationClock()
3097 if (SUCCEEDED(hr)) in SetPresentationClock()
3098 hr = pSampleCallback->OnSetPresentationClock(pPresentationClock); in SetPresentationClock()
3099 DebugPrintOut(L"MediaSink::SetPresentationClock: HRESULT=%i\n", hr); in SetPresentationClock()
3100 return hr; in SetPresentationClock()
3111 HRESULT hr = CheckShutdown(); in GetPresentationClock() local
3113 if (SUCCEEDED(hr)) { in GetPresentationClock()
3115 hr = MF_E_NO_CLOCK; // There is no presentation clock. in GetPresentationClock()
3118 hr = m_spClock.CopyTo(ppPresentationClock); in GetPresentationClock()
3122 DebugPrintOut(L"MediaSink::GetPresentationClock: HRESULT=%i\n", hr); in GetPresentationClock()
3123 return hr; in GetPresentationClock()
3129 HRESULT hr = CheckShutdown(); in Shutdown() local
3131 if (SUCCEEDED(hr)) { in Shutdown()
3137 …hr = CBaseAttributes<>::GetUnknown(MF_MEDIASINK_PREFERREDTYPE, __uuidof(IMFMediaType), (LPVOID*)pT… in Shutdown()
3138 if (SUCCEEDED(hr)) { in Shutdown()
3139 hr = DeleteItem(MF_MEDIASINK_PREFERREDTYPE); in Shutdown()
3145 DebugPrintOut(L"MediaSink::Shutdown: HRESULT=%i\n", hr); in Shutdown()
3146 return hr; in Shutdown()
3154 HRESULT hr; in operator ()() local
3158 hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); in operator ()()
3159 if (FAILED(hr)) return hr; in operator ()()
3161 hr = spCustomSink->Shutdown(); in operator ()()
3162 return hr; in operator ()()
3177 HRESULT hr; in operator ()() local
3181 hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); in operator ()()
3182 if (FAILED(hr)) return hr; in operator ()()
3184 hr = spCustomSink->Start(_llStartTime); in operator ()()
3185 return hr; in operator ()()
3197 HRESULT hr; in operator ()() local
3201 hr = pStream->QueryInterface(IID_PPV_ARGS(spCustomSink.GetAddressOf())); in operator ()()
3202 if (FAILED(hr)) return hr; in operator ()()
3204 hr = spCustomSink->Stop(); in operator ()()
3205 return hr; in operator ()()
3214 HRESULT hr = S_OK; in ForEach() local
3220 hr = col.GetItemPos(pos, &spStream); in ForEach()
3221 if (FAILED(hr)) in ForEach()
3226 hr = fn(spStream.Get()); in ForEach()
3229 return hr; in ForEach()
3236 HRESULT hr = CheckShutdown(); in OnClockStart() local
3238 if (SUCCEEDED(hr)) in OnClockStart()
3242 hr = ForEach(m_streams, StartFunc(llClockStartOffset)); in OnClockStart()
3245 if (SUCCEEDED(hr)) in OnClockStart()
3246 …hr = GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (LPVOID*)pSa… in OnClockStart()
3248 if (SUCCEEDED(hr)) in OnClockStart()
3249 hr = pSampleCallback->OnClockStart(hnsSystemTime, llClockStartOffset); in OnClockStart()
3250 DebugPrintOut(L"MediaSink::OnClockStart: HRESULT=%i\n", hr); in OnClockStart()
3251 return hr; in OnClockStart()
3257 HRESULT hr = CheckShutdown(); in OnClockStop() local
3259 if (SUCCEEDED(hr)) in OnClockStop()
3262 hr = ForEach(m_streams, StopFunc()); in OnClockStop()
3265 if (SUCCEEDED(hr)) in OnClockStop()
3266 …hr = GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (LPVOID*)pSa… in OnClockStop()
3268 if (SUCCEEDED(hr)) in OnClockStop()
3269 hr = pSampleCallback->OnClockStop(hnsSystemTime); in OnClockStop()
3270 DebugPrintOut(L"MediaSink::OnClockStop: HRESULT=%i\n", hr); in OnClockStop()
3271 return hr; in OnClockStop()
3276 HRESULT hr; in OnClockPause() local
3278 …hr = GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (LPVOID*)pSa… in OnClockPause()
3279 if (SUCCEEDED(hr)) in OnClockPause()
3280 hr = pSampleCallback->OnClockPause(hnsSystemTime); in OnClockPause()
3281 DebugPrintOut(L"MediaSink::OnClockPause: HRESULT=%i\n", hr); in OnClockPause()
3282 return hr; in OnClockPause()
3287 HRESULT hr; in OnClockRestart() local
3289 …hr = GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (LPVOID*)pSa… in OnClockRestart()
3290 if (SUCCEEDED(hr)) in OnClockRestart()
3291 hr = pSampleCallback->OnClockRestart(hnsSystemTime); in OnClockRestart()
3292 DebugPrintOut(L"MediaSink::OnClockRestart: HRESULT=%i\n", hr); in OnClockRestart()
3293 return hr; in OnClockRestart()
3299 HRESULT hr; in OnClockSetRate() local
3301 …hr = GetUnknown(MF_MEDIASINK_SAMPLEGRABBERCALLBACK, IID_IMFSampleGrabberSinkCallback, (LPVOID*)pSa… in OnClockSetRate()
3302 if (SUCCEEDED(hr)) in OnClockSetRate()
3303 hr = pSampleCallback->OnClockSetRate(hnsSystemTime, flRate); in OnClockSetRate()
3304 DebugPrintOut(L"MediaSink::OnClockSetRate: HRESULT=%i\n", hr); in OnClockSetRate()
3305 return hr; in OnClockSetRate()