@@ -904,39 +904,63 @@ FUNCTION(mfxStatus, MFXGetPriority, (mfxSession session, mfxPriority *priority),
904904
905905#undef FUNCTION
906906
907+ #ifdef MFX_HAVE_LINUX
907908static void init_internal_hwctx (mfxSession session)
908909{
909- #ifdef MFX_HAVE_LINUX
910910 MFX_DISP_HANDLE *pHandle = (MFX_DISP_HANDLE *) session;
911911 if (!pHandle->got_user_hwctx && !pHandle->tried_internal_hwctx ) {
912912 void *handle = mfx_allocate_va (session);
913913 if (handle)
914914 pHandle->internal_hwctx = handle;
915915 pHandle->tried_internal_hwctx = 1 ;
916916 }
917- #endif
918917}
919918
920- #define FUNCTION (return_value, func_name, formal_param_list, actual_param_list ) \
921- return_value DISPATCHER_EXPOSED_PREFIX (func_name) formal_param_list \
922- { \
923- mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; \
924- MFX_DISP_HANDLE *pHandle = (MFX_DISP_HANDLE *) session; \
925- /* get the function's address and make a call */ \
926- if (pHandle) \
927- { \
928- mfxFunctionPointer pFunc = pHandle->callTable [e##func_name]; \
929- init_internal_hwctx (session); \
930- if (pFunc) \
931- { \
932- /* get the real session pointer */ \
933- session = pHandle->session ; \
934- /* pass down the call */ \
935- mfxRes = (*(mfxStatus (MFX_CDECL *) formal_param_list) pFunc) actual_param_list; \
936- } \
937- } \
938- return mfxRes; \
939- }
919+ #define FUNCTION (return_value, func_name, formal_param_list, actual_param_list ) \
920+ return_value DISPATCHER_EXPOSED_PREFIX (func_name) formal_param_list \
921+ { \
922+ mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; \
923+ MFX_DISP_HANDLE *pHandle = (MFX_DISP_HANDLE *)session; \
924+ /* get the function's address and make a call */ \
925+ if (pHandle) \
926+ { \
927+ mfxFunctionPointer pFunc = pHandle->callTable [e ## func_name]; \
928+ if (pFunc) \
929+ { \
930+ if (eMFXVideoCORE_SetHandle == e ## func_name) \
931+ pHandle->got_user_hwctx = 1 ; \
932+ else \
933+ init_internal_hwctx (session); \
934+ /* get the real session pointer */ \
935+ session = pHandle->session ; \
936+ /* pass down the call */ \
937+ mfxRes = (*(mfxStatus (MFX_CDECL *) formal_param_list)pFunc)actual_param_list; \
938+ } \
939+ } \
940+ return mfxRes; \
941+ }
942+ #else
943+
944+ #define FUNCTION (return_value, func_name, formal_param_list, actual_param_list ) \
945+ return_value DISPATCHER_EXPOSED_PREFIX (func_name) formal_param_list \
946+ { \
947+ mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; \
948+ MFX_DISP_HANDLE *pHandle = (MFX_DISP_HANDLE *)session; \
949+ /* get the function's address and make a call */ \
950+ if (pHandle) \
951+ { \
952+ mfxFunctionPointer pFunc = pHandle->callTable [e ## func_name]; \
953+ if (pFunc) \
954+ { \
955+ /* get the real session pointer */ \
956+ session = pHandle->session ; \
957+ /* pass down the call */ \
958+ mfxRes = (*(mfxStatus (MFX_CDECL *) formal_param_list)pFunc)actual_param_list; \
959+ } \
960+ } \
961+ return mfxRes; \
962+ }
963+ #endif
940964
941965#include " mfx_exposed_functions_list.h"
942966#undef FUNCTION
0 commit comments