mfx_load_plugin.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // Copyright (c) 2013-2019 Intel Corporation
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to deal
  5. // in the Software without restriction, including without limitation the rights
  6. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. // copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in all
  11. // copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. // SOFTWARE.
  20. #pragma once
  21. #include "mfxplugin.h"
  22. #include "mfx_dispatcher_defs.h"
  23. #include "mfx_plugin_hive.h"
  24. namespace MFX
  25. {
  26. typedef mfxStatus (MFX_CDECL *CreatePluginPtr_t)(mfxPluginUID uid, mfxPlugin* plugin);
  27. class PluginModule
  28. {
  29. mfxModuleHandle mHmodule;
  30. CreatePluginPtr_t mCreatePluginPtr;
  31. wchar_t mPath[MAX_PLUGIN_PATH];
  32. public:
  33. PluginModule();
  34. PluginModule(const wchar_t * path);
  35. PluginModule(const PluginModule & that) ;
  36. PluginModule & operator = (const PluginModule & that);
  37. bool Create(mfxPluginUID guid, mfxPlugin&);
  38. ~PluginModule(void);
  39. private:
  40. void Tidy();
  41. };
  42. class MFXPluginFactory {
  43. struct FactoryRecord {
  44. mfxPluginParam plgParams;
  45. PluginModule module;
  46. mfxPlugin plugin;
  47. FactoryRecord ()
  48. : plgParams(), plugin()
  49. {}
  50. FactoryRecord(const mfxPluginParam &plgParams,
  51. PluginModule &module,
  52. mfxPlugin plugin)
  53. : plgParams(plgParams)
  54. , module(module)
  55. , plugin(plugin) {
  56. }
  57. };
  58. MFXVector<FactoryRecord> mPlugins;
  59. mfxU32 nPlugins;
  60. mfxSession mSession;
  61. public:
  62. MFXPluginFactory(mfxSession session);
  63. void Close();
  64. mfxStatus Create(const PluginDescriptionRecord &);
  65. bool Destroy(const mfxPluginUID &);
  66. ~MFXPluginFactory();
  67. protected:
  68. void DestroyPlugin( FactoryRecord & );
  69. static bool RunVerification( const mfxPlugin & plg, const PluginDescriptionRecord &dsc, mfxPluginParam &pluginParams );
  70. static bool VerifyEncoder( const mfxVideoCodecPlugin &videoCodec );
  71. static bool VerifyAudioEncoder( const mfxAudioCodecPlugin &audioCodec );
  72. static bool VerifyEnc( const mfxVideoCodecPlugin &videoEnc );
  73. static bool VerifyVpp( const mfxVideoCodecPlugin &videoCodec );
  74. static bool VerifyDecoder( const mfxVideoCodecPlugin &videoCodec );
  75. static bool VerifyAudioDecoder( const mfxAudioCodecPlugin &audioCodec );
  76. static bool VerifyCodecCommon( const mfxVideoCodecPlugin & Video );
  77. };
  78. }