-/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
-*\r
-* This file is part of CasparCG.\r
-*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-*/\r
-#include "bluefish.h"\r
-\r
-#include "consumer/bluefish_consumer.h"\r
-\r
-#include "util/blue_velvet.h"\r
-\r
-#include <common/log/log.h>\r
-#include <common/utility/string.h>\r
-\r
-#include <core/consumer/frame_consumer.h>\r
-\r
-#include <boost/lexical_cast.hpp>\r
-\r
-namespace caspar {\r
-\r
-void init_bluefish()\r
-{\r
- try\r
- {\r
- blue_initialize();\r
- core::register_consumer_factory([](const std::vector<std::wstring>& params)\r
- {\r
- return create_bluefish_consumer(params);\r
- });\r
- }\r
- catch(...)\r
- {\r
- //CASPAR_LOG_CURRENT_EXCEPTION();\r
- CASPAR_LOG(info) << L"Bluefish not supported.";\r
- }\r
-}\r
-\r
-std::wstring get_bluefish_version()\r
-{\r
- try\r
- {\r
- blue_initialize();\r
- }\r
- catch(...)\r
- {\r
- return L"Not found";\r
- }\r
-\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
- auto blue = create_blue();\r
-\r
- for(int n = 1; BLUE_PASS(blue->device_attach(n, FALSE)); ++n)\r
- { \r
- devices.push_back(std::wstring(get_card_desc(*blue)) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");\r
- blue->device_detach(); \r
- }\r
- }\r
- catch(...){}\r
-\r
- return devices;\r
-}\r
-}
\ No newline at end of file
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Robert Nagy, ronag89@gmail.com
+*/
+
+#include "StdAfx.h"
+
+#include "bluefish.h"
+
+#include "consumer/bluefish_consumer.h"
+
+#include "util/blue_velvet.h"
+
+#include <common/log.h>
+#include <common/utf.h>
+
+#include <core/consumer/frame_consumer.h>
+#include <core/system_info_provider.h>
+
+#include <boost/lexical_cast.hpp>
+#include <boost/property_tree/ptree.hpp>
+
+namespace caspar { namespace bluefish {
+
+std::wstring version()
+{
+ try
+ {
+ blue_initialize();
+ }
+ catch(...)
+ {
+ return L"Not found";
+ }
+
+ if(!BlueVelvetVersion)
+ return L"Unknown";
+
+ return u16(BlueVelvetVersion());
+}
+
+std::vector<std::wstring> device_list()
+{
+ std::vector<std::wstring> devices;
+
+ try
+ {
+ blue_initialize();
+
+ auto blue = create_blue();
+
+ for(int n = 1; BLUE_PASS(blue->device_attach(n, FALSE)); ++n)
+ {
+ devices.push_back(std::wstring(get_card_desc(*blue)) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");
+ blue->device_detach();
+ }
+ }
+ catch(...){}
+
+ return devices;
+}
+
+void init(core::module_dependencies dependencies)
+{
+ try
+ {
+ blue_initialize();
+ }
+ catch(...){}
+
+ dependencies.consumer_registry->register_consumer_factory(L"Bluefish Consumer", create_consumer, describe_consumer);
+ dependencies.consumer_registry->register_preconfigured_consumer_factory(L"bluefish", create_preconfigured_consumer);
+ dependencies.system_info_provider_repo->register_system_info_provider([](boost::property_tree::wptree& info)
+ {
+ info.add(L"system.bluefish.version", version());
+
+ for (auto device : device_list())
+ info.add(L"system.bluefish.device", device);
+ });
+}
+
+}}
\ No newline at end of file