mfx_plugin_hive.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* ****************************************************************************** *\
  2. Copyright (C) 2013-2018 Intel Corporation. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. - Redistributions of source code must retain the above copyright notice,
  6. this list of conditions and the following disclaimer.
  7. - Redistributions in binary form must reproduce the above copyright notice,
  8. this list of conditions and the following disclaimer in the documentation
  9. and/or other materials provided with the distribution.
  10. - Neither the name of Intel Corporation nor the names of its contributors
  11. may be used to endorse or promote products derived from this software
  12. without specific prior written permission.
  13. THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
  14. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  15. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  16. IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
  17. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  18. NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  19. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  20. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  22. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. File Name: mfx_plugin_hive.h
  24. \* ****************************************************************************** */
  25. #pragma once
  26. #include "mfx_dispatcher_defs.h"
  27. #include "mfxplugin.h"
  28. #include "mfx_win_reg_key.h"
  29. #include "mfx_vector.h"
  30. #include <string.h>
  31. #include <memory>
  32. #include <stdio.h>
  33. struct MFX_DISP_HANDLE;
  34. namespace MFX {
  35. inline bool operator == (const mfxPluginUID &lhs, const mfxPluginUID & rhs)
  36. {
  37. return !memcmp(lhs.Data, rhs.Data, sizeof(mfxPluginUID));
  38. }
  39. inline bool operator != (const mfxPluginUID &lhs, const mfxPluginUID & rhs)
  40. {
  41. return !(lhs == rhs);
  42. }
  43. #ifdef _WIN32
  44. //warning C4351: new behavior: elements of array 'MFX::PluginDescriptionRecord::sName' will be default initialized
  45. #pragma warning (disable: 4351)
  46. #endif
  47. class PluginDescriptionRecord : public mfxPluginParam
  48. {
  49. public:
  50. msdk_disp_char sPath[MAX_PLUGIN_PATH];
  51. char sName[MAX_PLUGIN_NAME];
  52. //used for FS plugins that has poor description
  53. bool onlyVersionRegistered;
  54. bool Default;
  55. PluginDescriptionRecord()
  56. : mfxPluginParam()
  57. , sPath()
  58. , sName()
  59. , onlyVersionRegistered()
  60. , Default()
  61. {
  62. }
  63. };
  64. typedef MFXVector<PluginDescriptionRecord> MFXPluginStorage;
  65. class MFXPluginStorageBase : public MFXPluginStorage
  66. {
  67. protected:
  68. mfxVersion mCurrentAPIVersion;
  69. protected:
  70. MFXPluginStorageBase(mfxVersion currentAPIVersion)
  71. : mCurrentAPIVersion(currentAPIVersion)
  72. {
  73. }
  74. void ConvertAPIVersion( mfxU32 APIVersion, PluginDescriptionRecord &descriptionRecord) const
  75. {
  76. descriptionRecord.APIVersion.Minor = static_cast<mfxU16> (APIVersion & 0x0ff);
  77. descriptionRecord.APIVersion.Major = static_cast<mfxU16> (APIVersion >> 8);
  78. }
  79. };
  80. //populated from registry
  81. class MFXPluginsInHive : public MFXPluginStorageBase
  82. {
  83. public:
  84. MFXPluginsInHive(int mfxStorageID, const msdk_disp_char *msdkLibSubKey, mfxVersion currentAPIVersion);
  85. };
  86. #if defined(MEDIASDK_USE_CFGFILES) || (!defined(MEDIASDK_UWP_LOADER) && !defined(MEDIASDK_UWP_PROCTABLE))
  87. //plugins are loaded from FS close to executable
  88. class MFXPluginsInFS : public MFXPluginStorageBase
  89. {
  90. bool mIsVersionParsed;
  91. bool mIsAPIVersionParsed;
  92. public:
  93. MFXPluginsInFS(mfxVersion currentAPIVersion);
  94. private:
  95. bool ParseFile(FILE * f, PluginDescriptionRecord & des);
  96. bool ParseKVPair( msdk_disp_char *key, msdk_disp_char * value, PluginDescriptionRecord & des);
  97. };
  98. #endif //#if defined(MEDIASDK_USE_CFGFILES) || (!defined(MEDIASDK_UWP_LOADER) && !defined(MEDIASDK_UWP_PROCTABLE))
  99. //plugins are loaded from FS close to Runtime library
  100. class MFXDefaultPlugins : public MFXPluginStorageBase
  101. {
  102. public:
  103. MFXDefaultPlugins(mfxVersion currentAPIVersion, MFX_DISP_HANDLE * hdl, int implType);
  104. private:
  105. };
  106. }