2 * Copyright 2013 Sveriges Television AB http://casparcg.com/
\r
4 * This file is part of CasparCG (www.casparcg.com).
\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
19 * Author: Robert Nagy, ronag89@gmail.com
\r
24 #include "decklink.h"
\r
25 #include "util/util.h"
\r
27 #include "consumer/decklink_consumer.h"
\r
28 #include "consumer/blocking_decklink_consumer.h"
\r
29 #include "producer/decklink_producer.h"
\r
31 #include <core/parameters/parameters.h>
\r
32 #include <core/consumer/frame_consumer.h>
\r
33 #include <core/producer/frame_producer.h>
\r
35 #include "interop/DeckLinkAPI_h.h"
\r
37 #pragma warning(push)
\r
38 #pragma warning(disable : 4996)
\r
40 #include <atlbase.h>
\r
43 #include <atlhost.h>
\r
45 #pragma warning(push)
\r
47 namespace caspar { namespace decklink {
\r
53 co_init(){::CoInitialize(nullptr);}
\r
54 ~co_init(){::CoUninitialize();}
\r
57 CComPtr<IDeckLinkIterator> pDecklinkIterator;
\r
58 if(FAILED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
\r
61 core::register_consumer_factory([](const core::parameters& params){return decklink::create_consumer(params);});
\r
62 core::register_consumer_factory([](const core::parameters& params){return decklink::create_blocking_consumer(params);});
\r
63 core::register_producer_factory(create_producer);
\r
66 std::wstring get_version()
\r
68 std::wstring version = L"Not found";
\r
72 co_init(){::CoInitialize(nullptr);}
\r
73 ~co_init(){::CoUninitialize();}
\r
78 CComPtr<IDeckLinkIterator> pDecklinkIterator;
\r
79 if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
\r
80 version = get_version(pDecklinkIterator);
\r
87 std::vector<std::wstring> get_device_list()
\r
89 std::vector<std::wstring> devices;
\r
93 co_init(){::CoInitialize(nullptr);}
\r
94 ~co_init(){::CoUninitialize();}
\r
99 CComPtr<IDeckLinkIterator> pDecklinkIterator;
\r
100 if(SUCCEEDED(pDecklinkIterator.CoCreateInstance(CLSID_CDeckLinkIterator)))
\r
102 IDeckLink* decklink;
\r
103 for(int n = 1; pDecklinkIterator->Next(&decklink) == S_OK; ++n)
\r
105 BSTR model_name = L"Unknown";
\r
106 decklink->GetModelName(&model_name);
\r
107 decklink->Release();
\r
108 devices.push_back(std::wstring(model_name) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");
\r