@@ -539,16 +539,39 @@ static bool Buddy_CreateEncoder(ScreenBuddy* Buddy, int EncodeWidth, int EncodeH
539
539
MFT_REGISTER_TYPE_INFO Input = { .guidMajorType = MFMediaType_Video , .guidSubtype = MFVideoFormat_NV12 };
540
540
MFT_REGISTER_TYPE_INFO Output = { .guidMajorType = MFMediaType_Video , .guidSubtype = MFVideoFormat_H264 };
541
541
542
+ DXGI_ADAPTER_DESC AdapterDesc ;
543
+ {
544
+ IDXGIDevice * DxgiDevice ;
545
+ HR (ID3D11Device_QueryInterface (Buddy -> Device , & IID_IDXGIDevice , (void * * )& DxgiDevice ));
546
+
547
+ IDXGIAdapter * DxgiAdapter ;
548
+ HR (IDXGIDevice_GetAdapter (DxgiDevice , & DxgiAdapter ));
549
+
550
+ IDXGIAdapter_GetDesc (DxgiAdapter , & AdapterDesc );
551
+
552
+ IDXGIAdapter_Release (DxgiAdapter );
553
+ IDXGIDevice_Release (DxgiDevice );
554
+ }
555
+
556
+ IMFAttributes * EnumAttributes ;
557
+ HR (MFCreateAttributes (& EnumAttributes , 1 ));
558
+ HR (IMFAttributes_SetBlob (EnumAttributes , & MFT_ENUM_ADAPTER_LUID , (UINT8 * )& AdapterDesc .AdapterLuid , sizeof (AdapterDesc .AdapterLuid )));
559
+
542
560
IMFActivate * * Activate ;
543
561
UINT32 ActivateCount ;
544
- HR (MFTEnumEx (MFT_CATEGORY_VIDEO_ENCODER , MFT_ENUM_FLAG_ASYNCMFT | MFT_ENUM_FLAG_HARDWARE | MFT_ENUM_FLAG_SORTANDFILTER , & Input , & Output , & Activate , & ActivateCount ));
562
+ HR (MFTEnum2 (MFT_CATEGORY_VIDEO_ENCODER , MFT_ENUM_FLAG_ASYNCMFT | MFT_ENUM_FLAG_HARDWARE | MFT_ENUM_FLAG_SORTANDFILTER , & Input , & Output , EnumAttributes , & Activate , & ActivateCount ));
563
+ IMFAttributes_Release (EnumAttributes );
545
564
546
565
if (ActivateCount == 0 )
547
566
{
548
- MessageBoxW (Buddy -> DialogWindow , L"Cannot create GPU decoder !" , L"Error" , MB_ICONERROR );
567
+ MessageBoxW (Buddy -> DialogWindow , L"Cannot create GPU encoder !" , L"Error" , MB_ICONERROR );
549
568
return false;
550
569
}
551
570
571
+ //wchar_t Name[256];
572
+ //HR(IMFActivate_GetString(Activate[0], &MFT_FRIENDLY_NAME_Attribute, Name, ARRAYSIZE(Name), NULL));
573
+ //OutputDebugStringW(Name);
574
+
552
575
IMFTransform * Encoder ;
553
576
HR (IMFActivate_ActivateObject (Activate [0 ], & IID_IMFTransform , (void * * )& Encoder ));
554
577
for (UINT32 Index = 0 ; Index < ActivateCount ; Index ++ )
@@ -759,7 +782,7 @@ static bool Buddy_CreateDecoder(ScreenBuddy* Buddy)
759
782
760
783
if (ActivateCount == 0 )
761
784
{
762
- MessageBoxW (Buddy -> DialogWindow , L"Cannot create GPU encoder !" , L"Error" , MB_ICONERROR );
785
+ MessageBoxW (Buddy -> DialogWindow , L"Cannot create GPU decoder !" , L"Error" , MB_ICONERROR );
763
786
return false;
764
787
}
765
788
0 commit comments