3636#include " public/common/AMFFactory.h"
3737#include " public/include/components/VideoDecoderUVD.h"
3838#include " public/include/components/VideoEncoderVCE.h"
39+ #include " public/include/components/VideoEncoderHEVC.h"
3940#include " public/include/components/VideoConverter.h"
4041#include " public/include/core/Context.h"
4142#include " public/include/core/Debug.h"
@@ -173,7 +174,7 @@ bool QueryDecoderForCodec(const wchar_t *componentID, amf::AMFContext* pContext)
173174 }
174175}
175176
176- bool QueryEncoderForCodec (const wchar_t *componentID, amf::AMFContext* pContext)
177+ bool QueryEncoderForCodecAVC (const wchar_t *componentID, amf::AMFContext* pContext)
177178{
178179 std::wcout << L" \t Codec " << componentID << L" \n " ;
179180 amf::AMFCapsPtr encoderCaps;
@@ -237,6 +238,62 @@ bool QueryEncoderForCodec(const wchar_t *componentID, amf::AMFContext* pContext)
237238 }
238239}
239240
241+ bool QueryEncoderForCodecHEVC (const wchar_t *componentID, amf::AMFContext* pContext)
242+ {
243+ std::wcout << L" \t Codec " << componentID << L" \n " ;
244+ amf::AMFCapsPtr encoderCaps;
245+ bool result = false ;
246+
247+ amf::AMFComponentPtr pEncoder;
248+ g_AMFFactory.GetFactory ()->CreateComponent (pContext, componentID, &pEncoder);
249+ if (pEncoder == NULL )
250+ {
251+ std::wcout << AccelTypeToString (amf::AMF_ACCEL_NOT_SUPPORTED) << L" \n " ;
252+ return false ;
253+ }
254+ if (pEncoder->GetCaps (&encoderCaps) == AMF_OK)
255+ {
256+ amf::AMF_ACCELERATION_TYPE accelType = encoderCaps->GetAccelerationType ();
257+ std::wcout << L" \t\t Acceleration Type:" << AccelTypeToString (accelType) << L" \n " ;
258+
259+ amf_uint32 maxProfile = 0 ;
260+ encoderCaps->GetProperty (AMF_VIDEO_ENCODER_HEVC_CAP_MAX_PROFILE, &maxProfile);
261+ std::wcout << L" \t\t maximum profile:" <<maxProfile << L" \n " ;
262+
263+ amf_uint32 maxTier = 0 ;
264+ encoderCaps->GetProperty (AMF_VIDEO_ENCODER_HEVC_CAP_MAX_TIER, &maxTier);
265+ std::wcout << L" \t\t maximum tier:" <<maxTier << L" \n " ;
266+
267+ amf_uint32 maxLevel = 0 ;
268+ encoderCaps->GetProperty (AMF_VIDEO_ENCODER_HEVC_CAP_MAX_LEVEL, &maxLevel);
269+ std::wcout << L" \t\t maximum level:" <<maxLevel << L" \n " ;
270+
271+ amf_uint32 maxNumOfStreams = 0 ;
272+ encoderCaps->GetProperty (AMF_VIDEO_ENCODER_HEVC_CAP_NUM_OF_STREAMS, &maxNumOfStreams);
273+ std::wcout << L" \t\t Max Number of streams supported:" << maxNumOfStreams << L" \n " ;
274+
275+ std::wcout << L" \t\t Encoder input:\n " ;
276+ amf::AMFIOCapsPtr inputCaps;
277+ if (encoderCaps->GetInputCaps (&inputCaps) == AMF_OK)
278+ {
279+ result = QueryIOCaps (inputCaps);
280+ }
281+
282+ std::wcout << L" \t\t Encoder output:\n " ;
283+ amf::AMFIOCapsPtr outputCaps;
284+ if (encoderCaps->GetOutputCaps (&outputCaps) == AMF_OK)
285+ {
286+ result = QueryIOCaps (outputCaps);
287+ }
288+ return true ;
289+ }
290+ else
291+ {
292+ std::wcout << AccelTypeToString (amf::AMF_ACCEL_NOT_SUPPORTED) << L" \n " ;
293+ return false ;
294+ }
295+ }
296+
240297void QueryDecoderCaps (amf::AMFContext* pContext)
241298{
242299 std::wcout << L" Querying video decoder capabilities...\n " ;
@@ -250,7 +307,11 @@ bool QueryEncoderCaps(amf::AMFContext* pContext)
250307{
251308 std::wcout << L" Querying video encoder capabilities...\n " ;
252309
253- return QueryEncoderForCodec (AMFVideoEncoderVCE_AVC, pContext) && QueryEncoderForCodec (AMFVideoEncoderVCE_SVC, pContext);
310+ QueryEncoderForCodecAVC (AMFVideoEncoderVCE_AVC, pContext);
311+ QueryEncoderForCodecAVC (AMFVideoEncoderVCE_SVC, pContext);
312+ QueryEncoderForCodecHEVC (AMFVideoEncoder_HEVC, pContext);
313+
314+ return true ;
254315}
255316
256317bool QueryConverterCaps (amf::AMFContext* pContext)
@@ -300,56 +361,68 @@ int _tmain(int argc, _TCHAR* argv[])
300361
301362 g_AMFFactory.GetDebug ()->AssertsEnable (false );
302363
303- amf::AMFContextPtr pContext;
304- if (g_AMFFactory.GetFactory ()->CreateContext (&pContext) == AMF_OK)
305- {
306- bool deviceInit = false ;
307- int deviceIdx = 0 ;
308- #ifdef _WIN32
364+ for (int deviceIdx = 0 ; ;deviceIdx++)
365+ {
309366
310- OSVERSIONINFO osvi;
311- memset (&osvi, 0 , sizeof (osvi));
312- osvi.dwOSVersionInfoSize = sizeof (osvi);
313- GetVersionEx (&osvi);
314-
315- if (osvi.dwMajorVersion >= 6 )
367+ amf::AMFContextPtr pContext;
368+ if (g_AMFFactory.GetFactory ()->CreateContext (&pContext) == AMF_OK)
316369 {
317- if (osvi.dwMinorVersion >= 2 ) // Win 8 or Win Server 2012 or newer
370+ bool deviceInit = false ;
371+
372+ #ifdef _WIN32
373+
374+ OSVERSIONINFO osvi;
375+ memset (&osvi, 0 , sizeof (osvi));
376+ osvi.dwOSVersionInfoSize = sizeof (osvi);
377+ GetVersionEx (&osvi);
378+
379+ if (osvi.dwMajorVersion >= 6 )
318380 {
319- DeviceDX11 deviceDX11;
320- if (deviceDX11.Init (deviceIdx) == AMF_OK)
381+ if (osvi.dwMinorVersion >= 2 ) // Win 8 or Win Server 2012 or newer
321382 {
322- deviceInit = (pContext->InitDX11 (deviceDX11.GetDevice ()) == AMF_OK);
383+ DeviceDX11 deviceDX11;
384+ if (deviceDX11.Init (deviceIdx) == AMF_OK)
385+ {
386+ deviceInit = (pContext->InitDX11 (deviceDX11.GetDevice ()) == AMF_OK);
387+ }
388+ else
389+ {
390+ break ;
391+ }
323392 }
324- }
325- else
326- {
327- DeviceDX9 deviceDX9;
328- if (deviceDX9.Init (true , deviceIdx, false , 1 , 1 ) == AMF_OK || deviceDX9.Init (false , deviceIdx, false , 1 , 1 ) == AMF_OK) // For DX9 try DX9Ex first and fall back to DX9 if Ex is not available
393+ else
329394 {
330- deviceInit = (pContext->InitDX9 (deviceDX9.GetDevice ()) == AMF_OK);
395+ DeviceDX9 deviceDX9;
396+ if (deviceDX9.Init (true , deviceIdx, false , 1 , 1 ) == AMF_OK || deviceDX9.Init (false , deviceIdx, false , 1 , 1 ) == AMF_OK) // For DX9 try DX9Ex first and fall back to DX9 if Ex is not available
397+ {
398+ deviceInit = (pContext->InitDX9 (deviceDX9.GetDevice ()) == AMF_OK);
399+ }
400+ else
401+ {
402+ break ;
403+ }
331404 }
332405 }
406+ else // Older than Vista - not supported
407+ {
408+ std::wcerr << L" This version of Windows is too old\n " ;
409+ }
410+ #endif
411+ if (deviceInit == true )
412+ {
413+ QueryDecoderCaps (pContext);
414+ QueryEncoderCaps (pContext);
415+ QueryConverterCaps (pContext);
416+ result = true ;
417+ }
333418 }
334- else // Older than Vista - not supported
335- {
336- std::wcerr << L" This version of Windows is too old\n " ;
337- }
338- #endif
339- if (deviceInit == true )
419+ else
340420 {
341- QueryDecoderCaps (pContext);
342- QueryEncoderCaps (pContext);
343- QueryConverterCaps (pContext);
344- result = true ;
421+ std::wcerr << L" Failed to instatiate Capability Manager.\n " ;
422+ return -1 ;
345423 }
424+ pContext.Release ();
346425 }
347- else
348- {
349- std::wcerr << L" Failed to instatiate Capability Manager.\n " ;
350- return -1 ;
351- }
352- pContext.Release ();
353426 g_AMFFactory.Terminate ();
354427 return result ? 0 : 1 ;
355428}
0 commit comments