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>
33 #include "interop/DeckLinkAPI_h.h"
36 #pragma warning(disable : 4996)
45 namespace caspar { namespace decklink {
51 co_init(){::CoInitialize(nullptr);}
52 ~co_init(){::CoUninitialize();}
55 CComPtr<IDeckLinkIterator> pDecklinkIterator;
56 if(FAILED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
59 core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_consumer(params);});
60 core::register_producer_factory(create_producer);
63 std::wstring version()
65 std::wstring version = L"Not found";
69 co_init(){::CoInitialize(nullptr);}
70 ~co_init(){::CoUninitialize();}
75 CComPtr<IDeckLinkIterator> pDecklinkIterator;
76 if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
77 version = decklink::version(pDecklinkIterator);
84 std::vector<std::wstring> device_list()
86 std::vector<std::wstring> devices;
90 co_init(){::CoInitialize(nullptr);}
91 ~co_init(){::CoUninitialize();}
96 CComPtr<IDeckLinkIterator> pDecklinkIterator;
97 if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
100 for(int n = 1; pDecklinkIterator->Next(&decklink) == S_OK; ++n)
102 BSTR model_name = L"Unknown";
103 decklink->GetModelName(&model_name);
105 devices.push_back(std::wstring(model_name) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");