2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>
\r
4 * This file is part of CasparCG.
\r
6 * CasparCG is free software: you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation, either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * CasparCG is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
\r
22 #include "decklink.h"
\r
23 #include "util/util.h"
\r
25 #include "consumer/decklink_consumer.h"
\r
26 #include "producer/decklink_producer.h"
\r
28 #include <core/consumer/frame_consumer.h>
\r
29 #include <core/producer/frame_producer.h>
\r
31 #include "interop/DeckLinkAPI_h.h"
\r
33 #pragma warning(push)
\r
34 #pragma warning(disable : 4996)
\r
36 #include <atlbase.h>
\r
39 #include <atlhost.h>
\r
41 #pragma warning(push)
\r
45 void init_decklink()
\r
47 core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_decklink_consumer(params);});
\r
48 core::register_producer_factory(create_decklink_producer);
\r
51 std::wstring get_decklink_version()
\r
53 std::wstring version = L"Not found";
\r
55 ::CoInitialize(nullptr);
\r
58 CComPtr<IDeckLinkIterator> pDecklinkIterator;
\r
59 if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
\r
60 version = get_version(pDecklinkIterator);
\r
68 std::vector<std::wstring> get_decklink_device_list()
\r
70 std::vector<std::wstring> devices;
\r
72 ::CoInitialize(nullptr);
\r
75 CComPtr<IDeckLinkIterator> pDecklinkIterator;
\r
76 if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
\r
78 CComPtr<IDeckLink> decklink;
\r
79 for(int n = 1; pDecklinkIterator->Next(&decklink) == S_OK; ++n)
\r
81 BSTR model_name = L"Unknown";
\r
82 decklink->GetModelName(&model_name);
\r
83 devices.push_back(std::wstring(model_name) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");
\r