From 61807e192749af236df520625ee284e221a20ef2 Mon Sep 17 00:00:00 2001 From: Artem Galin Date: Thu, 4 Jun 2020 21:39:07 +0100 Subject: [PATCH] API 1.32 multi adapter support fixes adds `MFX_PROFILE_HEVC_SCC` --- configure.ac | 2 +- mfx/mfxdefs.h | 4 ++-- mfx/mfxstructures.h | 5 +++- src/main.cpp | 4 ++-- src/mfx_dispatcher.cpp | 51 ++++++++++++++++++++++++++++++---------- src/mfx_dispatcher_log.h | 6 ++++- src/mfx_load_plugin.h | 2 +- 7 files changed, 53 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index c6f07cb..f675420 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.53]) -AC_INIT([libmfx], [1.31]) +AC_INIT([libmfx], [1.32]) AC_CONFIG_SRCDIR([src/mfx_dispatcher.cpp]) AM_INIT_AUTOMAKE([foreign subdir-objects]) diff --git a/mfx/mfxdefs.h b/mfx/mfxdefs.h index f8007ed..cbb75aa 100644 --- a/mfx/mfxdefs.h +++ b/mfx/mfxdefs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2019 Intel Corporation +// Copyright (c) 2019-2020 Intel Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -21,7 +21,7 @@ #define __MFXDEFS_H__ #define MFX_VERSION_MAJOR 1 -#define MFX_VERSION_MINOR 31 +#define MFX_VERSION_MINOR 32 // MFX_VERSION_NEXT is always +1 from last public release // may be enforced by MFX_VERSION_USE_LATEST define diff --git a/mfx/mfxstructures.h b/mfx/mfxstructures.h index 40b79b0..a9eb8e4 100644 --- a/mfx/mfxstructures.h +++ b/mfx/mfxstructures.h @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2019 Intel Corporation +// Copyright (c) 2018-2020 Intel Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -471,6 +471,9 @@ enum { MFX_PROFILE_HEVC_MAIN10 =2, MFX_PROFILE_HEVC_MAINSP =3, MFX_PROFILE_HEVC_REXT =4, +#if (MFX_VERSION >= 1032) + MFX_PROFILE_HEVC_SCC =9, +#endif MFX_LEVEL_HEVC_1 = 10, MFX_LEVEL_HEVC_2 = 20, diff --git a/src/main.cpp b/src/main.cpp index 44a366f..d2c84b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2019 Intel Corporation +// Copyright (c) 2012-2020 Intel Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -951,7 +951,7 @@ mfxStatus MFXJoinSession(mfxSession session, mfxSession child_session) MFX_DISP_HANDLE *pChildHandle = (MFX_DISP_HANDLE *)child_session; // get the function's address and make a call - if ((pHandle) && (pChildHandle) && (pHandle->apiVersion == pChildHandle->apiVersion)) + if ((pHandle) && (pChildHandle) && (pHandle->actualApiVersion == pChildHandle->actualApiVersion)) { /* check whether it is audio session or video */ int tableIndex = eMFXJoinSession; diff --git a/src/mfx_dispatcher.cpp b/src/mfx_dispatcher.cpp index 92d054e..163f53e 100644 --- a/src/mfx_dispatcher.cpp +++ b/src/mfx_dispatcher.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2019 Intel Corporation +// Copyright (c) 2012-2020 Intel Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -488,7 +488,7 @@ mfxStatus MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAd mfxStatus sts = InitDummySession(adapter_n - 1, dummy_session); if (sts != MFX_ERR_NONE) { - return sts; + continue; } mfxVideoParam stream_params, out; @@ -498,12 +498,9 @@ mfxStatus MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAd sts = MFXVideoDECODE_DecodeHeader(dummy_session.operator mfxSession(), bitstream, &stream_params); - if (sts == MFX_ERR_UNSUPPORTED) // Unsupported CodecId, try another adapter - continue; - if (sts != MFX_ERR_NONE) { - return sts; + continue; } sts = MFXVideoDECODE_Query(dummy_session.operator mfxSession(), &stream_params, &out); @@ -513,14 +510,28 @@ mfxStatus MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAd mfxAdapterInfo info; memset(&info, 0, sizeof(info)); - sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform); + //WA for initialization when application built w/ new API, but lib w/ old one. + mfxVersion apiVersion; + sts = dummy_session.QueryVersion(&apiVersion); if (sts != MFX_ERR_NONE) + continue; + + if (apiVersion.Major >= 1 && apiVersion.Minor >= 19) { - return sts; + sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform); + + if (sts != MFX_ERR_NONE) + { + continue; + } + } + else + { + // for API versions greater than 1.19 Device id is set inside QueryPlatform call + info.Platform.DeviceId = static_cast(DeviceID); } - //info.Platform.DeviceId = DeviceID; info.Number = adapter_n - 1; obtained_info.push_back(info); @@ -555,7 +566,7 @@ mfxStatus MFXQueryAdapters(mfxComponentInfo* input_info, mfxAdaptersInfo* adapte mfxStatus sts = InitDummySession(adapter_n - 1, dummy_session); if (sts != MFX_ERR_NONE) { - return sts; + continue; } // If input_info is NULL just return all Intel adapters and information about them @@ -595,14 +606,28 @@ mfxStatus MFXQueryAdapters(mfxComponentInfo* input_info, mfxAdaptersInfo* adapte mfxAdapterInfo info; memset(&info, 0, sizeof(info)); - sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform); + //WA for initialization when application built w/ new API, but lib w/ old one. + mfxVersion apiVersion; + sts = dummy_session.QueryVersion(&apiVersion); if (sts != MFX_ERR_NONE) + continue; + + if (apiVersion.Major >= 1 && apiVersion.Minor >= 19) + { + sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform); + + if (sts != MFX_ERR_NONE) + { + continue; + } + } + else { - return sts; + // for API versions greater than 1.19 Device id is set inside QueryPlatform call + info.Platform.DeviceId = static_cast(DeviceID); } - //info.Platform.DeviceId = DeviceID; info.Number = adapter_n - 1; obtained_info.push_back(info); diff --git a/src/mfx_dispatcher_log.h b/src/mfx_dispatcher_log.h index 2b58731..5052a97 100644 --- a/src/mfx_dispatcher_log.h +++ b/src/mfx_dispatcher_log.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2019 Intel Corporation +// Copyright (c) 2012-2020 Intel Corporation // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -254,6 +254,10 @@ class FileSink friend class DSSingleTone; public: virtual void Write(int level, int opcode, const char * msg, va_list argptr); + FileSink() + : m_hdl(NULL) + { + } ~FileSink() { if (NULL != m_hdl) diff --git a/src/mfx_load_plugin.h b/src/mfx_load_plugin.h index 29f0497..43e1ea4 100644 --- a/src/mfx_load_plugin.h +++ b/src/mfx_load_plugin.h @@ -51,7 +51,7 @@ namespace MFX PluginModule module; mfxPlugin plugin; FactoryRecord () - : plugin() + : plgParams(), plugin() {} FactoryRecord(const mfxPluginParam &plgParams, PluginModule &module,