2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Robert Nagy, ronag89@gmail.com
25 #include "util/util.h"
27 #include "consumer/decklink_consumer.h"
28 #include "producer/decklink_producer.h"
30 #include <core/consumer/frame_consumer.h>
31 #include <core/producer/frame_producer.h>
32 #include <core/system_info_provider.h>
34 #include <boost/property_tree/ptree.hpp>
36 #include "decklink_api.h"
38 namespace caspar { namespace decklink {
40 std::wstring get_version()
42 std::wstring ver = L"Not found";
48 ver = decklink::version(create_iterator());
55 std::vector<std::wstring> device_list()
57 std::vector<std::wstring> devices;
63 auto pDecklinkIterator = create_iterator();
65 for (int n = 1; pDecklinkIterator->Next(&decklink) == S_OK; ++n)
68 bool success = SUCCEEDED(decklink->GetModelName(&m_name));
70 std::wstring model_name = L"Unknown";
73 model_name = u16(m_name);
75 devices.push_back(model_name + L" [" + boost::lexical_cast<std::wstring>(n)+L"]");
83 void init(core::module_dependencies dependencies)
85 dependencies.consumer_registry->register_consumer_factory(L"Decklink Consumer", create_consumer, describe_consumer);
86 dependencies.consumer_registry->register_preconfigured_consumer_factory(L"decklink", create_preconfigured_consumer);
87 dependencies.producer_registry->register_producer_factory(L"Decklink Producer", create_producer, describe_producer);
88 dependencies.system_info_provider_repo->register_system_info_provider([](boost::property_tree::wptree& info)
90 info.add(L"system.decklink.version", get_version());
92 for (auto device : device_list())
93 info.add(L"system.decklink.device", device);