#if !defined(AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_)\r
#define AFX_STDAFX_H__A9DB83DB_A9FD_11D0_BFD1_444553540000__INCLUDED_\r
\r
-#define BOOST_PARAMETER_MAX_ARITY 7\r
-\r
#ifdef _DEBUG\r
#include <crtdbg.h>\r
#endif\r
\r
+#include <Windows.h>\r
+\r
#include <memory>\r
#include <array>\r
#include <functional>\r
#include <string>\r
#include <math.h>\r
\r
-#include <tbb/atomic.h>\r
-#include <tbb/concurrent_queue.h>\r
-\r
-#include <boost/assign.hpp>\r
-#include <boost/foreach.hpp>\r
-#include <boost/range/algorithm.hpp>\r
-\r
-#include "../common/utility/string.h"\r
-#include "../common/memory/safe_ptr.h"\r
+#include <common/utility/string.h>\r
+#include <common/memory/safe_ptr.h>\r
//#include "../common/concurrency/executor.h" // Can't include this due to MSVC lambda bug\r
\r
-#include "../common/log/Log.h"\r
-#include "../common/exception/exceptions.h"\r
-#include "../common/exception/win32_exception.h"\r
+#include <common/log/Log.h>\r
+#include <common/exception/exceptions.h>\r
\r
#include <assert.h>\r
\r
*/\r
#include "bluefish.h"\r
\r
+#include "util/blue_velvet.h"\r
+\r
#include <core/consumer/frame_consumer.h>\r
\r
+#include "consumer/bluefish_consumer.h"\r
+\r
namespace caspar {\r
\r
void init_bluefish()\r
try\r
{\r
blue_initialize();\r
- core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_bluefish_consumer(params);});\r
+ core::register_consumer_factory([](const std::vector<std::wstring>& params)\r
+ {\r
+ return create_bluefish_consumer(params);\r
+ });\r
+ }\r
+ catch(...)\r
+ {\r
+ CASPAR_LOG_CURRENT_EXCEPTION();\r
+ CASPAR_LOG(info) << L"Bluefish not supported.";\r
}\r
- catch(...){}\r
}\r
\r
+std::wstring get_bluefish_version()\r
+{\r
+ try\r
+ {\r
+ blue_initialize();\r
+ }\r
+ catch(...)\r
+ {\r
+ return L"Not found";\r
+ }\r
+\r
+ if(!BlueVelvetVersion)\r
+ return L"Unknown";\r
+\r
+ return widen(std::string(BlueVelvetVersion()));\r
+}\r
+\r
+std::vector<std::wstring> get_bluefish_device_list()\r
+{\r
+ std::vector<std::wstring> devices;\r
+\r
+ try\r
+ { \r
+ blue_initialize();\r
+ \r
+ auto blue = create_blue();\r
+\r
+ for(int n = 1; BLUE_PASS(blue->device_attach(n, FALSE)); ++n)\r
+ { \r
+ devices.push_back(std::wstring(get_card_desc(*blue)) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");\r
+ blue->device_detach(); \r
+ }\r
+ }\r
+ catch(...){}\r
+\r
+ return devices;\r
+}\r
}
\ No newline at end of file
*/\r
#pragma once\r
\r
-#include "consumer/bluefish_consumer.h"\r
+#include <string>\r
+#include <vector>\r
\r
namespace caspar {\r
\r
void init_bluefish();\r
\r
+std::wstring get_bluefish_version();\r
+std::vector<std::wstring> get_bluefish_device_list();\r
+\r
}
\ No newline at end of file
</ItemDefinitionGroup>\r
<ItemGroup>\r
<ClInclude Include="bluefish.h" />\r
+ <ClInclude Include="bluefish_error.h" />\r
<ClInclude Include="consumer\bluefish_consumer.h" />\r
<ClInclude Include="StdAfx.h" />\r
<ClInclude Include="util\memory.h" />\r
- <ClInclude Include="util\util.h" />\r
+ <ClInclude Include="util\blue_velvet.h" />\r
</ItemGroup>\r
<ItemGroup>\r
<ClCompile Include="bluefish.cpp">\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">Create</PrecompiledHeader>\r
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>\r
</ClCompile>\r
+ <ClCompile Include="util\blue_velvet.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ProjectReference Include="..\..\common\common.vcxproj">\r
<ClInclude Include="util\memory.h">\r
<Filter>util</Filter>\r
</ClInclude>\r
- <ClInclude Include="util\util.h">\r
+ <ClInclude Include="bluefish_error.h" />\r
+ <ClInclude Include="util\blue_velvet.h">\r
<Filter>util</Filter>\r
</ClInclude>\r
</ItemGroup>\r
</ClCompile>\r
<ClCompile Include="bluefish.cpp" />\r
<ClCompile Include="StdAfx.cpp" />\r
+ <ClCompile Include="util\blue_velvet.cpp">\r
+ <Filter>util</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
--- /dev/null
+#pragma once\r
+\r
+#include <common/exception/exceptions.h>\r
+\r
+namespace caspar {\r
+ \r
+struct bluefish_exception : virtual caspar_exception{};\r
+\r
+}
\ No newline at end of file
#include "../StdAfx.h"\r
\r
#include "bluefish_consumer.h"\r
-#include "../util/util.h"\r
+#include "../util/blue_velvet.h"\r
#include "../util/memory.h"\r
\r
#include <core/mixer/read_frame.h>\r
\r
#include <boost/timer.hpp>\r
\r
-#include <BlueVelvet4.h>\r
-#include <BlueHancUtils.h>\r
-\r
#include <memory>\r
#include <array>\r
\r
namespace caspar { \r
- \r
-CBlueVelvet4* (*BlueVelvetFactory4)() = nullptr;\r
-const char* (*BlueVelvetVersion)() = nullptr;\r
-BLUE_UINT32 (*encode_hanc_frame)(struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr,BLUE_UINT32 no_audio_ch,BLUE_UINT32 no_audio_samples,BLUE_UINT32 nTypeOfSample,BLUE_UINT32 emb_audio_flag) = nullptr;\r
-BLUE_UINT32 (*encode_hanc_frame_ex)(BLUE_UINT32 card_type, struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr, BLUE_UINT32 no_audio_ch, BLUE_UINT32 no_audio_samples, BLUE_UINT32 nTypeOfSample, BLUE_UINT32 emb_audio_flag) = nullptr;\r
-\r
-void blue_velvet_initialize()\r
-{\r
-#ifdef _DEBUG\r
- auto module = LoadLibrary(L"BlueVelvet3_d.dll");\r
-#else\r
- auto module = LoadLibrary(L"BlueVelvet3.dll");\r
-#endif\r
- if(!module)\r
- BOOST_THROW_EXCEPTION(file_not_found() << msg_info("Could not find BlueVelvet3.dll"));\r
- static std::shared_ptr<void> lib(module, FreeLibrary);\r
- BlueVelvetFactory4 = reinterpret_cast<decltype(BlueVelvetFactory4)>(GetProcAddress(module, "BlueVelvetFactory4"));\r
- BlueVelvetVersion = reinterpret_cast<decltype(BlueVelvetVersion)>(GetProcAddress(module, "BlueVelvetVersion"));\r
-}\r
-\r
-void blue_hanc_initialize()\r
-{\r
-#ifdef _DEBUG\r
- auto module = LoadLibrary(L"BlueHancUtils_d.dll");\r
-#else\r
- auto module = LoadLibrary(L"BlueHancUtils.dll");\r
-#endif\r
- if(!module)\r
- BOOST_THROW_EXCEPTION(file_not_found() << msg_info("Could not find BlueHancUtils.dll"));\r
- static std::shared_ptr<void> lib(module, FreeLibrary);\r
- encode_hanc_frame = reinterpret_cast<decltype(encode_hanc_frame)>(GetProcAddress(module, "encode_hanc_frame"));\r
- encode_hanc_frame_ex = reinterpret_cast<decltype(encode_hanc_frame_ex)>(GetProcAddress(module, "encode_hanc_frame_ex"));\r
-}\r
-\r
-void blue_initialize()\r
-{\r
- blue_velvet_initialize();\r
- blue_hanc_initialize();\r
-}\r
-\r
-safe_ptr<CBlueVelvet4> create_blue(size_t device_index)\r
-{\r
- if(!BlueVelvetFactory4 || !encode_hanc_frame || !encode_hanc_frame)\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Bluefish drivers not found."));\r
-\r
- auto blue = safe_ptr<CBlueVelvet4>(BlueVelvetFactory4());\r
- \r
- if(BLUE_FAIL(blue->device_attach(device_index, FALSE))) \r
- BOOST_THROW_EXCEPTION(bluefish_exception() << msg_info("Failed to attach device."));\r
-\r
- return blue;\r
-}\r
-\r
-EVideoMode get_video_mode(CBlueVelvet4& blue, const core::video_format_desc& format_desc)\r
-{\r
- EVideoMode vid_fmt = VID_FMT_INVALID;\r
- auto desiredVideoFormat = vid_fmt_from_video_format(format_desc.format);\r
- int videoModeCount = blue.count_video_mode();\r
- for(int videoModeIndex = 1; videoModeIndex <= videoModeCount; ++videoModeIndex) \r
- {\r
- EVideoMode videoMode = blue.enum_video_mode(videoModeIndex);\r
- if(videoMode == desiredVideoFormat) \r
- vid_fmt = videoMode; \r
- }\r
- if(vid_fmt == VID_FMT_INVALID)\r
- BOOST_THROW_EXCEPTION(bluefish_exception() << msg_info("Failed get videomode.") << arg_value_info(narrow(format_desc.name)));\r
-\r
- return vid_fmt;\r
-}\r
- \r
+ \r
struct bluefish_consumer : boost::noncopyable\r
{\r
safe_ptr<CBlueVelvet4> blue_;\r
executor executor_;\r
public:\r
bluefish_consumer(const core::video_format_desc& format_desc, unsigned int device_index, bool embedded_audio) \r
- : blue_(create_blue(device_index))\r
+ : blue_(create_blue())\r
, device_index_(device_index)\r
, format_desc_(format_desc) \r
- , model_name_(get_card_desc(blue_->has_video_cardtype()))\r
+ , model_name_(get_card_desc(*blue_))\r
, vid_fmt_(get_video_mode(*blue_, format_desc)) \r
, mem_fmt_(MEM_FMT_ARGB_PC)\r
, upd_fmt_(UPD_FMT_FRAME)\r
, embedded_audio_(embedded_audio)\r
, executor_(print())\r
{\r
+ if(BLUE_FAIL(blue_->device_attach(device_index, FALSE))) \r
+ BOOST_THROW_EXCEPTION(bluefish_exception() << msg_info("Failed to attach device."));\r
+\r
executor_.set_capacity(CONSUMER_BUFFER_DEPTH);\r
\r
graph_ = diagnostics::create_graph(narrow(print()));\r
\r
enable_video_output();\r
\r
- for(size_t n = 0; n < reserved_frames_.size(); ++n)\r
- reserved_frames_[n] = std::make_shared<blue_dma_buffer>(format_desc_.size, n); \r
+ int n = 0;\r
+ std::generate(reserved_frames_.begin(), reserved_frames_.end(), [&]\r
+ {\r
+ return std::make_shared<blue_dma_buffer>(format_desc_.size, n++);\r
+ });\r
\r
CASPAR_LOG(info) << print() << L" Successfully Initialized.";\r
}\r
\r
void schedule_next_video(const safe_ptr<const core::read_frame>& frame)\r
{\r
- static std::vector<short> silence(MAX_HANC_BUFFER_SIZE, 0);\r
+ static std::vector<int16_t> silence(MAX_HANC_BUFFER_SIZE, 0);\r
\r
executor_.begin_invoke([=]\r
{\r
\r
frame_timer_.restart();\r
\r
+ // Copy to local buffers\r
+\r
if(!frame->image_data().empty())\r
fast_memcpy(reserved_frames_.front()->image_data(), frame->image_data().begin(), frame->image_data().size());\r
else\r
fast_memclr(reserved_frames_.front()->image_data(), reserved_frames_.front()->image_size());\r
\r
+ // Sync\r
+\r
sync_timer_.restart();\r
unsigned long n_field = 0;\r
blue_->wait_output_video_synch(UPD_FMT_FRAME, n_field);\r
graph_->update_value("sync-time", static_cast<float>(sync_timer_.elapsed()*format_desc_.fps*0.5));\r
\r
+ // Send and display\r
+\r
if(embedded_audio_)\r
{ \r
- auto frame_audio_data = frame->audio_data().empty() ? silence.data() : const_cast<short*>(frame->audio_data().begin());\r
+ auto frame_audio_data = frame->audio_data().empty() ? silence.data() : const_cast<int16_t*>(frame->audio_data().begin());\r
\r
encode_hanc(reinterpret_cast<BLUE_UINT32*>(reserved_frames_.front()->hanc_data()), frame_audio_data, audio_samples, audio_nchannels);\r
\r
- blue_->system_buffer_write_async(const_cast<unsigned char*>(reserved_frames_.front()->image_data()), \r
+ blue_->system_buffer_write_async(const_cast<uint8_t*>(reserved_frames_.front()->image_data()), \r
reserved_frames_.front()->image_size(), \r
nullptr, \r
BlueImage_HANC_DMABuffer(reserved_frames_.front()->id(), BLUE_DATA_IMAGE));\r
}\r
else\r
{\r
- blue_->system_buffer_write_async(const_cast<unsigned char*>(reserved_frames_.front()->image_data()),\r
+ blue_->system_buffer_write_async(const_cast<uint8_t*>(reserved_frames_.front()->image_data()),\r
reserved_frames_.front()->image_size(), \r
nullptr, \r
BlueImage_DMABuffer(reserved_frames_.front()->id(), BLUE_DATA_IMAGE));\r
\r
void encode_hanc(BLUE_UINT32* hanc_data, void* audio_data, size_t audio_samples, size_t audio_nchannels)\r
{ \r
- auto card_type = blue_->has_video_cardtype();\r
- auto sample_type = (AUDIO_CHANNEL_16BIT | AUDIO_CHANNEL_LITTLEENDIAN);\r
+ static const auto sample_type = AUDIO_CHANNEL_16BIT | AUDIO_CHANNEL_LITTLEENDIAN;\r
+ static const auto emb_audio_flag = blue_emb_audio_enable | blue_emb_audio_group1_enable;\r
\r
hanc_stream_info_struct hanc_stream_info;\r
memset(&hanc_stream_info, 0, sizeof(hanc_stream_info));\r
hanc_stream_info.AudioDBNArray[1] = -1;\r
hanc_stream_info.AudioDBNArray[2] = -1;\r
hanc_stream_info.AudioDBNArray[3] = -1;\r
- hanc_stream_info.hanc_data_ptr = hanc_data;\r
- hanc_stream_info.video_mode = vid_fmt_;\r
+ hanc_stream_info.hanc_data_ptr = hanc_data;\r
+ hanc_stream_info.video_mode = vid_fmt_; \r
\r
- auto emb_audio_flag = (blue_emb_audio_enable | blue_emb_audio_group1_enable);\r
-\r
- if (!is_epoch_card(card_type))\r
+ if (!is_epoch_card(*blue_))\r
encode_hanc_frame(&hanc_stream_info, audio_data, audio_nchannels, audio_samples, sample_type, emb_audio_flag); \r
else\r
- encode_hanc_frame_ex(card_type, &hanc_stream_info, audio_data, audio_nchannels, audio_samples, sample_type, emb_audio_flag);\r
+ encode_hanc_frame_ex(blue_->has_video_cardtype(), &hanc_stream_info, audio_data, audio_nchannels, audio_samples, sample_type, emb_audio_flag);\r
}\r
\r
std::wstring print() const\r
std::unique_ptr<bluefish_consumer> consumer_;\r
const size_t device_index_;\r
const bool embedded_audio_;\r
- bool key_only_;\r
+ const bool key_only_;\r
public:\r
\r
bluefish_consumer_proxy(size_t device_index, bool embedded_audio, bool key_only)\r
}\r
}; \r
\r
-std::wstring get_bluefish_version()\r
-{\r
- try\r
- {\r
- blue_initialize();\r
- }\r
- catch(...)\r
- {\r
- return L"Not found";\r
- }\r
- if(!BlueVelvetVersion)\r
- return L"Unknown";\r
-\r
- return widen(std::string(BlueVelvetVersion()));\r
-}\r
-\r
-std::vector<std::wstring> get_bluefish_device_list()\r
-{\r
- std::vector<std::wstring> devices;\r
-\r
- try\r
- { \r
- if(!BlueVelvetFactory4)\r
- return devices;\r
-\r
- std::shared_ptr<CBlueVelvet4> blue(BlueVelvetFactory4());\r
-\r
- for(int n = 1; BLUE_PASS(blue->device_attach(n, FALSE)); ++n)\r
- { \r
- devices.push_back(std::wstring(get_card_desc(blue->has_video_cardtype())) + L" [" + boost::lexical_cast<std::wstring>(n) + L"]");\r
- blue->device_detach(); \r
- }\r
- }\r
- catch(...){}\r
-\r
- return devices;\r
-}\r
-\r
safe_ptr<core::frame_consumer> create_bluefish_consumer(const std::vector<std::wstring>& params)\r
{\r
if(params.size() < 1 || params[0] != L"BLUEFISH")\r
return core::frame_consumer::empty();\r
\r
- int device_index = 1;\r
- if(params.size() > 1)\r
- device_index = lexical_cast_or_default<int>(params[1], 1);\r
+ const auto device_index = params.size() > 1 ? lexical_cast_or_default<int>(params[1], 1) : 1;\r
\r
- bool embedded_audio = std::find(params.begin(), params.end(), L"EMBEDDED_AUDIO") != params.end();\r
- bool key_only = std::find(params.begin(), params.end(), L"KEY_ONLY") != params.end();\r
+ const auto embedded_audio = std::find(params.begin(), params.end(), L"EMBEDDED_AUDIO") != params.end();\r
+ const auto key_only = std::find(params.begin(), params.end(), L"KEY_ONLY") != params.end();\r
\r
return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only);\r
}\r
\r
safe_ptr<core::frame_consumer> create_bluefish_consumer(const boost::property_tree::ptree& ptree) \r
{ \r
- auto device_index = ptree.get("device", 1);\r
- auto embedded_audio = ptree.get("embedded-audio", false);\r
- bool key_only = ptree.get("key-only", false);\r
+ const auto device_index = ptree.get("device", 1);\r
+ const auto embedded_audio = ptree.get("embedded-audio", false);\r
+ const auto key_only = ptree.get("key-only", false);\r
\r
return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only);\r
}\r
*/\r
#pragma once\r
\r
-#include <common/exception/exceptions.h>\r
+#include "../bluefish_error.h"\r
\r
#include <core/video_format.h>\r
#include <core/consumer/frame_consumer.h>\r
#include <string>\r
\r
namespace caspar { \r
-\r
-struct bluefish_exception : virtual caspar_exception{};\r
- \r
-void blue_initialize();\r
-std::wstring get_bluefish_version();\r
-std::vector<std::wstring> get_bluefish_device_list();\r
-\r
+ \r
safe_ptr<core::frame_consumer> create_bluefish_consumer(const std::vector<std::wstring>& params);\r
safe_ptr<core::frame_consumer> create_bluefish_consumer(const boost::property_tree::ptree& ptree);\r
\r
--- /dev/null
+#include "../StdAfx.h"\r
+\r
+#include "blue_velvet.h"\r
+\r
+#include <common/utility/string.h>\r
+\r
+#include <core/video_format.h>\r
+\r
+namespace caspar {\r
+ \r
+CBlueVelvet4* (*BlueVelvetFactory4)() = nullptr;\r
+void (*BlueVelvetDestroy)(CBlueVelvet4* pObj) = nullptr;\r
+const char* (*BlueVelvetVersion)() = nullptr;\r
+BLUE_UINT32 (*encode_hanc_frame)(struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr,BLUE_UINT32 no_audio_ch,BLUE_UINT32 no_audio_samples,BLUE_UINT32 nTypeOfSample,BLUE_UINT32 emb_audio_flag) = nullptr;\r
+BLUE_UINT32 (*encode_hanc_frame_ex)(BLUE_UINT32 card_type, struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr, BLUE_UINT32 no_audio_ch, BLUE_UINT32 no_audio_samples, BLUE_UINT32 nTypeOfSample, BLUE_UINT32 emb_audio_flag) = nullptr;\r
+\r
+void blue_velvet_initialize()\r
+{\r
+#ifdef _DEBUG\r
+ auto module = LoadLibrary(L"BlueVelvet3_d.dll");\r
+#else\r
+ auto module = LoadLibrary(L"BlueVelvet3.dll");\r
+#endif\r
+ if(!module)\r
+ BOOST_THROW_EXCEPTION(file_not_found() << msg_info("Could not find BlueVelvet3.dll. Required drivers are not installed."));\r
+ static std::shared_ptr<void> lib(module, FreeLibrary);\r
+ BlueVelvetFactory4 = reinterpret_cast<decltype(BlueVelvetFactory4)>(GetProcAddress(module, "BlueVelvetFactory4"));\r
+ BlueVelvetDestroy = reinterpret_cast<decltype(BlueVelvetDestroy)>(GetProcAddress(module, "BlueVelvetDestroy"));\r
+ BlueVelvetVersion = reinterpret_cast<decltype(BlueVelvetVersion)>(GetProcAddress(module, "BlueVelvetVersion"));\r
+}\r
+\r
+void blue_hanc_initialize()\r
+{\r
+#ifdef _DEBUG\r
+ auto module = LoadLibrary(L"BlueHancUtils_d.dll");\r
+#else\r
+ auto module = LoadLibrary(L"BlueHancUtils.dll");\r
+#endif\r
+ if(!module)\r
+ BOOST_THROW_EXCEPTION(file_not_found() << msg_info("Could not find BlueHancUtils.dll. Required drivers are not installed."));\r
+ static std::shared_ptr<void> lib(module, FreeLibrary);\r
+ encode_hanc_frame = reinterpret_cast<decltype(encode_hanc_frame)>(GetProcAddress(module, "encode_hanc_frame"));\r
+ encode_hanc_frame_ex = reinterpret_cast<decltype(encode_hanc_frame_ex)>(GetProcAddress(module, "encode_hanc_frame_ex"));\r
+}\r
+\r
+void blue_initialize()\r
+{\r
+ blue_velvet_initialize();\r
+ blue_hanc_initialize();\r
+}\r
+\r
+EVideoMode vid_fmt_from_video_format(const core::video_format::type& fmt) \r
+{\r
+ switch(fmt)\r
+ {\r
+ case core::video_format::pal: return VID_FMT_PAL;\r
+ case core::video_format::ntsc: return VID_FMT_NTSC;\r
+ case core::video_format::x576p2500: return VID_FMT_INVALID; //not supported\r
+ case core::video_format::x720p2500: return VID_FMT_720P_2500;\r
+ case core::video_format::x720p5000: return VID_FMT_720P_5000;\r
+ case core::video_format::x720p5994: return VID_FMT_720P_5994;\r
+ case core::video_format::x720p6000: return VID_FMT_720P_6000;\r
+ case core::video_format::x1080p2397: return VID_FMT_1080P_2397;\r
+ case core::video_format::x1080p2400: return VID_FMT_1080P_2400;\r
+ case core::video_format::x1080i5000: return VID_FMT_1080I_5000;\r
+ case core::video_format::x1080i5994: return VID_FMT_1080I_5994;\r
+ case core::video_format::x1080i6000: return VID_FMT_1080I_6000;\r
+ case core::video_format::x1080p2500: return VID_FMT_1080P_2500;\r
+ case core::video_format::x1080p2997: return VID_FMT_1080P_2997;\r
+ case core::video_format::x1080p3000: return VID_FMT_1080P_3000;\r
+ default: return VID_FMT_INVALID;\r
+ }\r
+}\r
+\r
+bool is_epoch_card(CBlueVelvet4& blue)\r
+{\r
+ switch(blue.has_video_cardtype())\r
+ {\r
+ case CRD_BLUE_EPOCH_2K:\r
+ case CRD_BLUE_EPOCH_HORIZON:\r
+ case CRD_BLUE_EPOCH_2K_CORE:\r
+ case CRD_BLUE_EPOCH_2K_ULTRA:\r
+ case CRD_BLUE_EPOCH_CORE:\r
+ case CRD_BLUE_EPOCH_ULTRA:\r
+ return true;\r
+ default:\r
+ return false;\r
+ }\r
+}\r
+\r
+std::wstring get_card_desc(CBlueVelvet4& blue)\r
+{\r
+ switch(blue.has_video_cardtype()) \r
+ {\r
+ case CRD_BLUEDEEP_LT: return L"Deepblue LT";// D64 Lite\r
+ case CRD_BLUEDEEP_SD: return L"Iridium SD";// Iridium SD\r
+ case CRD_BLUEDEEP_AV: return L"Iridium AV";// Iridium AV\r
+ case CRD_BLUEDEEP_IO: return L"Deepblue IO";// D64 Full\r
+ case CRD_BLUEWILD_AV: return L"Wildblue AV";// D64 AV\r
+ case CRD_IRIDIUM_HD: return L"Iridium HD";// * Iridium HD\r
+ case CRD_BLUEWILD_RT: return L"Wildblue RT";// D64 RT\r
+ case CRD_BLUEWILD_HD: return L"Wildblue HD";// * BadAss G2\r
+ case CRD_REDDEVIL: return L"Iridium Full";// Iridium Full\r
+ case CRD_BLUEDEEP_HD: \r
+ case CRD_BLUEDEEP_HDS: return L"Reserved for \"BasAss G2";// * BadAss G2 variant, proposed, reserved\r
+ case CRD_BLUE_ENVY: return L"Blue Envy"; // Mini Din \r
+ case CRD_BLUE_PRIDE: return L"Blue Pride";//Mini Din Output \r
+ case CRD_BLUE_GREED: return L"Blue Greed";\r
+ case CRD_BLUE_INGEST: return L"Blue Ingest";\r
+ case CRD_BLUE_SD_DUALLINK: return L"Blue SD Duallink";\r
+ case CRD_BLUE_CATALYST: return L"Blue Catalyst";\r
+ case CRD_BLUE_SD_DUALLINK_PRO: return L"Blue SD Duallink Pro";\r
+ case CRD_BLUE_SD_INGEST_PRO: return L"Blue SD Ingest pro";\r
+ case CRD_BLUE_SD_DEEPBLUE_LITE_PRO: return L"Blue SD Deepblue lite Pro";\r
+ case CRD_BLUE_SD_SINGLELINK_PRO: return L"Blue SD Singlelink Pro";\r
+ case CRD_BLUE_SD_IRIDIUM_AV_PRO: return L"Blue SD Iridium AV Pro";\r
+ case CRD_BLUE_SD_FIDELITY: return L"Blue SD Fidelity";\r
+ case CRD_BLUE_SD_FOCUS: return L"Blue SD Focus";\r
+ case CRD_BLUE_SD_PRIME: return L"Blue SD Prime";\r
+ case CRD_BLUE_EPOCH_2K_CORE: return L"Blue Epoch 2K Core";\r
+ case CRD_BLUE_EPOCH_2K_ULTRA: return L"Blue Epoch 2K Ultra";\r
+ case CRD_BLUE_EPOCH_HORIZON: return L"Blue Epoch Horizon";\r
+ case CRD_BLUE_EPOCH_CORE: return L"Blue Epoch Core";\r
+ case CRD_BLUE_EPOCH_ULTRA: return L"Blue Epoch Ultra";\r
+ case CRD_BLUE_CREATE_HD: return L"Blue Create HD";\r
+ case CRD_BLUE_CREATE_2K: return L"Blue Create 2K";\r
+ case CRD_BLUE_CREATE_2K_ULTRA: return L"Blue Create 2K Ultra";\r
+ default: return L"Unknown";\r
+ }\r
+}\r
+\r
+EVideoMode get_video_mode(CBlueVelvet4& blue, const core::video_format_desc& format_desc)\r
+{\r
+ EVideoMode vid_fmt = VID_FMT_INVALID;\r
+ auto desiredVideoFormat = vid_fmt_from_video_format(format_desc.format);\r
+ int videoModeCount = blue.count_video_mode();\r
+ for(int videoModeIndex = 1; videoModeIndex <= videoModeCount; ++videoModeIndex) \r
+ {\r
+ EVideoMode videoMode = blue.enum_video_mode(videoModeIndex);\r
+ if(videoMode == desiredVideoFormat) \r
+ vid_fmt = videoMode; \r
+ }\r
+ if(vid_fmt == VID_FMT_INVALID)\r
+ BOOST_THROW_EXCEPTION(bluefish_exception() << msg_info("Failed get videomode.") << arg_value_info(narrow(format_desc.name)));\r
+\r
+ return vid_fmt;\r
+}\r
+\r
+safe_ptr<CBlueVelvet4> create_blue()\r
+{\r
+ if(!BlueVelvetFactory4 || !encode_hanc_frame || !encode_hanc_frame)\r
+ BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Bluefish drivers not found."));\r
+\r
+ return safe_ptr<CBlueVelvet4>(BlueVelvetFactory4(), BlueVelvetDestroy);\r
+}\r
+\r
+}
\ No newline at end of file
--- /dev/null
+/*\r
+* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG.\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+*/\r
+#pragma once\r
+\r
+#include "../bluefish_error.h"\r
+\r
+#include <Windows.h>\r
+\r
+#include <BlueVelvet4.h>\r
+#include <BlueHancUtils.h>\r
+\r
+#include <common/memory/safe_ptr.h>\r
+\r
+namespace caspar { \r
+\r
+namespace core {\r
+\r
+struct video_format_desc;\r
+\r
+}\r
+\r
+extern const char* (*BlueVelvetVersion)();\r
+extern BLUE_UINT32 (*encode_hanc_frame)(struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr,BLUE_UINT32 no_audio_ch,BLUE_UINT32 no_audio_samples,BLUE_UINT32 nTypeOfSample,BLUE_UINT32 emb_audio_flag);\r
+extern BLUE_UINT32 (*encode_hanc_frame_ex)(BLUE_UINT32 card_type, struct hanc_stream_info_struct * hanc_stream_ptr, void * audio_pcm_ptr, BLUE_UINT32 no_audio_ch, BLUE_UINT32 no_audio_samples, BLUE_UINT32 nTypeOfSample, BLUE_UINT32 emb_audio_flag);\r
+\r
+void blue_initialize();\r
+\r
+safe_ptr<CBlueVelvet4> create_blue();\r
+bool is_epoch_card(CBlueVelvet4& blue);\r
+std::wstring get_card_desc(CBlueVelvet4& blue);\r
+EVideoMode get_video_mode(CBlueVelvet4& blue, const core::video_format_desc& format_desc);\r
+\r
+template<typename T>\r
+int set_card_property(T& pSdk, ULONG prop, ULONG value)\r
+{\r
+ VARIANT variantValue;\r
+ variantValue.vt = VT_UI4;\r
+ variantValue.ulVal = value;\r
+ return (pSdk->SetCardProperty(prop,variantValue));\r
+}\r
+\r
+}
\ No newline at end of file
+++ /dev/null
-/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
-*\r
-* This file is part of CasparCG.\r
-*\r
-* CasparCG is free software: you can redistribute it and/or modify\r
-* it under the terms of the GNU General Public License as published by\r
-* the Free Software Foundation, either version 3 of the License, or\r
-* (at your option) any later version.\r
-*\r
-* CasparCG is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-* GNU General Public License for more details.\r
-\r
-* You should have received a copy of the GNU General Public License\r
-* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
-*\r
-*/\r
-#pragma once\r
-\r
-#include <BlueVelvet4.h>\r
-#include <core/video_format.h>\r
-\r
-namespace caspar { \r
- \r
-inline bool is_epoch_card(int card_type)\r
-{\r
- return card_type == CRD_BLUE_EPOCH_2K || \r
- card_type == CRD_BLUE_EPOCH_HORIZON || \r
- card_type == CRD_BLUE_EPOCH_2K_CORE || \r
- card_type == CRD_BLUE_EPOCH_2K_ULTRA || \r
- card_type == CRD_BLUE_EPOCH_CORE || \r
- card_type == CRD_BLUE_EPOCH_ULTRA;\r
-}\r
-\r
-inline EVideoMode vid_fmt_from_video_format(const core::video_format::type& fmt) \r
-{\r
- switch(fmt)\r
- {\r
- case core::video_format::pal: return VID_FMT_PAL;\r
- case core::video_format::ntsc: return VID_FMT_NTSC;\r
- case core::video_format::x576p2500: return VID_FMT_INVALID; //not supported\r
- case core::video_format::x720p2500: return VID_FMT_720P_2500;\r
- case core::video_format::x720p5000: return VID_FMT_720P_5000;\r
- case core::video_format::x720p5994: return VID_FMT_720P_5994;\r
- case core::video_format::x720p6000: return VID_FMT_720P_6000;\r
- case core::video_format::x1080p2397: return VID_FMT_1080P_2397;\r
- case core::video_format::x1080p2400: return VID_FMT_1080P_2400;\r
- case core::video_format::x1080i5000: return VID_FMT_1080I_5000;\r
- case core::video_format::x1080i5994: return VID_FMT_1080I_5994;\r
- case core::video_format::x1080i6000: return VID_FMT_1080I_6000;\r
- case core::video_format::x1080p2500: return VID_FMT_1080P_2500;\r
- case core::video_format::x1080p2997: return VID_FMT_1080P_2997;\r
- case core::video_format::x1080p3000: return VID_FMT_1080P_3000;\r
- default: return VID_FMT_INVALID;\r
- }\r
-}\r
-\r
-inline wchar_t* get_card_desc(int cardType)\r
-{\r
- switch(cardType) \r
- {\r
- case CRD_BLUEDEEP_LT: return L"Deepblue LT";// D64 Lite\r
- case CRD_BLUEDEEP_SD: return L"Iridium SD";// Iridium SD\r
- case CRD_BLUEDEEP_AV: return L"Iridium AV";// Iridium AV\r
- case CRD_BLUEDEEP_IO: return L"Deepblue IO";// D64 Full\r
- case CRD_BLUEWILD_AV: return L"Wildblue AV";// D64 AV\r
- case CRD_IRIDIUM_HD: return L"Iridium HD";// * Iridium HD\r
- case CRD_BLUEWILD_RT: return L"Wildblue RT";// D64 RT\r
- case CRD_BLUEWILD_HD: return L"Wildblue HD";// * BadAss G2\r
- case CRD_REDDEVIL: return L"Iridium Full";// Iridium Full\r
- case CRD_BLUEDEEP_HD: \r
- case CRD_BLUEDEEP_HDS: return L"Reserved for \"BasAss G2";// * BadAss G2 variant, proposed, reserved\r
- case CRD_BLUE_ENVY: return L"Blue Envy"; // Mini Din \r
- case CRD_BLUE_PRIDE: return L"Blue Pride";//Mini Din Output \r
- case CRD_BLUE_GREED: return L"Blue Greed";\r
- case CRD_BLUE_INGEST: return L"Blue Ingest";\r
- case CRD_BLUE_SD_DUALLINK: return L"Blue SD Duallink";\r
- case CRD_BLUE_CATALYST: return L"Blue Catalyst";\r
- case CRD_BLUE_SD_DUALLINK_PRO: return L"Blue SD Duallink Pro";\r
- case CRD_BLUE_SD_INGEST_PRO: return L"Blue SD Ingest pro";\r
- case CRD_BLUE_SD_DEEPBLUE_LITE_PRO: return L"Blue SD Deepblue lite Pro";\r
- case CRD_BLUE_SD_SINGLELINK_PRO: return L"Blue SD Singlelink Pro";\r
- case CRD_BLUE_SD_IRIDIUM_AV_PRO: return L"Blue SD Iridium AV Pro";\r
- case CRD_BLUE_SD_FIDELITY: return L"Blue SD Fidelity";\r
- case CRD_BLUE_SD_FOCUS: return L"Blue SD Focus";\r
- case CRD_BLUE_SD_PRIME: return L"Blue SD Prime";\r
- case CRD_BLUE_EPOCH_2K_CORE: return L"Blue Epoch 2K Core";\r
- case CRD_BLUE_EPOCH_2K_ULTRA: return L"Blue Epoch 2K Ultra";\r
- case CRD_BLUE_EPOCH_HORIZON: return L"Blue Epoch Horizon";\r
- case CRD_BLUE_EPOCH_CORE: return L"Blue Epoch Core";\r
- case CRD_BLUE_EPOCH_ULTRA: return L"Blue Epoch Ultra";\r
- case CRD_BLUE_CREATE_HD: return L"Blue Create HD";\r
- case CRD_BLUE_CREATE_2K: return L"Blue Create 2K";\r
- case CRD_BLUE_CREATE_2K_ULTRA: return L"Blue Create 2K Ultra";\r
- default: return L"Unknown";\r
- }\r
-}\r
-\r
-inline int set_card_property(CBlueVelvet4 * pSdk, ULONG prop, ULONG value)\r
-{\r
- VARIANT variantValue;\r
- variantValue.vt = VT_UI4;\r
- variantValue.ulVal = value;\r
- return (pSdk->SetCardProperty(prop,variantValue));\r
-}\r
-\r
-inline int set_card_property(const std::shared_ptr<CBlueVelvet4> pSdk, ULONG prop, ULONG value)\r
-{\r
- return set_card_property(pSdk.get(), prop, value);\r
-}\r
-\r
-}
\ No newline at end of file
\r
\r
/* File created by MIDL compiler version 7.00.0555 */\r
-/* at Tue Jun 07 11:22:46 2011\r
+/* at Wed Jun 08 10:03:03 2011\r
*/\r
/* Compiler settings for interop\DeckLinkAPI.idl:\r
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
\r
\r
/* File created by MIDL compiler version 7.00.0555 */\r
-/* at Mon Jun 06 18:19:11 2011\r
+/* at Wed Jun 08 10:03:03 2011\r
*/\r
/* Compiler settings for interop\DeckLinkAPI.idl:\r
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
<ForcedIncludeFiles>common/compiler/vs/disable_silly_warnings.h</ForcedIncludeFiles>\r
</ClCompile>\r
<Link>\r
- <AdditionalDependencies>Bluevelvet3_d.lib;BlueHancUtils_d.lib;sfml-system-d.lib;sfml-audio-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
+ <AdditionalDependencies>sfml-system-d.lib;sfml-audio-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
</Command>\r
</PreLinkEvent>\r
<Link>\r
- <AdditionalDependencies>Bluevelvet3.lib;BlueHancUtils.lib;sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
+ <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
</Command>\r
</PreLinkEvent>\r
<Link>\r
- <AdditionalDependencies>Bluevelvet3.lib;BlueHancUtils.lib;sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
+ <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
</Command>\r
</PreLinkEvent>\r
<Link>\r
- <AdditionalDependencies>Bluevelvet3.lib;BlueHancUtils.lib;sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
+ <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avutil.lib;avfilter.lib;swscale.lib;tbb.lib;Glee.lib</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r