]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 2 Mar 2011 10:56:45 +0000 (10:56 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Wed, 2 Mar 2011 10:56:45 +0000 (10:56 +0000)
core/consumer/bluefish/bluefish_consumer.cpp
core/consumer/bluefish/bluefish_consumer.h
core/consumer/decklink/decklink_consumer.cpp
core/consumer/decklink/decklink_consumer.h
shell/main.cpp

index b65b5052c7b5ae7da3a4cccf4ffbedf43012c203..476c5d39bd12c8c3d0f3db2a5c0d963176f306c2 100644 (file)
 \r
 namespace caspar { namespace core {\r
        \r
-CBlueVelvet4* (*BlueVelvetFactory4)();\r
-BLUE_UINT32 (*encode_hanc_frame)(struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr,BLUE_UINT32 no_audio_ch,BLUE_UINT32 no_audio_samples,BLUE_UINT32 nTypeOfSample,BLUE_UINT32 emb_audio_flag);\r
-BLUE_UINT32 (*encode_hanc_frame_ex)(BLUE_UINT32 card_type, struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr, BLUE_UINT32 no_audio_ch,    BLUE_UINT32 no_audio_samples, BLUE_UINT32 nTypeOfSample, BLUE_UINT32 emb_audio_flag);\r
+CBlueVelvet4* (*BlueVelvetFactory4)() = nullptr;\r
+const char*    (*BlueVelvetVersion)() = nullptr;\r
+BLUE_UINT32 (*encode_hanc_frame)(struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr,BLUE_UINT32 no_audio_ch,BLUE_UINT32 no_audio_samples,BLUE_UINT32 nTypeOfSample,BLUE_UINT32 emb_audio_flag) = nullptr;\r
+BLUE_UINT32 (*encode_hanc_frame_ex)(BLUE_UINT32 card_type, struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr, BLUE_UINT32 no_audio_ch,    BLUE_UINT32 no_audio_samples, BLUE_UINT32 nTypeOfSample, BLUE_UINT32 emb_audio_flag) = nullptr;\r
 \r
 void blue_velvet_initialize()\r
 {\r
@@ -59,6 +60,7 @@ void blue_velvet_initialize()
                BOOST_THROW_EXCEPTION(file_not_found() << msg_info("Could not find BlueVelvet3.dll"));\r
        static std::shared_ptr<void> lib(module, FreeLibrary);\r
        BlueVelvetFactory4 = reinterpret_cast<decltype(BlueVelvetFactory4)>(GetProcAddress(module, "BlueVelvetFactory4"));\r
+       BlueVelvetVersion = reinterpret_cast<decltype(BlueVelvetVersion)>(GetProcAddress(module, "BlueVelvetVersion"));\r
 }\r
 \r
 void blue_hanc_initialize()\r
@@ -375,7 +377,31 @@ std::wstring get_bluefish_version()
        {\r
                return L"Not found";\r
        }\r
-       return L"Unknown";//widen(std::string(BlueVelvetVersion()));\r
+       if(!BlueVelvetVersion)\r
+               return L"Unknown";\r
+\r
+       return widen(std::string(BlueVelvetVersion()));\r
+}\r
+\r
+std::vector<std::wstring> get_bluefish_device_list()\r
+{\r
+       std::vector<std::wstring> devices;\r
+\r
+       try\r
+       {\r
+               blue_initialize();\r
+               \r
+               std::shared_ptr<CBlueVelvet4> blue(BlueVelvetFactory4());\r
+\r
+               for(int n = 0; BLUE_PASS(blue->device_attach(n, FALSE)); ++n)\r
+               {                               \r
+                       devices.push_back(L"[" + boost::lexical_cast<std::wstring>(n) + L"] " + get_card_desc(blue->has_video_cardtype()));\r
+                       blue->device_detach();          \r
+               }\r
+       }\r
+       catch(...){}\r
+\r
+       return devices;\r
 }\r
 \r
 safe_ptr<frame_consumer> create_bluefish_consumer(const std::vector<std::wstring>& params)\r
index e6a3f4d9df198d31a1a23cbca256985b573dccc5..c611590226200a6aaea5513c23bac89cf2c4d5b8 100644 (file)
@@ -45,6 +45,7 @@ private:
 };\r
        \r
 std::wstring get_bluefish_version();\r
+std::vector<std::wstring> get_bluefish_device_list();\r
 safe_ptr<frame_consumer> create_bluefish_consumer(const std::vector<std::wstring>& params);\r
 \r
 }}\r
index dd868c235e4894ea60ae06ccc367117fb0ae9c33..bab6b28542b7b03397dd0abf5f5fcc93173d0514 100644 (file)
@@ -342,6 +342,28 @@ std::wstring get_decklink_version()
                \r
        return get_version(pDecklinkIterator);\r
 }\r
+\r
+std::vector<std::wstring> get_decklink_device_list()\r
+{\r
+       std::vector<std::wstring> devices;\r
+       ::CoInitialize(nullptr);\r
+\r
+       CComPtr<IDeckLinkIterator> pDecklinkIterator;\r
+       if(FAILED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))\r
+               return devices;\r
+               \r
+       CComPtr<IDeckLink>      decklink;\r
+       for(int n = 0; pDecklinkIterator->Next(&decklink) == S_OK; ++n) \r
+       {\r
+               BSTR model_name = L"Unknown";\r
+               decklink->GetModelName(&model_name);\r
+               devices.push_back(L"[" + boost::lexical_cast<std::wstring>(n) + L"] " + model_name);    \r
+       }\r
+\r
+       ::CoUninitialize();\r
+\r
+       return devices;\r
+}\r
        \r
 safe_ptr<frame_consumer> create_decklink_consumer(const std::vector<std::wstring>& params)\r
 {\r
index f53ce2d0b9068a57b8f745d793ed69e13a10651a..c74006416ce294b7dea433117fd24e11a615d5ee 100644 (file)
@@ -45,6 +45,7 @@ private:
 };\r
 \r
 std::wstring get_decklink_version();\r
+std::vector<std::wstring> get_decklink_device_list();\r
 safe_ptr<frame_consumer> create_decklink_consumer(const std::vector<std::wstring>& params);\r
 \r
 \r
index 06edb548cc42d473f88e817130fd9ec14b8c2b3b..f7497fa882c7cd310554b3cd1eb873bd665edae3 100644 (file)
@@ -51,6 +51,8 @@
 \r
 #include <GLee.h>\r
 \r
+#include <boost/foreach.hpp>\r
+\r
 #if defined(_MSC_VER)\r
 #pragma warning (disable : 4244)\r
 #endif\r
@@ -118,8 +120,17 @@ void print_version()
        CASPAR_LOG(info) << L"Flash " << flash::get_flash_version();\r
        CASPAR_LOG(info) << L"Flash-Template-Host " << flash::get_cg_version();\r
        CASPAR_LOG(info) << L"FreeImage " << image::get_image_version();\r
-       CASPAR_LOG(info) << L"Decklink " << get_decklink_version();\r
-       CASPAR_LOG(info) << L"Bluefish " << get_bluefish_version();\r
+       \r
+       std::wstring decklink_devices;\r
+       BOOST_FOREACH(auto& device, get_decklink_device_list())\r
+               decklink_devices += L"\t" + device;\r
+       CASPAR_LOG(info) << L"Decklink " << get_decklink_version() << (decklink_devices.empty() ? L"" : L"\n\tDevices:\n" + decklink_devices);\r
+       \r
+       std::wstring bluefish_devices;\r
+       BOOST_FOREACH(auto& device, get_bluefish_device_list())\r
+               bluefish_devices += L"\t" + device;\r
+       CASPAR_LOG(info) << L"Bluefish " << get_bluefish_version() << (bluefish_devices.empty() ? L"" : L"\n\tDevices:\n" + bluefish_devices);\r
+\r
        CASPAR_LOG(info) << L"FFMPEG-avcodec " << ((avcodec_version() >> 16) & 0xFF) << L"." << ((avcodec_version() >> 8) & 0xFF) << L"." << ((avcodec_version() >> 0) & 0xFF);\r
        CASPAR_LOG(info) << L"FFMPEG-swscale " << ((avformat_version() >> 16) & 0xFF) << L"." << ((avformat_version() >> 8) & 0xFF) << L"." << ((avformat_version() >> 0) & 0xFF);\r
        CASPAR_LOG(info) << L"FFMPEG-avformat " << ((swscale_version() >> 16) & 0xFF) << L"." << ((swscale_version() >> 8) & 0xFF) << L"." << ((swscale_version() >> 0) & 0xFF);\r