![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include <algorithm>#include <cassert>#include <cctype>#include <chrono>#include <climits>#include <condition_variable>#include <cstdio>#include <cstdint>#include <cstring>#include <iomanip>#include <map>#include <mutex>#include <sstream>#include <stdexcept>#include <unordered_map>#include <utility>#include "compat/htonl.h"#include "compat/misc.h"#include "DeckLinkAPIVersion.h"#include "blackmagic_common.hpp"#include "debug.h"#include "host.h"#include "utils/color_out.h"#include "utils/macros.h"#include "utils/windows.h"#include "utils/worker.h"
Go to the source code of this file.
Classes | |
| struct | bmd_no_conv< T > |
| struct | bmd_no_conv< IDeckLinkInput > |
| struct | bmd_no_conv< IDeckLinkOutput > |
| class | ProfileCallback |
Macros | |
| #define | BMDFCC(x) |
| #define | EXIT_IF_FAILED(cmd, name) |
| #define | MOD_NAME "[DeckLink] " |
| #define | RELEASE_IF_NOT_NULL(x) |
Functions | |
| ADD_TO_PARAM (BMD_NAT_SORT, "* " BMD_NAT_SORT "\n" " Use the old BMD device sorting.\n") | |
| ADD_TO_PARAM (R10K_FULL_OPT, "* " R10K_FULL_OPT "\n" " Do not do conversion from/to limited range on in/out for R10k on BMD devs.\n") | |
| static void | apply_r10k_lut (void *i, void *o, size_t len, void *udata) |
| bool | blackmagic_api_version_check () |
| bool | bmd_check_stereo_profile (IDeckLink *deckLink) |
| string | bmd_get_audio_connection_name (BMDAudioOutputAnalogAESSwitch audioConnection) |
| string | bmd_get_device_name (IDeckLink *decklink) |
| string | bmd_get_flags_str (BMDDisplayModeFlags flags) |
| std::vector< bmd_dev > | bmd_get_sorted_devices (bool *com_initialized, bool verbose, bool natural_sort) |
| string | bmd_hresult_to_string (HRESULT res) |
| bool | bmd_parse_audio_levels (const char *opt) noexcept(false) |
| TOREMOVE (implicit "aacl" option is preferred) | |
| uint32_t | bmd_read_fourcc (const char *str) |
| IDeckLinkIterator * | create_decklink_iterator (bool *com_initialized, bool verbose) |
| static BMDProfileID | decklink_get_active_profile_id (IDeckLink *decklink) |
| bool | decklink_set_profile (IDeckLink *deckLink, bmd_option const &req_profile, bool stereo) |
| template<typename T > | |
| bool | decklink_supports_codec (T *deckLink, BMDPixelFormat pf) |
| template bool | decklink_supports_codec< IDeckLinkInput > (IDeckLinkInput *deckLink, BMDPixelFormat pf) |
| template bool | decklink_supports_codec< IDeckLinkOutput > (IDeckLinkOutput *deckLink, BMDPixelFormat pf) |
| void | decklink_uninitialize (bool *com_initialized) |
| static string | fcc_to_string (uint32_t fourcc) |
| static void | fill_full_to_limited_lut (unsigned int *lut) |
| static void | fill_limited_to_full_lut (unsigned int *lut) |
| BMD_STR | get_bmd_api_str_from_cstr (const char *cstr) |
| const map< BMDVideoConnection, string > & | get_connection_string_map () |
| char * | get_cstr_from_bmd_api_str (BMD_STR bmd_string) |
| std::string | get_str_from_bmd_api_str (BMD_STR string) |
| static BMDProfileID | GetDeckLinkProfileID (IDeckLinkProfile *profile) |
| std::ostream & | operator<< (std::ostream &output, const bmd_option &b) |
| std::ostream & | operator<< (std::ostream &output, REFIID iid) |
| void | print_bmd_attribute (IDeckLinkProfileAttributes *deckLinkAttributes, const char *query_prop_fcc) |
| void | print_bmd_device_profiles (const char *line_prefix) |
| void | print_decklink_version () |
| void | r10k_full_to_limited (const char *in, char *out, size_t len) |
| void | r10k_limited_to_full (const char *in, char *out, size_t len) |
| void | release_bmd_api_str (BMD_STR string) |
Variables | |
| static const map< BMDProfileID, pair< const char *, const char * > > | kDeviceProfiles |
Definition in file blackmagic_common.cpp.
| #define BMDFCC | ( | x | ) |
Referenced by fcc_to_string().
| #define EXIT_IF_FAILED | ( | cmd, | |
| name ) |
Definition at line 303 of file blackmagic_common.cpp.
Referenced by decklink_get_active_profile_id(), and decklink_set_profile().
| #define MOD_NAME "[DeckLink] " |
Definition at line 66 of file blackmagic_common.cpp.
Referenced by bmd_check_stereo_profile(), decklink_set_profile(), GetDeckLinkProfileID(), and print_bmd_attribute().
| #define RELEASE_IF_NOT_NULL | ( | x | ) |
Definition at line 313 of file blackmagic_common.cpp.
Referenced by decklink_get_active_profile_id(), decklink_set_profile(), and display_decklink_done().
| ADD_TO_PARAM | ( | BMD_NAT_SORT | , |
| "* " BMD_NAT_SORT "\n" " Use the old BMD device sorting.\n" | ) |
| ADD_TO_PARAM | ( | R10K_FULL_OPT | , |
| "* " R10K_FULL_OPT "\n" " Do not do conversion from/to limited range on in/out for R10k on BMD devs.\n" | ) |
|
static |
Definition at line 835 of file blackmagic_common.cpp.
References len.
Referenced by r10k_full_to_limited(), and r10k_limited_to_full().
| bool blackmagic_api_version_check | ( | ) |
Definition at line 202 of file blackmagic_common.cpp.
References cleanup(), com_initialize(), decklink_uninitialize(), FAILED, LOG_LEVEL_ERROR, log_msg(), and print_decklink_version().
Referenced by display_decklink_init(), and vidcap_decklink_init().

| bool bmd_check_stereo_profile | ( | IDeckLink * | deckLink | ) |
Definition at line 509 of file blackmagic_common.cpp.
References decklink_get_active_profile_id(), LOG_LEVEL_ERROR, LOG_LEVEL_INFO, log_msg(), and MOD_NAME.
Referenced by device_state::check_attributes(), and display_decklink_reconfigure().

| string bmd_get_audio_connection_name | ( | BMDAudioOutputAnalogAESSwitch | audioConnection | ) |
Definition at line 903 of file blackmagic_common.cpp.
| string bmd_get_device_name | ( | IDeckLink * | decklink | ) |
Definition at line 522 of file blackmagic_common.cpp.
References BMD_STR, get_cstr_from_bmd_api_str(), and release_bmd_api_str().
Referenced by decklink_help(), display_decklink_init(), display_decklink_probe(), device_state::init(), show_help(), and vidcap_decklink_probe().

| string bmd_get_flags_str | ( | BMDDisplayModeFlags | flags | ) |
Definition at line 914 of file blackmagic_common.cpp.
Referenced by get_input_modes(), and print_output_modes().
| std::vector< bmd_dev > bmd_get_sorted_devices | ( | bool * | com_initialized, |
| bool | verbose, | ||
| bool | natural_sort ) |
| verbose | - print errors |
| natural_sort | - use the (old) natural sort as given by the iterator |
Definition at line 1106 of file blackmagic_common.cpp.
References create_decklink_iterator().
Referenced by decklink_help(), display_decklink_init(), display_decklink_probe(), device_state::init(), show_help(), and vidcap_decklink_probe().

| string bmd_hresult_to_string | ( | HRESULT | res | ) |
Definition at line 85 of file blackmagic_common.cpp.
References HRESULT_GET_ERROR_COMMON.
Referenced by decklink_get_active_profile_id(), decklink_set_profile(), decklink_supports_codec(), bmd_option::device_write(), display_decklink_init(), display_decklink_reconfigure(), get_input_modes(), GetDeckLinkProfileID(), device_state::init(), print_bmd_attribute(), set_audio_props(), set_display_mode_properties(), vidcap_decklink_done(), and VideoDelegate::VideoInputFormatChanged().
| bool bmd_parse_audio_levels | ( | const char * | opt | ) |
TOREMOVE (implicit "aacl" option is preferred)
Definition at line 1020 of file blackmagic_common.cpp.
References MSG.
Referenced by parse_option(), and settings_init().
| uint32_t bmd_read_fourcc | ( | const char * | str | ) |
Definition at line 537 of file blackmagic_common.cpp.
Referenced by device_state::init(), bmd_option::parse(), parse_option(), and settings_init().
| IDeckLinkIterator * create_decklink_iterator | ( | bool * | com_initialized, |
| bool | verbose ) |
| [out] | com_initialized | pointer to be passed to decklnk_uninitialize (keeps information if COM needs to be unintialized) |
Definition at line 171 of file blackmagic_common.cpp.
References com_initialize(), decklink_uninitialize(), FAILED, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, and log_msg().
Referenced by bmd_get_sorted_devices().

|
static |
Definition at line 478 of file blackmagic_common.cpp.
References BMD_BOOL, BMD_FALSE, bmd_hresult_to_string(), cleanup(), EXIT_IF_FAILED, FAILED, GetDeckLinkProfileID(), LOG, LOG_LEVEL_ERROR, and RELEASE_IF_NOT_NULL.
Referenced by bmd_check_stereo_profile().

| bool decklink_set_profile | ( | IDeckLink * | deckLink, |
| bmd_option const & | req_profile, | ||
| bool | stereo ) |
| a | value from BMDProfileID or bmdDuplexHalf (maximize number of IOs) |
Definition at line 399 of file blackmagic_common.cpp.
References BMD_CHECK, bmd_hresult_to_string(), cleanup(), EXIT_IF_FAILED, bmd_option::get_int(), bmd_option::is_default(), bmd_option::is_help(), LOG, LOG_LEVEL_ERROR, LOG_LEVEL_VERBOSE, LOG_LEVEL_WARNING, MOD_NAME, print_bmd_device_profiles(), RELEASE_IF_NOT_NULL, and ProfileCallback::WaitForProfileActivation().
Referenced by display_decklink_init(), display_decklink_reconfigure(), and device_state::init().

| bool decklink_supports_codec | ( | T * | deckLink, |
| BMDPixelFormat | pf ) |
This function returns true if any display mode and any output supports the codec. The codec, however, may not be supported with actual video mode.
Definition at line 979 of file blackmagic_common.cpp.
References BMD_BOOL, bmd_hresult_to_string(), FAILED, and MSG.
Referenced by display_decklink_get_property(), print_output_modes(), and vidcap_decklink_print_card_info().

| template bool decklink_supports_codec< IDeckLinkInput > | ( | IDeckLinkInput * | deckLink, |
| BMDPixelFormat | pf ) |
| template bool decklink_supports_codec< IDeckLinkOutput > | ( | IDeckLinkOutput * | deckLink, |
| BMDPixelFormat | pf ) |
| void decklink_uninitialize | ( | bool * | com_initialized | ) |
| com_initialized | - pointer passed to create_decklink_iterator |
Definition at line 197 of file blackmagic_common.cpp.
References com_uninitialize().
Referenced by blackmagic_api_version_check(), create_decklink_iterator(), decklink_help(), display_decklink_done(), display_decklink_probe(), show_help(), and vidcap_decklink_probe().

|
static |
Definition at line 575 of file blackmagic_common.cpp.
References BMDFCC.
Referenced by bmd_option::device_write().
|
static |
Definition at line 880 of file blackmagic_common.cpp.
Referenced by r10k_full_to_limited().

|
static |
Definition at line 857 of file blackmagic_common.cpp.
Referenced by r10k_limited_to_full().

| BMD_STR get_bmd_api_str_from_cstr | ( | const char * | cstr | ) |
Definition at line 125 of file blackmagic_common.cpp.
References BMD_STR.
Referenced by bmd_option::device_write().
| const map< BMDVideoConnection, string > & get_connection_string_map | ( | ) |
Definition at line 948 of file blackmagic_common.cpp.
Referenced by bmd_option::device_write(), parse_option(), vidcap_decklink_print_card_info(), and vidcap_decklink_probe().
| char * get_cstr_from_bmd_api_str | ( | BMD_STR | bmd_string | ) |
returned c-sring needs to be freed when not used
Definition at line 104 of file blackmagic_common.cpp.
References len.
Referenced by bmd_get_device_name(), get_str_from_bmd_api_str(), and print_decklink_version().
| std::string get_str_from_bmd_api_str | ( | BMD_STR | string | ) |
Definition at line 155 of file blackmagic_common.cpp.
References get_cstr_from_bmd_api_str().
Referenced by get_input_modes(), get_mode(), device_state::init(), print_bmd_attribute(), print_output_modes(), and set_display_mode_properties().

|
static |
Definition at line 315 of file blackmagic_common.cpp.
References bmd_hresult_to_string(), FAILED, LOG, LOG_LEVEL_ERROR, and MOD_NAME.
Referenced by decklink_get_active_profile_id(), and ProfileCallback::WaitForProfileActivation().

| std::ostream & operator<< | ( | std::ostream & | output, |
| const bmd_option & | b ) |
Definition at line 620 of file blackmagic_common.cpp.
| std::ostream & operator<< | ( | std::ostream & | output, |
| REFIID | iid ) |
Definition at line 547 of file blackmagic_common.cpp.
References flags.
| void print_bmd_attribute | ( | IDeckLinkProfileAttributes * | deckLinkAttributes, |
| const char * | query_prop_fcc ) |
Definition at line 1036 of file blackmagic_common.cpp.
References BMD_BOOL, bmd_hresult_to_string(), BMD_STR, get_str_from_bmd_api_str(), key, LOG, LOG_LEVEL_ERROR, min, MOD_NAME, release_bmd_api_str(), and SBOLD.
Referenced by print_output_modes(), and vidcap_decklink_print_card_info().

| void print_bmd_device_profiles | ( | const char * | line_prefix | ) |
Definition at line 939 of file blackmagic_common.cpp.
References color_printf(), kDeviceProfiles, and TBOLD.
Referenced by decklink_help(), decklink_set_profile(), and show_help().

| void print_decklink_version | ( | void | ) |
Definition at line 249 of file blackmagic_common.cpp.
References BMD_STR, cleanup(), com_initialize(), com_uninitialize(), FAILED, get_cstr_from_bmd_api_str(), and release_bmd_api_str().
Referenced by blackmagic_api_version_check(), decklink_help(), and show_help().

| void r10k_full_to_limited | ( | const char * | in, |
| char * | out, | ||
| size_t | len ) |
converts from full range (4-1019) to 64-960
in and out pointers can point to the same address
Definition at line 892 of file blackmagic_common.cpp.
References apply_r10k_lut(), DEBUG_TIMER_START, DEBUG_TIMER_STOP, fill_full_to_limited_lut(), len, r10k_limited_to_full(), and respawn_parallel().
Referenced by display_decklink_putf().

| void r10k_limited_to_full | ( | const char * | in, |
| char * | out, | ||
| size_t | len ) |
converts from range 64-960 to 4-1019
in and out pointers can point to the same address
Definition at line 869 of file blackmagic_common.cpp.
References apply_r10k_lut(), DEBUG_TIMER_START, DEBUG_TIMER_STOP, fill_limited_to_full_lut(), len, r10k_limited_to_full(), and respawn_parallel().
Referenced by postprocess_frame(), r10k_full_to_limited(), and r10k_limited_to_full().

| void release_bmd_api_str | ( | BMD_STR | string | ) |
Definition at line 141 of file blackmagic_common.cpp.
Referenced by bmd_get_device_name(), bmd_option::device_write(), get_input_modes(), get_mode(), device_state::init(), print_bmd_attribute(), print_decklink_version(), print_output_modes(), and set_display_mode_properties().
|
static |
Definition at line 294 of file blackmagic_common.cpp.
Referenced by print_bmd_device_profiles(), and ProfileCallback::WaitForProfileActivation().