2 * Copyright 2013 Sveriges Television AB http://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: Helge Norberg, helge.norberg@svt.se
22 #include "../StdAfx.h"
30 #include <common/exception/exceptions.h>
32 namespace caspar { namespace newtek { namespace airsend {
35 const int width, const int height,
36 const int timescale, const int duration,
37 const bool progressive,
38 const float aspect_ratio,
39 const bool audio_enabled,
40 const int num_channels,
41 const int sample_rate) = nullptr;
42 void (*destroy)(void* instance) = nullptr;
44 void* instance, const short* samples, const int num_samples) = nullptr;
45 bool (*add_frame_bgra)(void* instance, const unsigned char* data) = nullptr;
47 const std::wstring& dll_name()
49 static std::wstring name = L"Processing.AirSend.x86.dll";
54 std::shared_ptr<void> load_library()
56 auto module = LoadLibrary(dll_name().c_str());
61 std::shared_ptr<void> lib(module, FreeLibrary);
63 wchar_t actualFilename[256];
65 GetModuleFileNameW(module, actualFilename, sizeof(actualFilename));
67 CASPAR_LOG(debug) << L"Loaded " << actualFilename;
69 create = reinterpret_cast<decltype(create)>(
70 GetProcAddress(module, "AirSend_Create"));
71 destroy = reinterpret_cast<decltype(destroy)>(
72 GetProcAddress(module, "AirSend_Destroy"));
73 add_audio = reinterpret_cast<decltype(add_audio)>(
74 GetProcAddress(module, "AirSend_add_audio"));
75 add_frame_bgra = reinterpret_cast<decltype(add_frame_bgra)>(
76 GetProcAddress(module, "AirSend_add_frame_bgra"));
80 || add_audio == nullptr
81 || add_frame_bgra == nullptr)
86 add_frame_bgra = nullptr;
96 static std::shared_ptr<void> lib = load_library();