]> git.sesse.net Git - casparcg/blobdiff - modules/bluefish/util/blue_velvet.cpp
Changes to support the new way of setting bluefish properties.
[casparcg] / modules / bluefish / util / blue_velvet.cpp
index dcc52f07da13c719f5dda454a8a5150078dd68f8..8ec40156822350ee8cd9a6dc852c0779ab95a710 100644 (file)
@@ -31,7 +31,6 @@
 
 #if defined(_WIN32)
        #define GET_PROCADDR_FOR_FUNC(name, module) { name = (pFunc_##name)GetProcAddress(reinterpret_cast<HMODULE>(module), #name); if(!name) { return false; } }
-//     #define GET_PROCADDR_FOR_FUNC(name, module) { name = (pFunc_##name)GetProcAddress(module, #name); if(!name) { return false; } }
 #elif defined(__APPLE__)
        #define GET_PROCADDR_FOR_FUNC(name, module) { name = (pFunc_##name)dlsym(module, #name); if(!name) { return false; } }
 #endif
@@ -40,9 +39,9 @@ namespace caspar { namespace bluefish {
 
        bvc_wrapper::bvc_wrapper()
        {
-               bvc_ = nullptr;
-               h_module_ = nullptr;
-               init_function_pointers();
+               if(!init_function_pointers())
+                       CASPAR_THROW_EXCEPTION(not_supported() << msg_info("Bluefish drivers not found.  Unable to init Funcion Pointers"));
+               
                bvc_ = std::shared_ptr<void>(bfcFactory(), bfcDestroy);
                
                if (!bvc_)
@@ -52,70 +51,6 @@ namespace caspar { namespace bluefish {
        bool bvc_wrapper::init_function_pointers()
        {
                bool res = false;
-               bfcGetVersion = nullptr;
-               bfcFactory = nullptr;
-               bfcDestroy = nullptr;
-               bfcEnumerate = nullptr;
-               bfcQueryCardType = nullptr;
-               bfcAttach = nullptr;
-               bfcDetach = nullptr;
-               bfcQueryCardProperty32 = nullptr;
-               bfcQueryCardProperty64 = nullptr;
-               bfcSetCardProperty32 = nullptr;
-               bfcSetCardProperty64 = nullptr;
-               bfcGetCardSerialNumber = nullptr;
-               bfcGetCardFwVersion = nullptr;
-               bfcWaitVideoSyncAsync = nullptr;
-               bfcWaitVideoInputSync = nullptr;
-               bfcWaitVideoOutputSync = nullptr;
-               bfcGetVideoOutputCurrentFieldCount = nullptr;
-               bfcGetVideoInputCurrentFieldCount = nullptr;
-               bfcVideoCaptureStart = nullptr;
-               bfcVideoCaptureStop = nullptr;
-               bfcVideoPlaybackStart = nullptr;
-               bfcVideoPlaybackStop = nullptr;
-               bfcVideoPlaybackAllocate = nullptr;
-               bfcVideoPlaybackPresent = nullptr;
-               bfcVideoPlaybackRelease = nullptr;
-               bfcGetCaptureVideoFrameInfoEx = nullptr;
-               bfcRenderBufferCapture = nullptr;
-               bfcRenderBufferUpdate = nullptr;
-               bfcGetRenderBufferCount = nullptr;
-               bfcEncodeHancFrameEx = nullptr;
-               bfcDecodeHancFrameEx = nullptr;
-#if defined(_WIN32)
-               bfcSystemBufferReadAsync = nullptr;
-               bfcSystemBufferWriteAsync = nullptr;
-#else
-               bfcSystemBufferRead = nullptr;
-               bfcSystemBufferWrite = nullptr;
-#endif
-               bfcGetBytesForGroupPixels = nullptr;
-               bfcGetPixelsPerLine = nullptr;
-               bfcGetLinesPerFrame = nullptr;
-               bfcGetBytesPerLine = nullptr;
-               bfcGetBytesPerFrame = nullptr;
-               bfcGetGoldenValue = nullptr;
-               bfcGetVBILines = nullptr;
-               bfcGetVANCGoldenValue = nullptr;
-               bfcGetVANCLineBytes = nullptr;
-               bfcGetVANCLineCount = nullptr;
-               bfcGetWindowsDriverHandle = nullptr;
-               bfcUtilsGetStringForCardType = nullptr;
-               bfcUtilsGetStringForBlueProductId = nullptr;
-               bfcUtilsGetStringForVideoMode = nullptr;
-               bfcUtilsGetStringForMemoryFormat = nullptr;
-               bfcUtilsGetMR2Routing = nullptr;
-               bfcUtilsSetMR2Routing = nullptr;
-               bfcUtilsGetAudioOutputRouting = nullptr;
-               bfcUtilsSetAudioOutputRouting = nullptr;
-               bfcUtilsIsVideoModeProgressive = nullptr;
-               bfcUtilsIsVideoMode1001Framerate = nullptr;
-               bfcUtilsGetFpsForVideoMode = nullptr;
-               bfcUtilsGetVideoModeForFrameInfo = nullptr;
-               bfcUtilsGetFrameInfoForVideoMode = nullptr;
-               bfcUtilsGetAudioSamplesPerFrame = nullptr;
-
 #if defined(_WIN32)
 #ifdef _DEBUG
                h_module_ = std::shared_ptr<void>(LoadLibraryExA("BlueVelvetC64_d.dll", NULL, 0), FreeLibrary);
@@ -211,10 +146,7 @@ namespace caspar { namespace bluefish {
 
        BLUE_UINT32 bvc_wrapper::get_card_property32(const int iProperty, unsigned int & nValue)
        {
-               if (bvc_)
-                       return (BLUE_UINT32)bfcQueryCardProperty32((BLUEVELVETC_HANDLE)bvc_.get(), iProperty, nValue);
-               else
-                       return 0;
+               return (BLUE_UINT32)bfcQueryCardProperty32((BLUEVELVETC_HANDLE)bvc_.get(), iProperty, nValue);
        }
 
        BLUE_UINT32 bvc_wrapper::set_card_property32(const int iProperty, const unsigned int nValue)