backendLibLoader.hpp 1.06 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
// VideoStitch BackendLibLoader
#pragma once

#include "libgpudiscovery/config.hpp"
#include "libgpudiscovery/genericDeviceInfo.hpp"

#include <atomic>
#include <string>

#ifdef _MSC_VER
#include <windows.h>
#endif  // _MSC_VER

namespace VideoStitch {
namespace BackendLibHelper {
class BackendLibLoader {
 public:
#ifdef __APPLE__
  void forceUpdateVsSymlink();
#endif
  bool isBackendAvailable(const Discovery::Framework& framework);

  bool selectBackend(const Discovery::Framework& framework, bool* needToRestart);

#ifdef _MSC_VER
  HMODULE getBackendHandler() const;
#endif
  static BackendLibLoader& getInstance();
  const static std::string getDefaultVsLib();

 private:
  BackendLibLoader();

#ifdef _MSC_VER
#ifdef DELAY_LOAD_ENABLED
  bool loadDll();
#endif  // DELAY_LOAD_ENABLED
  std::atomic<HMODULE> backendDllHandler;
#elif defined(__APPLE__)
  bool updateVsSymlink();
#endif
  std::atomic<Discovery::Framework> currentVsFramework;
};
}  // namespace BackendLibHelper
}  // namespace VideoStitch