Lines Matching full:hr
818 HRESULT hr = pAttr->GetItemByIndex(index, &guid, &var); in LogAttributeValueByIndexNew() local
819 if (FAILED(hr)) in LogAttributeValueByIndexNew()
823 hr = GetGUIDNameNew(guid, &pGuidName); in LogAttributeValueByIndexNew()
824 if (FAILED(hr)) in LogAttributeValueByIndexNew()
828 hr = SpecialCaseAttributeValueNew(guid, var, out); in LogAttributeValueByIndexNew()
830 if (FAILED(hr)) in LogAttributeValueByIndexNew()
834 if (hr == S_FALSE) in LogAttributeValueByIndexNew()
852 hr = GetGUIDNameNew(*var.puuid, &pGuidValName); in LogAttributeValueByIndexNew()
853 if (SUCCEEDED(hr)) in LogAttributeValueByIndexNew()
862 hr = GetGUIDNameNew(*var.puuid, &pGuidValName); in LogAttributeValueByIndexNew()
863 if (SUCCEEDED(hr)) in LogAttributeValueByIndexNew()
872 hr = GetGUIDNameNew(*var.puuid, &pGuidValName); in LogAttributeValueByIndexNew()
873 if (SUCCEEDED(hr)) in LogAttributeValueByIndexNew()
895 return hr; in LogAttributeValueByIndexNew()
900 HRESULT hr = S_OK; in GetGUIDNameNew() local
906 hr = StringCchLengthW(pcwsz, STRSAFE_MAX_CCH, &cchLength); in GetGUIDNameNew()
907 if (FAILED(hr)) in GetGUIDNameNew()
914 hr = E_OUTOFMEMORY; in GetGUIDNameNew()
917 hr = StringCchCopyW(pName, cchLength + 1, pcwsz); in GetGUIDNameNew()
918 if (FAILED(hr)) in GetGUIDNameNew()
925 hr = StringFromCLSID(guid, &pName); in GetGUIDNameNew()
928 if (FAILED(hr)) in GetGUIDNameNew()
937 return hr; in GetGUIDNameNew()
1169 HRESULT hr = pType->LockStore(); in Read() local
1170 if (FAILED(hr)) in Read()
1174 hr = pType->GetCount(&count); in Read()
1175 if (FAILED(hr)) in Read()
1181 hr = LogAttributeValueByIndexNew(pType, i, out); in Read()
1182 if (FAILED(hr)) in Read()
1187 hr = pType->UnlockStore(); in Read()
1188 if (FAILED(hr)) in Read()
1272 HRESULT hr; in initImageGrabber() local
1274 WRL_PROP_GET(pSource, VideoDeviceController, pDevCont, hr) in initImageGrabber()
1275 if (FAILED(hr)) return hr; in initImageGrabber()
1276 GET_WRL_OBJ_FROM_OBJ(_MediaDeviceController, pMedDevCont, pDevCont, hr) in initImageGrabber()
1277 if (FAILED(hr)) return hr; in initImageGrabber()
1279 …WRL_METHOD(pMedDevCont, GetMediaStreamProperties, pMedEncProps, hr, WRL_ENUM_GET(_MediaStreamType,… in initImageGrabber()
1280 if (FAILED(hr)) return hr; in initImageGrabber()
1281 GET_WRL_OBJ_FROM_OBJ(_VideoEncodingProperties, pVidProps, pMedEncProps, hr); in initImageGrabber()
1282 if (FAILED(hr)) return hr; in initImageGrabber()
1284 …hr = MediaSink::ConvertPropertiesToMediaType(DEREF_AS_NATIVE_WRL_OBJ(ABI::Windows::Media::MediaPro… in initImageGrabber()
1285 if (FAILED(hr)) return hr; in initImageGrabber()
1297 CHECK_HR(hr = RawImage::CreateInstance(&ig_RIFirst, sizeRawImage)); in initImageGrabber()
1298 CHECK_HR(hr = RawImage::CreateInstance(&ig_RISecond, sizeRawImage)); in initImageGrabber()
1302 return hr; in initImageGrabber()
1307 HRESULT hr = S_OK; in stopGrabbing() local
1309 …WRL_OBJ_FROM_REF(_MediaCaptureVideoPreview, imedPrevCap, DEREF_AGILE_WRL_OBJ(ig_pMedCapSource), hr) in stopGrabbing()
1310 if (FAILED(hr)) return hr; in stopGrabbing()
1312 WRL_METHOD_BASE(imedPrevCap, StopPreviewAsync, pAction, hr) in stopGrabbing()
1313 if (SUCCEEDED(hr)) { in stopGrabbing()
1317 HRESULT hr = S_OK; in stopGrabbing()
1321 END_CREATE_ASYNC(hr)); in stopGrabbing()
1327 return hr; in stopGrabbing()
1332 HRESULT hr = S_OK; in startGrabbing() local
1333 …WRL_OBJ_FROM_REF(_MediaCaptureVideoPreview, imedPrevCap, DEREF_AGILE_WRL_OBJ(ig_pMedCapSource), hr) in startGrabbing()
1334 if (FAILED(hr)) return hr; in startGrabbing()
1335 ACTIVATE_OBJ(RuntimeClass_Windows_Foundation_Collections_PropertySet, _PropertySet, pSet, hr) in startGrabbing()
1336 if (FAILED(hr)) return hr; in startGrabbing()
1337 GET_WRL_OBJ_FROM_OBJ(_Map, spSetting, pSet, hr) in startGrabbing()
1338 if (FAILED(hr)) return hr; in startGrabbing()
1339 …(RuntimeClass_Windows_Foundation_PropertyValue, MAKE_WRL_OBJ(_PropertyValueStatics), spPropVal, hr) in startGrabbing()
1340 if (FAILED(hr)) return hr; in startGrabbing()
1343 …WRL_METHOD(spPropVal, CreateUInt32, pVal, hr, (unsigned int)WRL_ENUM_GET(_MediaStreamType, MediaSt… in startGrabbing()
1344 if (FAILED(hr)) return hr; in startGrabbing()
1345 …WRL_METHOD(spSetting, Insert, bReplaced, hr, DEREF_WRL_OBJ(_StringReference(MF_PROP_VIDTYPE)), DER… in startGrabbing()
1346 if (FAILED(hr)) return hr; in startGrabbing()
1347 …WRL_METHOD(spSetting, Insert, bReplaced, hr, DEREF_WRL_OBJ(_StringReference(MF_PROP_SAMPLEGRABBERC… in startGrabbing()
1348 if (FAILED(hr)) return hr; in startGrabbing()
1350 WRL_PROP_GET(ig_pMedCapSource, VideoDeviceController, pDevCont, hr) in startGrabbing()
1351 if (FAILED(hr)) return hr; in startGrabbing()
1352 GET_WRL_OBJ_FROM_OBJ(_MediaDeviceController, pMedDevCont, pDevCont, hr) in startGrabbing()
1353 if (FAILED(hr)) return hr; in startGrabbing()
1355 …WRL_METHOD(pMedDevCont, GetMediaStreamProperties, pMedEncProps, hr, WRL_ENUM_GET(_MediaStreamType,… in startGrabbing()
1356 if (FAILED(hr)) return hr; in startGrabbing()
1357 GET_WRL_OBJ_FROM_OBJ(_VideoEncodingProperties, pVidProps, pMedEncProps, hr); in startGrabbing()
1358 if (FAILED(hr)) return hr; in startGrabbing()
1359 …timeClass_Windows_Media_MediaProperties_MediaEncodingProfile, _MediaEncodingProfile, pEncProps, hr) in startGrabbing()
1360 if (FAILED(hr)) return hr; in startGrabbing()
1361 WRL_PROP_PUT(pEncProps, Video, DEREF_WRL_OBJ(pVidProps), hr) in startGrabbing()
1362 if (FAILED(hr)) return hr; in startGrabbing()
1363 …WRL_METHOD(spSetting, Insert, bReplaced, hr, DEREF_WRL_OBJ(_StringReference(MF_PROP_VIDENCPROPS)),… in startGrabbing()
1364 if (SUCCEEDED(hr)) { in startGrabbing()
1366 …WRL_METHOD(imedPrevCap, _StartPreviewToCustomSinkIdAsync, *action, hr, DEREF_WRL_OBJ(pEncProps), D… in startGrabbing()
1367 if (FAILED(hr) && hr == REGDB_E_CLASSNOTREG) { in startGrabbing()
1368 hr = Microsoft::WRL::Make<MediaSink>().CopyTo(&ig_pMediaSink); in startGrabbing()
1369 if (FAILED(hr)) return hr; in startGrabbing()
1370 …hr = ((ABI::Windows::Media::IMediaExtension*)ig_pMediaSink)->SetProperties(DEREF_AS_NATIVE_WRL_OBJ… in startGrabbing()
1371 if (FAILED(hr)) return hr; in startGrabbing()
1372 …WRL_METHOD(imedPrevCap, StartPreviewToCustomSinkAsync, *action, hr, DEREF_WRL_OBJ(pEncProps), rein… in startGrabbing()
1375 return hr; in startGrabbing()
1407 HRESULT hr = pSource->CreatePresentationDescriptor(&pPD); in initImageGrabber() local
1408 if (FAILED(hr)) in initImageGrabber()
1413 hr = pPD->GetStreamDescriptorByIndex(0, &fSelected, &pSD); in initImageGrabber()
1414 if (FAILED(hr)) { in initImageGrabber()
1417 hr = pSD->GetMediaTypeHandler(&pHandler); in initImageGrabber()
1418 if (FAILED(hr)) { in initImageGrabber()
1422 hr = pHandler->GetMediaTypeCount(&cTypes); in initImageGrabber()
1423 if (FAILED(hr)) { in initImageGrabber()
1428 hr = pHandler->GetCurrentMediaType(&pCurrentType); in initImageGrabber()
1429 if (FAILED(hr)) { in initImageGrabber()
1435 CHECK_HR(hr); in initImageGrabber()
1436 CHECK_HR(hr = RawImage::CreateInstance(&ig_RIFirst, MT.MF_MT_SAMPLE_SIZE)); in initImageGrabber()
1437 CHECK_HR(hr = RawImage::CreateInstance(&ig_RISecond, MT.MF_MT_SAMPLE_SIZE)); in initImageGrabber()
1442 CHECK_HR(hr = MFCreateMediaType(pType.GetAddressOf())); in initImageGrabber()
1443 CHECK_HR(hr = pType->SetGUID(MF_MT_MAJOR_TYPE, MT.MF_MT_MAJOR_TYPE)); in initImageGrabber()
1444 CHECK_HR(hr = pType->SetGUID(MF_MT_SUBTYPE, MT.MF_MT_SUBTYPE)); in initImageGrabber()
1446 … CHECK_HR(hr = MFCreateSampleGrabberSinkActivate(pType.Get(), this, pSinkActivate.GetAddressOf())); in initImageGrabber()
1448 CHECK_HR(hr = pSinkActivate->SetUINT32(MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, TRUE)); in initImageGrabber()
1450 CHECK_HR(hr = MFCreateMediaSession(NULL, &ig_pSession)); in initImageGrabber()
1452 CHECK_HR(hr = CreateTopology(pSource, pSinkActivate.Get(), &ig_pTopology)); in initImageGrabber()
1455 if (FAILED(hr)) in initImageGrabber()
1464 return hr; in initImageGrabber()
1478 HRESULT hr = ig_pSession->SetTopology(0, ig_pTopology); in startGrabbing() local
1480 hr = ig_pSession->Start(&GUID_NULL, &var); in startGrabbing()
1487 hr = ig_pSession->GetEvent(0, &pEvent); in startGrabbing()
1488 if(!SUCCEEDED(hr)) in startGrabbing()
1490 hr = S_OK; in startGrabbing()
1493 hr = pEvent->GetStatus(&hrStatus); in startGrabbing()
1494 if(!SUCCEEDED(hr)) in startGrabbing()
1496 hr = S_OK; in startGrabbing()
1499 hr = pEvent->GetType(&met); in startGrabbing()
1500 if(!SUCCEEDED(hr)) in startGrabbing()
1502 hr = S_OK; in startGrabbing()
1535 return hr; in startGrabbing()
1554 HRESULT hr = S_OK; in CreateTopology() local
1556 CHECK_HR(hr = MFCreateTopology(&pTopology)); in CreateTopology()
1557 CHECK_HR(hr = pSource->CreatePresentationDescriptor(pPD.GetAddressOf())); in CreateTopology()
1558 CHECK_HR(hr = pPD->GetStreamDescriptorCount(&cStreams)); in CreateTopology()
1564 CHECK_HR(hr = pPD->GetStreamDescriptorByIndex(i, &fSelected, &pSD)); in CreateTopology()
1565 CHECK_HR(hr = pSD->GetMediaTypeHandler(&pHandler)); in CreateTopology()
1566 CHECK_HR(hr = pHandler->GetMajorType(&majorType)); in CreateTopology()
1569 … CHECK_HR(hr = AddSourceNode(pTopology, pSource, pPD.Get(), pSD.Get(), pNode1.GetAddressOf())); in CreateTopology()
1570 CHECK_HR(hr = AddOutputNode(pTopology, pSinkActivate, 0, pNode2.GetAddressOf())); in CreateTopology()
1571 CHECK_HR(hr = pNode1->ConnectOutput(0, pNode2.Get(), 0)); in CreateTopology()
1576 CHECK_HR(hr = pPD->DeselectStream(i)); in CreateTopology()
1583 return hr; in CreateTopology()
1594 HRESULT hr = S_OK; in AddSourceNode() local
1595 CHECK_HR(hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, pNode.GetAddressOf())); in AddSourceNode()
1596 CHECK_HR(hr = pNode->SetUnknown(MF_TOPONODE_SOURCE, pSource)); in AddSourceNode()
1597 CHECK_HR(hr = pNode->SetUnknown(MF_TOPONODE_PRESENTATION_DESCRIPTOR, pPD)); in AddSourceNode()
1598 CHECK_HR(hr = pNode->SetUnknown(MF_TOPONODE_STREAM_DESCRIPTOR, pSD)); in AddSourceNode()
1599 CHECK_HR(hr = pTopology->AddNode(pNode.Get())); in AddSourceNode()
1605 return hr; in AddSourceNode()
1615 HRESULT hr = S_OK; in AddOutputNode() local
1616 CHECK_HR(hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, pNode.GetAddressOf())); in AddOutputNode()
1617 CHECK_HR(hr = pNode->SetObject(pActivate)); in AddOutputNode()
1618 CHECK_HR(hr = pNode->SetUINT32(MF_TOPONODE_STREAMID, dwId)); in AddOutputNode()
1619 CHECK_HR(hr = pNode->SetUINT32(MF_TOPONODE_NOSHUTDOWN_ON_REMOVE, FALSE)); in AddOutputNode()
1620 CHECK_HR(hr = pTopology->AddNode(pNode.Get())); in AddOutputNode()
1626 return hr; in AddOutputNode()
1642 HRESULT hr = E_NOINTERFACE; in QueryInterface() local
1647 hr = S_OK; in QueryInterface()
1652 hr = S_OK; in QueryInterface()
1654 if(SUCCEEDED(hr)) in QueryInterface()
1658 return hr; in QueryInterface()
1792 HRESULT hr = ImageGrabber::CreateInstance(&igt_pImageGrabber, deviceID, synchronious); in ImageGrabberThread() local
1794 if(SUCCEEDED(hr)) in ImageGrabberThread()
1796 hr = igt_pImageGrabber->initImageGrabber(pSource); in ImageGrabberThread()
1797 if(!SUCCEEDED(hr)) in ImageGrabberThread()
1854 HRESULT hr = igt_pImageGrabber->startGrabbing(); in run() local
1855 if(!SUCCEEDED(hr)) in run()
1883 HRESULT hr = MFStartup(MF_VERSION); in Media_Foundation() local
1884 if(!SUCCEEDED(hr)) in Media_Foundation()
1892 HRESULT hr = MFShutdown(); in ~Media_Foundation() local
1893 if(!SUCCEEDED(hr)) in ~Media_Foundation()
1901 HRESULT hr = S_OK; in buildListOfDevices() local
1904 hr = vDs->initDevices(WRL_ENUM_GET(_DeviceClass, DeviceClass, VideoCapture)); in buildListOfDevices()
1908 hr = MFCreateAttributes(pAttributes.GetAddressOf(), 1); in buildListOfDevices()
1909 if (SUCCEEDED(hr)) in buildListOfDevices()
1911 hr = pAttributes->SetGUID( in buildListOfDevices()
1916 if (SUCCEEDED(hr)) in buildListOfDevices()
1919 hr = vDs->initDevices(pAttributes.Get()); in buildListOfDevices()
1922 if (FAILED(hr)) in buildListOfDevices()
1927 return (SUCCEEDED(hr)); in buildListOfDevices()
2007 HRESULT hr = vd_pSource->QueryInterface(IID_PPV_ARGS(&pProcAmp)); in setParametrs() local
2008 if (SUCCEEDED(hr)) in setParametrs()
2013 … hr = pProcAmp->Set(VideoProcAmp_Brightness + i, pParametr[i].CurrentValue, pParametr[i].Flag); in setParametrs()
2018 hr = vd_pSource->QueryInterface(IID_PPV_ARGS(&pProcControl)); in setParametrs()
2019 if (SUCCEEDED(hr)) in setParametrs()
2024 …hr = pProcControl->Set(CameraControl_Pan+i, pParametr[10 + i].CurrentValue, pParametr[10 + i].Flag… in setParametrs()
2042 HRESULT hr = vd_pSource->QueryInterface(IID_PPV_ARGS(&pProcAmp)); in getParametrs() local
2043 if (SUCCEEDED(hr)) in getParametrs()
2048 …hr = pProcAmp->GetRange(VideoProcAmp_Brightness+i, &temp.Min, &temp.Max, &temp.Step, &temp.Default… in getParametrs()
2049 if (SUCCEEDED(hr)) in getParametrs()
2058 hr = vd_pSource->QueryInterface(IID_PPV_ARGS(&pProcControl)); in getParametrs()
2059 if (SUCCEEDED(hr)) in getParametrs()
2064 …hr = pProcControl->GetRange(CameraControl_Pan+i, &temp.Min, &temp.Max, &temp.Step, &temp.Default, … in getParametrs()
2065 if (SUCCEEDED(hr)) in getParametrs()
2084 HRESULT hr = E_FAIL; in resetDevice() local
2092 ACTIVATE_OBJ(RuntimeClass_Windows_Media_Capture_MediaCapture, _MediaCapture, pIMedCap, hr) in resetDevice()
2093 if (FAILED(hr)) return hr; in resetDevice()
2094 …a_Capture_MediaCaptureInitializationSettings, _MediaCaptureInitializationSettings, pCapInitSet, hr) in resetDevice()
2095 if (FAILED(hr)) return hr; in resetDevice()
2097 WRL_PROP_GET(pDevice, Name, *REF_WRL_OBJ(str), hr) in resetDevice()
2098 if (FAILED(hr)) return hr; in resetDevice()
2103 WRL_PROP_GET(pDevice, Id, *REF_WRL_OBJ(str), hr) in resetDevice()
2104 if (FAILED(hr)) return hr; in resetDevice()
2105 WRL_PROP_PUT(pCapInitSet, VideoDeviceId, DEREF_WRL_OBJ(str), hr) in resetDevice()
2106 if (FAILED(hr)) return hr; in resetDevice()
2107 …nitSet, StreamingCaptureMode, WRL_ENUM_GET(_StreamingCaptureMode, StreamingCaptureMode, Video), hr) in resetDevice()
2108 if (FAILED(hr)) return hr; in resetDevice()
2110 …WRL_METHOD(DEREF_WRL_OBJ(pIMedCap), _InitializeWithSettingsAsync, pAction, hr, DEREF_WRL_OBJ(pCapI… in resetDevice()
2113 if (FAILED(hr)) return hr; in resetDevice()
2120 HRESULT hr = S_OK; in resetDevice()
2123 if (SUCCEEDED(hr)) { in resetDevice()
2125 BEGIN_CALL_IN_CONTEXT(hr, context, pAgileMedCap, this) in resetDevice()
2131 END_CREATE_ASYNC(hr)); in resetDevice()
2138 hr = pActivate->GetAllocatedString( in resetDevice()
2143 hr = pActivate->ActivateObject( in resetDevice()
2150 if(FAILED(hr)) in resetDevice()
2157 return hr; in resetDevice()
2163 HRESULT hr = -1; in readInfoOfDevice() local
2165 hr = resetDevice(pDevice); in readInfoOfDevice()
2166 return hr; in readInfoOfDevice()
2180 HRESULT hr = S_OK; in checkDevice() local
2181 …ndows_Devices_Enumeration_DeviceInformation, MAKE_WRL_OBJ(_DeviceInformationStatics), pDevStat, hr) in checkDevice()
2182 if (FAILED(hr)) return hr; in checkDevice()
2184 WRL_METHOD(pDevStat, _FindAllAsyncDeviceClass, pAction, hr, devClass) in checkDevice()
2185 if (SUCCEEDED(hr)) { in checkDevice()
2187 HRESULT hr = S_OK; in checkDevice()
2191 if (SUCCEEDED(hr)) WRL_PROP_GET(pVector, Size, count, hr) in checkDevice()
2192 if (SUCCEEDED(hr) && count > 0) { in checkDevice()
2195 WRL_METHOD(pVector, GetAt, pDevice, hr, i) in checkDevice()
2196 if (SUCCEEDED(hr)) { in checkDevice()
2199 WRL_PROP_GET(pDevice, Name, *REF_WRL_OBJ(str), hr) in checkDevice()
2210 return hr; in checkDevice()
2219 HRESULT hr = MFEnumDeviceSources(pAttributes, &ppDevices, &count); in checkDevice() local
2220 if (SUCCEEDED(hr)) in checkDevice()
2226 hr = ppDevices[vd_CurrentNumber]->GetAllocatedString( in checkDevice()
2231 if (SUCCEEDED(hr)) in checkDevice()
2236 hr = E_INVALIDARG; in checkDevice()
2253 hr = E_INVALIDARG; in checkDevice()
2262 hr = E_FAIL; in checkDevice()
2268 return hr; in checkDevice()
2274 HRESULT hr = S_OK; in initDevice() local
2282 HRESULT hr; in initDevice()
2286 …hr = checkDevice(WRL_ENUM_GET(_DeviceClass, DeviceClass, VideoCapture), &pTask, REF_WRL_OBJ(pDevIn… in initDevice()
2287 if (SUCCEEDED(hr)) pTask.wait(); in initDevice()
2288 if (SUCCEEDED(hr)) { in initDevice()
2290 BEGIN_CALL_IN_CONTEXT(hr, context, pDevInfo, &_task, context, this) in initDevice()
2291 HRESULT hr; in initDevice()
2292 … ACTIVATE_OBJ(RuntimeClass_Windows_Media_Capture_MediaCapture, _MediaCapture, pIMedCap, hr) in initDevice()
2293 if (SUCCEEDED(hr)) { in initDevice()
2296 …a_Capture_MediaCaptureInitializationSettings, _MediaCaptureInitializationSettings, pCapInitSet, hr) in initDevice()
2298 if (SUCCEEDED(hr)) { in initDevice()
2299 WRL_PROP_GET(pDevInfo, Id, *REF_WRL_OBJ(str), hr) in initDevice()
2300 if (SUCCEEDED(hr)) { in initDevice()
2301 WRL_PROP_PUT(pCapInitSet, VideoDeviceId, DEREF_WRL_OBJ(str), hr) in initDevice()
2304 if (SUCCEEDED(hr)) in initDevice()
2305 …nitSet, StreamingCaptureMode, WRL_ENUM_GET(_StreamingCaptureMode, StreamingCaptureMode, Video), hr) in initDevice()
2306 …if (SUCCEEDED(hr)) reinterpret_cast<ABI::Windows::Media::Capture::IMediaCapture*>(DEREF_AGILE_WRL_… in initDevice()
2307 HRESULT hr; in initDevice() local
2308 BEGIN_CALL_IN_CONTEXT(hr, context, this) in initDevice()
2311 return hr; in initDevice()
2314 …if (SUCCEEDED(hr)) WRL_METHOD(vd_pMedCap, _InitializeWithSettingsAsync, *REF_WRL_OBJ(pAction), hr,… in initDevice()
2315 … if (SUCCEEDED(hr)) _task = CREATE_TASK DEFINE_RET_TYPE(void)(DEREF_WRL_OBJ(pAction)); in initDevice()
2317 END_CALL_IN_CONTEXT(hr) in initDevice()
2320 END_CREATE_ASYNC(hr)); in initDevice()
2325 hr = MFCreateAttributes(pAttributes.GetAddressOf(), 1); in initDevice()
2326 if (SUCCEEDED(hr)) in initDevice()
2328 hr = pAttributes->SetGUID( in initDevice()
2333 if (SUCCEEDED(hr)) in initDevice()
2335 hr = checkDevice(pAttributes.Get(), &vd_pActivate); in initDevice()
2336 if (SUCCEEDED(hr) && vd_pActivate) in initDevice()
2339 hr = vd_pActivate->ActivateObject( in initDevice()
2343 if (SUCCEEDED(hr)) in initDevice()
2358 return hr; in initDevice()
2394 HRESULT hr = S_OK; in closeDevice()
2403 END_CREATE_ASYNC(hr)); in closeDevice()
2541 HRESULT hr; in setDeviceFormat() local
2543 WRL_PROP_GET(pSource, VideoDeviceController, pDevCont, hr) in setDeviceFormat()
2544 if (FAILED(hr)) return hr; in setDeviceFormat()
2545 GET_WRL_OBJ_FROM_OBJ(_MediaDeviceController, pMedDevCont, pDevCont, hr) in setDeviceFormat()
2546 if (FAILED(hr)) return hr; in setDeviceFormat()
2548 …WRL_METHOD(pMedDevCont, GetAvailableMediaStreamProperties, pVector, hr, WRL_ENUM_GET(_MediaStreamT… in setDeviceFormat()
2549 if (FAILED(hr)) return hr; in setDeviceFormat()
2551 WRL_METHOD(pVector, GetAt, pMedEncProps, hr, dwFormatIndex) in setDeviceFormat()
2552 if (FAILED(hr)) return hr; in setDeviceFormat()
2553 …WRL_METHOD(pMedDevCont, SetMediaStreamPropertiesAsync, *pAction, hr, WRL_ENUM_GET(_MediaStreamType… in setDeviceFormat()
2554 return hr; in setDeviceFormat()
2564 HRESULT hr = pSource->CreatePresentationDescriptor(pPD.GetAddressOf()); in setDeviceFormat() local
2565 if (FAILED(hr)) in setDeviceFormat()
2570 hr = pPD->GetStreamDescriptorByIndex(0, &fSelected, pSD.GetAddressOf()); in setDeviceFormat()
2571 if (FAILED(hr)) in setDeviceFormat()
2575 hr = pSD->GetMediaTypeHandler(pHandler.GetAddressOf()); in setDeviceFormat()
2576 if (FAILED(hr)) in setDeviceFormat()
2580 hr = pHandler->GetMediaTypeByIndex((DWORD)dwFormatIndex, pType.GetAddressOf()); in setDeviceFormat()
2581 if (FAILED(hr)) in setDeviceFormat()
2585 hr = pHandler->SetCurrentMediaType(pType.Get()); in setDeviceFormat()
2588 return hr; in setDeviceFormat()
2634 HRESULT hr = S_OK; in isFrameNew()
2637 END_CREATE_ASYNC(hr)); in isFrameNew()
2642 … HRESULT hr = ImageGrabberThread::CreateInstance(&vd_pImGrTh, vd_pSource, vd_CurrentNumber); in isFrameNew() local
2643 if(FAILED(hr)) in isFrameNew()
2678 HRESULT hr = initDevice(); in setupDevice() local
2679 if(SUCCEEDED(hr)) in setupDevice()
2687 HRESULT hr; in setupDevice()
2699 BEGIN_CALL_IN_CONTEXT(hr, context, id, &_task, this) in setupDevice()
2701 … HRESULT hr = setDeviceFormat(DEREF_AGILE_WRL_OBJ(vd_pMedCap), (DWORD) id, &pAction); in setupDevice()
2702 if (SUCCEEDED(hr)) _task = CREATE_TASK DEFINE_RET_TYPE(void)(pAction); in setupDevice()
2703 END_CALL_IN_CONTEXT(hr) in setupDevice()
2704 if (SUCCEEDED(hr)) _task.wait(); in setupDevice()
2708 hr = setDeviceFormat(vd_pSource, (DWORD) id); in setupDevice()
2709 vd_IsSetuped = (SUCCEEDED(hr)); in setupDevice()
2715 END_CREATE_ASYNC(hr)); in setupDevice()
2763 HRESULT hr; in enumerateCaptureFormats() local
2765 WRL_PROP_GET(pSource, VideoDeviceController, pDevCont, hr) in enumerateCaptureFormats()
2766 if (FAILED(hr)) return hr; in enumerateCaptureFormats()
2767 GET_WRL_OBJ_FROM_OBJ(_MediaDeviceController, pMedDevCont, pDevCont, hr) in enumerateCaptureFormats()
2768 if (FAILED(hr)) return hr; in enumerateCaptureFormats()
2770 …WRL_METHOD(pMedDevCont, GetAvailableMediaStreamProperties, pVector, hr, WRL_ENUM_GET(_MediaStreamT… in enumerateCaptureFormats()
2771 if (FAILED(hr)) return hr; in enumerateCaptureFormats()
2773 WRL_PROP_GET(pVector, Size, count, hr) in enumerateCaptureFormats()
2774 if (FAILED(hr)) return hr; in enumerateCaptureFormats()
2777 WRL_METHOD(pVector, GetAt, pMedEncProps, hr, i) in enumerateCaptureFormats()
2778 if (FAILED(hr)) return hr; in enumerateCaptureFormats()
2780 …hr = MediaSink::ConvertPropertiesToMediaType(DEREF_AS_NATIVE_WRL_OBJ(ABI::Windows::Media::MediaPro… in enumerateCaptureFormats()
2781 if (FAILED(hr)) return hr; in enumerateCaptureFormats()
2785 return hr; in enumerateCaptureFormats()
2795 HRESULT hr = pSource->CreatePresentationDescriptor(pPD.GetAddressOf()); in enumerateCaptureFormats() local
2796 if (FAILED(hr)) in enumerateCaptureFormats()
2801 hr = pPD->GetStreamDescriptorByIndex(0, &fSelected, pSD.GetAddressOf()); in enumerateCaptureFormats()
2802 if (FAILED(hr)) in enumerateCaptureFormats()
2806 hr = pSD->GetMediaTypeHandler(pHandler.GetAddressOf()); in enumerateCaptureFormats()
2807 if (FAILED(hr)) in enumerateCaptureFormats()
2812 hr = pHandler->GetMediaTypeCount(&cTypes); in enumerateCaptureFormats()
2813 if (FAILED(hr)) in enumerateCaptureFormats()
2819 hr = pHandler->GetMediaTypeByIndex(i, pType.GetAddressOf()); in enumerateCaptureFormats()
2820 if (FAILED(hr)) in enumerateCaptureFormats()
2829 return hr; in enumerateCaptureFormats()
2868 HRESULT hr = S_OK; in initDevices() local
2869 …ndows_Devices_Enumeration_DeviceInformation, MAKE_WRL_OBJ(_DeviceInformationStatics), pDevStat, hr) in initDevices()
2870 if (FAILED(hr)) return hr; in initDevices()
2872 WRL_METHOD(pDevStat, _FindAllAsyncDeviceClass, pAction, hr, devClass) in initDevices()
2873 if (SUCCEEDED(hr)) { in initDevices()
2877 HRESULT hr = S_OK; in initDevices()
2880 if (SUCCEEDED(hr)) WRL_PROP_GET(pVector, Size, count, hr) in initDevices()
2881 if (SUCCEEDED(hr) && count > 0) { in initDevices()
2885 WRL_METHOD(pVector, GetAt, pDevice, hr, i) in initDevices()
2886 if (SUCCEEDED(hr)) { in initDevices()
2887 BEGIN_CALL_IN_CONTEXT(hr, context, vd, pDevice, i) in initDevices()
2894 END_CREATE_ASYNC(hr)); in initDevices()
2897 return hr; in initDevices()
2904 HRESULT hr = MFEnumDeviceSources(pAttributes, &ppDevices, &count); in initDevices() local
2905 if (SUCCEEDED(hr)) in initDevices()
2919 hr = E_INVALIDARG; in initDevices()
2925 return hr; in initDevices()
3660 HRESULT hr; in open() local
3662 BEGIN_CALL_IN_CONTEXT(hr, context, this, try_index) in open()
3670 BEGIN_CALL_IN_CONTEXT(hr, context, this, try_index) in open()
3671 HRESULT hr = S_OK; in open()
3676 hr = E_FAIL; in open()
3827 HRESULT hr = MFCreateSourceResolver(pSourceResolver.GetAddressOf()); in open() local
3829 if (SUCCEEDED(hr)) in open()
3831 hr = pSourceResolver->CreateObjectFromURL( in open()
3841 if (SUCCEEDED(hr)) in open()
3843 hr = pUnkSource->QueryInterface(IID_PPV_ARGS(&videoFileSource)); in open()
3848 if (SUCCEEDED(hr)) in open()
3850 hr = enumerateCaptureFormats(videoFileSource); in open()
3859 if (SUCCEEDED(hr)) in open()
3861 … hr = ImageGrabberThread::CreateInstance(&grabberThread, videoFileSource, (unsigned int)-2, true); in open()
3864 isOpened = SUCCEEDED(hr); in open()
3972 HRESULT hr = pSource->CreatePresentationDescriptor(pPD.GetAddressOf()); in enumerateCaptureFormats() local
3973 if (FAILED(hr)) in enumerateCaptureFormats()
3979 hr = pPD->GetStreamDescriptorByIndex(0, &fSelected, pSD.GetAddressOf()); in enumerateCaptureFormats()
3980 if (FAILED(hr)) in enumerateCaptureFormats()
3984 hr = pSD->GetMediaTypeHandler(pHandler.GetAddressOf()); in enumerateCaptureFormats()
3985 if (FAILED(hr)) in enumerateCaptureFormats()
3990 hr = pHandler->GetMediaTypeCount(&cTypes); in enumerateCaptureFormats()
3991 if (FAILED(hr)) in enumerateCaptureFormats()
3997 hr = pHandler->GetMediaTypeByIndex(i, pType.GetAddressOf()); in enumerateCaptureFormats()
3998 if (FAILED(hr)) in enumerateCaptureFormats()
4009 return hr; in enumerateCaptureFormats()
4018 HRESULT hr = pSource->CreatePresentationDescriptor(&pPD); in getSourceDuration() local
4019 if (SUCCEEDED(hr)) in getSourceDuration()
4021 hr = pPD->GetUINT64(MF_PD_DURATION, (UINT64*)pDuration); in getSourceDuration()
4024 return hr; in getSourceDuration()
4175 HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); in open() local
4176 if (SUCCEEDED(hr)) in open()
4178 hr = MFStartup(MF_VERSION); in open()
4179 if (SUCCEEDED(hr)) in open()
4181 hr = InitializeSinkWriter(filename); in open()
4182 if (SUCCEEDED(hr)) in open()
4191 return SUCCEEDED(hr); in open()
4228 HRESULT hr = WriteFrame(target, rtStart, rtDuration); in writeFrame() local
4229 if (FAILED(hr)) in writeFrame()
4254 HRESULT hr = MFCreateSinkWriterFromURL(unicodeFileName, NULL, spAttr.Get(), &sinkWriter); in InitializeSinkWriter() local
4259 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4261 hr = MFCreateMediaType(&mediaTypeOut); in InitializeSinkWriter()
4263 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4265 hr = mediaTypeOut->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); in InitializeSinkWriter()
4267 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4269 hr = mediaTypeOut->SetGUID(MF_MT_SUBTYPE, encodingFormat); in InitializeSinkWriter()
4271 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4273 hr = mediaTypeOut->SetUINT32(MF_MT_AVG_BITRATE, bitRate); in InitializeSinkWriter()
4275 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4277 hr = mediaTypeOut->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive); in InitializeSinkWriter()
4279 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4281 hr = MFSetAttributeSize(mediaTypeOut.Get(), MF_MT_FRAME_SIZE, videoWidth, videoHeight); in InitializeSinkWriter()
4283 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4285 hr = MFSetAttributeRatio(mediaTypeOut.Get(), MF_MT_FRAME_RATE, (UINT32)fps, 1); in InitializeSinkWriter()
4287 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4289 hr = MFSetAttributeRatio(mediaTypeOut.Get(), MF_MT_PIXEL_ASPECT_RATIO, 1, 1); in InitializeSinkWriter()
4292 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4294 hr = sinkWriter->AddStream(mediaTypeOut.Get(), &streamIndex); in InitializeSinkWriter()
4298 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4300 hr = MFCreateMediaType(&mediaTypeIn); in InitializeSinkWriter()
4302 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4304 hr = mediaTypeIn->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); in InitializeSinkWriter()
4306 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4308 hr = mediaTypeIn->SetGUID(MF_MT_SUBTYPE, inputFormat); in InitializeSinkWriter()
4310 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4312 hr = mediaTypeIn->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive); in InitializeSinkWriter()
4314 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4316 hr = MFSetAttributeSize(mediaTypeIn.Get(), MF_MT_FRAME_SIZE, videoWidth, videoHeight); in InitializeSinkWriter()
4318 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4320 hr = MFSetAttributeRatio(mediaTypeIn.Get(), MF_MT_FRAME_RATE, (UINT32)fps, 1); in InitializeSinkWriter()
4322 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4324 hr = MFSetAttributeRatio(mediaTypeIn.Get(), MF_MT_PIXEL_ASPECT_RATIO, 1, 1); in InitializeSinkWriter()
4327 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4329 hr = sinkWriter->SetInputMediaType(streamIndex, mediaTypeIn.Get(), NULL); in InitializeSinkWriter()
4333 if (SUCCEEDED(hr)) in InitializeSinkWriter()
4335 hr = sinkWriter->BeginWriting(); in InitializeSinkWriter()
4338 return hr; in InitializeSinkWriter()
4352 HRESULT hr = MFCreateMemoryBuffer(cbBuffer, &buffer); in WriteFrame() local
4355 if (SUCCEEDED(hr)) in WriteFrame()
4357 hr = buffer->Lock(&pData, NULL, NULL); in WriteFrame()
4360 if (SUCCEEDED(hr)) in WriteFrame()
4363 hr = MFCopyImage( in WriteFrame()
4372 hr = MFCopyImage( in WriteFrame()
4389 if (SUCCEEDED(hr)) in WriteFrame()
4391 hr = buffer->SetCurrentLength(cbBuffer); in WriteFrame()
4395 if (SUCCEEDED(hr)) in WriteFrame()
4397 hr = MFCreateSample(&sample); in WriteFrame()
4399 if (SUCCEEDED(hr)) in WriteFrame()
4401 hr = sample->AddBuffer(buffer.Get()); in WriteFrame()
4405 if (SUCCEEDED(hr)) in WriteFrame()
4407 hr = sample->SetSampleTime(Start); in WriteFrame()
4409 if (SUCCEEDED(hr)) in WriteFrame()
4411 hr = sample->SetSampleDuration(Duration); in WriteFrame()
4415 if (SUCCEEDED(hr)) in WriteFrame()
4417 hr = sinkWriter->WriteSample(streamIndex, sample.Get()); in WriteFrame()
4420 return hr; in WriteFrame()