]> git.sesse.net Git - casparcg/commitdiff
more refinements to code due to move to RAII
authorJames Wise <james.wise@bluefish444.com>
Tue, 7 Feb 2017 02:48:48 +0000 (13:48 +1100)
committerJames Wise <james.wise@bluefish444.com>
Tue, 7 Feb 2017 02:48:48 +0000 (13:48 +1100)
modules/bluefish/bluefish.cpp
modules/bluefish/util/blue_velvet.cpp

index 0c2957ebc0dcecbc041b76b35890f8565e0ae7ec..cf50a7b2407e96c608c6ab9dc285328d283dd0b4 100644 (file)
@@ -42,7 +42,7 @@ std::wstring version()
 {
        try
        {
-               bvc_wrapper blue = bvc_wrapper();
+               bvc_wrapper blue;
                return u16(blue.get_version());
        }
        catch(...)
@@ -57,7 +57,7 @@ std::vector<std::wstring> device_list()
 
        try
        {               
-               bvc_wrapper blue = bvc_wrapper();
+               bvc_wrapper blue;
                int numCards = 0;
                blue.enumerate(numCards);
 
@@ -77,10 +77,9 @@ void init(core::module_dependencies dependencies)
 {
        try
        {
-               bvc_wrapper blue = bvc_wrapper();
+               bvc_wrapper blue;
                int num_cards = 0;
                blue.enumerate(num_cards);
-       
        }
        catch(...){}
 
index 86b6178e64c9c033520f4435fc6d35e6c6b5dbec..5440a28c93be319ed54bc21bc30cb131cc5840bf 100644 (file)
@@ -40,9 +40,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_)
@@ -150,10 +150,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)