![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include <DeckLinkAPIVersion.h>#include <algorithm>#include <array>#include <atomic>#include <cctype>#include <chrono>#include <cinttypes>#include <cmath>#include <cstdint>#include <cstdio>#include <cstdlib>#include <cstring>#include <exception>#include <iostream>#include <iterator>#include <map>#include <memory>#include <mutex>#include <queue>#include <sstream>#include <stdexcept>#include <string>#include <utility>#include <vector>#include "audio/types.h"#include "blackmagic_common.hpp"#include "compat/htonl.h"#include "compat/strings.h"#include "debug.h"#include "host.h"#include "lib_common.h"#include "module.h"#include "tv.h"#include "ug_runtime_error.hpp"#include "utils/macros.h"#include "utils/math.h"#include "utils/misc.h"#include "utils/string.h"#include "video.h"#include "video_display.h"#include "video_display/decklink_drift_fix.hpp"
Go to the source code of this file.
Classes | |
| struct | state_decklink |
| struct | state_decklink::aud_desc |
| struct | state_decklink::vid_desc |
Macros | |
| #define | CALL_AND_CHECK(cmd, name) |
| #define | CHECK_CH_COUNT(channels) |
| only 2, 8, 16, 32 and 64 are supported according to BMD SDK doc | |
| #define | DECKLINK_MAGIC to_fourcc('v', 'd', 'D', 'L') |
| #define | EXIT_IF_FAILED(cmd, name) |
| #define | MOD_NAME "[DeckLink display] " |
| #define | RELEASE_IF_NOT_NULL(x) |
| #define | STDMETHODCALLTYPE |
Typedefs | |
| using | hrc = std::chrono::high_resolution_clock |
Functions | |
| static DeckLinkFrame * | allocate_new_decklink_frame (struct state_decklink *s) |
| static void | debug_print_metadata_id (const char *fn_name, BMDDeckLinkFrameMetadataID metadataID) |
| static void | display_decklink_done (void *state) |
| static bool | display_decklink_get_property (void *state, int property, void *val, size_t *len) |
| static struct video_frame * | display_decklink_getf (void *state) |
| static void * | display_decklink_init (struct module *parent, const char *fmt, unsigned int flags) |
| static void | display_decklink_probe (struct device_info **available_cards, int *count, void(**deleter)(void *)) |
| static void | display_decklink_put_audio_frame (void *state, const struct audio_frame *frame) |
| static bool | display_decklink_putf (void *state, struct video_frame *frame, long long timeout_ns) |
| static bool | display_decklink_reconfigure (void *state, struct video_desc desc) |
| static bool | display_decklink_reconfigure_audio (void *state, int quant_samples, int channels, int sample_rate) |
| static bool | enable_audio (struct state_decklink *s, int bps, int channels) |
| static BMDDisplayMode | get_mode (IDeckLinkOutput *deckLinkOutput, struct video_desc desc, BMDTimeValue *frameRateDuration, BMDTimeScale *frameRateScale, bool stereo) |
| static bool | operator== (const REFIID &first, const REFIID &second) |
| static void | print_output_modes (IDeckLink *deckLink, const char *query_prop_fcc) |
| REGISTER_MODULE (decklink, &display_decklink_info, LIBRARY_CLASS_VIDEO_DISPLAY, VIDEO_DISPLAY_ABI_VERSION) | |
| static void | set_audio_props (state_decklink *s, IDeckLinkConfiguration *deckLinkConfiguration, unsigned int audio_output) |
| static void | set_low_latency (struct state_decklink *s, bool on) |
| static bool | settings_init (struct state_decklink *s, const char *fmt, string &cardId) |
| static void | show_help (bool full, const char *query_prop_fcc=nullptr) |
| static void | update_timecode (DeckLinkTimecode *tc, double fps) |
Variables | |
| static const struct video_display_info | display_decklink_info |
TestPattern example from BMD SDK was used to consult correct BMD workflow usage and also SignalGenerator was used for scheduled playback.
Definition in file decklink.cpp.
| #define CALL_AND_CHECK | ( | cmd, | |
| name ) |
Definition at line 114 of file decklink.cpp.
Referenced by display_decklink_reconfigure().
| #define CHECK_CH_COUNT | ( | channels | ) |
only 2, 8, 16, 32 and 64 are supported according to BMD SDK doc
Definition at line 1325 of file decklink.cpp.
Referenced by display_decklink_reconfigure_audio(), and set_audio_props().
Definition at line 72 of file decklink.cpp.
Referenced by display_decklink_getf(), display_decklink_putf(), and display_decklink_reconfigure().
| #define EXIT_IF_FAILED | ( | cmd, | |
| name ) |
Definition at line 104 of file decklink.cpp.
Referenced by display_decklink_reconfigure(), and enable_audio().
| #define MOD_NAME "[DeckLink display] " |
Definition at line 73 of file decklink.cpp.
Referenced by display_decklink_reconfigure(), and get_mode().
| #define RELEASE_IF_NOT_NULL | ( | x | ) |
Definition at line 97 of file decklink.cpp.
| #define STDMETHODCALLTYPE |
Definition at line 94 of file decklink.cpp.
| using hrc = std::chrono::high_resolution_clock |
Definition at line 122 of file decklink.cpp.
|
static |
Definition at line 688 of file decklink.cpp.
References state_decklink::buffer_pool, state_decklink::pixelFormat, state_decklink::requested_hdr_mode, state_decklink::stereo, and vc_get_linesize().
Referenced by display_decklink_getf().

|
inlinestatic |
Definition at line 2011 of file decklink.cpp.
References LOG, log_level, LOG_LEVEL_DEBUG2, and MOD_NAME.
|
static |
Definition at line 1573 of file decklink.cpp.
References state_decklink::buffer_pool, CALL_AND_CHECK, state_decklink::com_initialized, debug_msg, state_decklink::deckLink, decklink_uninitialize(), state_decklink::deckLinkAttributes, state_decklink::deckLinkConfiguration, state_decklink::deckLinkOutput, state_decklink::initialized, state_decklink::low_latency, state_decklink::play_audio, RELEASE_IF_NOT_NULL, state, and state_decklink::timecode.
Referenced by display_decklink_init().

|
static |
Definition at line 1613 of file decklink.cpp.
References AC_PCM, codecs, count, decklink_supports_codec(), state_decklink::deckLinkOutput, desc, DISPLAY_PROPERTY_AUDIO_FORMAT, DISPLAY_PROPERTY_BUF_PITCH, DISPLAY_PROPERTY_CODECS, DISPLAY_PROPERTY_RGB_SHIFT, DISPLAY_PROPERTY_SUPPORTED_IL_MODES, DISPLAY_PROPERTY_VIDEO_MODE, DISPLAY_PROPERTY_VIDEO_SEPARATE_3D, INTERLACED_MERGED, len, state_decklink::max_aud_chans, next_power_of_two(), PITCH_DEFAULT, PROGRESSIVE, property, SEGMENTED_FRAME, state, uv_to_bmd_codec_map, and val.

|
static |
Definition at line 702 of file decklink.cpp.
References allocate_new_decklink_frame(), state_decklink::audio_reconfigure, state_decklink::buffer_pool, video_frame::callbacks, tile::data, DECKLINK_MAGIC, display_decklink_reconfigure(), video_frame_callbacks::dispose, video_frame_callbacks::dispose_udata, frame, state_decklink::initialized, state_decklink::magic, MSG, state_decklink::pixelFormat, state, state_decklink::stereo, video_frame::tiles, vc_get_linesize(), vf_alloc_desc(), and vf_free().

|
static |
Definition at line 1392 of file decklink.cpp.
References state_decklink::audio_drift_fixer, blackmagic_api_version_check(), BMD_BOOL, BMD_FALSE, bmd_get_device_name(), bmd_get_sorted_devices(), bmd_hresult_to_string(), BMD_TRUE, state_decklink::com_initialized, state_decklink::deckLink, decklink_set_profile(), state_decklink::deckLinkAttributes, state_decklink::deckLinkConfiguration, state_decklink::deckLinkOutput, state_decklink::delegate, state_decklink::device_options, display_decklink_done(), DISPLAY_FLAG_AUDIO_ANY, state_decklink::emit_timecode, flags, fmt, get_root_module(), INIT_NOERR, invalid_arg_is_numeric(), IS_KEY_PREFIX, bmd_option::keep(), state_decklink::keep_device_defaults, LOG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, log_msg(), state_decklink::low_latency, MOD_NAME, MSG, parent, state_decklink::profile_req, state_decklink::requested_hdr_mode, set_audio_props(), AudioDriftFixer::set_root(), settings_init(), show_help(), state_decklink::stereo, and state_decklink::timecode.

|
static |
Definition at line 1132 of file decklink.cpp.
References bmd_get_device_name(), bmd_get_sorted_devices(), count, decklink_uninitialize(), deleter, dev_add_option(), name, and UNUSED.

|
static |
Definition at line 1728 of file decklink.cpp.
References state_decklink::audio_drift_fixer, state_decklink::audio_reconfigure, state_decklink::deckLinkOutput, state_decklink::delegate, FAILED, frame, LOG, log_level, LOG_LEVEL_DEBUG, LOG_LEVEL_VERBOSE, LOG_LEVEL_WARNING, log_msg(), state_decklink::low_latency, MOD_NAME, state_decklink::play_audio, state, and AudioDriftFixer::update().

|
static |
Definition at line 803 of file decklink.cpp.
References video_frame::callbacks, video_frame::color_spec, tile::data, tile::data_len, DECKLINK_MAGIC, state_decklink::deckLinkFrame, state_decklink::deckLinkOutput, state_decklink::delegate, video_frame_callbacks::dispose, video_frame_callbacks::dispose_udata, state_decklink::emit_timecode, frame, get_commandline_param(), state_decklink::low_latency, state_decklink::magic, R10k, R10K_FULL_OPT, r10k_full_to_limited(), state, video_frame::tile_count, video_frame::tiles, state_decklink::timecode, video_frame::timestamp, and update_timecode().

|
static |
Definition at line 923 of file decklink.cpp.
References BMD_BOOL, bmd_check_stereo_profile(), BMD_FALSE, bmd_hresult_to_string(), BMD_TRUE, CALL_AND_CHECK, codec_is_a_rgb(), video_desc::color_spec, DECKLINK_MAGIC, decklink_set_profile(), desc, bmd_option::device_write(), enable_audio(), EXIT_IF_FAILED, FAILED, video_desc::fps, state_decklink::frameRateDuration, state_decklink::frameRateScale, get_commandline_param(), get_mode(), video_desc::height, LOG, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, log_msg(), MOD_NAME, R10k, R10K_FULL_OPT, state, video_desc::tile_count, uv_to_bmd_codec_map, and video_desc::width.
Referenced by display_decklink_getf().

|
static |
Definition at line 1773 of file decklink.cpp.
References AC_PCM, state_decklink::audio_reconf_lock, state_decklink::audio_reconfigure, channels, CHECK_CH_COUNT, LOG, LOG_LEVEL_VERBOSE, MOD_NAME, state_decklink::play_audio, quant_samples, sample_rate, and state.
|
static |
Definition at line 907 of file decklink.cpp.
References channels, state_decklink::deckLinkOutput, EXIT_IF_FAILED, and state_decklink::low_latency.
Referenced by display_decklink_reconfigure().
|
static |
Definition at line 843 of file decklink.cpp.
References BMD_STR, bug_msg(), state_decklink::deckLinkOutput, desc, FAILED, video_desc::fps, state_decklink::frameRateDuration, state_decklink::frameRateScale, get_str_from_bmd_api_str(), video_desc::height, INTERLACED_MERGED, video_desc::interlacing, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, log_msg(), MOD_NAME, MSG, release_bmd_api_str(), state_decklink::stereo, and video_desc::width.
Referenced by display_decklink_reconfigure().

|
static |
Definition at line 1797 of file decklink.cpp.
|
static |
Definition at line 2161 of file decklink.cpp.
References bmd_get_flags_str(), BMD_STR, color_printf(), decklink_supports_codec(), get_codec_name(), get_str_from_bmd_api_str(), LOG_LEVEL_ERROR, log_msg(), MOD_NAME, MSG, print_bmd_attribute(), release_bmd_api_str(), TERM_BOLD, TERM_RESET, and uv_to_bmd_codec_map.
Referenced by show_help().

| REGISTER_MODULE | ( | decklink | , |
| & | display_decklink_info, | ||
| LIBRARY_CLASS_VIDEO_DISPLAY | , | ||
| VIDEO_DISPLAY_ABI_VERSION | ) |
|
static |
Definition at line 1330 of file decklink.cpp.
References bmd_hresult_to_string(), CHECK_CH_COUNT, state_decklink::deckLinkAttributes, DISPLAY_FLAG_AUDIO_AESEBU, DISPLAY_FLAG_AUDIO_ANALOG, DISPLAY_FLAG_AUDIO_EMBEDDED, get_audio_conn_flag_name(), state_decklink::max_aud_chans, MSG, and state_decklink::play_audio.
Referenced by display_decklink_init().

|
static |
Definition at line 1187 of file decklink.cpp.
References state_decklink::low_latency, and MSG.
Referenced by settings_init().
|
static |
Definition at line 1199 of file decklink.cpp.
References state_decklink::audio_drift_fixer, bmd_parse_audio_levels(), bmd_read_fourcc(), state_decklink::delegate, state_decklink::device_options, state_decklink::emit_timecode, AudioDriftFixer::enable(), fmt, IS_KEY_PREFIX, IS_PREFIX, is_prefix_of(), state_decklink::keep_device_defaults, LOG, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, log_msg(), state_decklink::low_latency, MOD_NAME, bmd_option::parse(), parse_uint32(), state_decklink::profile_req, state_decklink::quad_square_division_split, state_decklink::requested_hdr_mode, bmd_option::set_flag(), bmd_option::set_int(), set_low_latency(), AudioDriftFixer::set_max_hz(), AudioDriftFixer::set_min_hz(), AudioDriftFixer::set_target_buffer(), state_decklink::stereo, and val.

|
static |
| query_prop_fcc | if not NULL, print corresponding BMDDeckLinkAttribute |
Definition at line 550 of file decklink.cpp.
References bmd_get_device_name(), bmd_get_sorted_devices(), BMD_NAT_SORT, color_printf(), decklink_uninitialize(), get_commandline_param(), LOG_LEVEL_WARNING, log_msg(), print_bmd_device_profiles(), print_decklink_version(), print_output_modes(), SBOLD, SRED, STR_LEN, TBOLD, TGREEN, and uv_to_bmd_codec_map.

|
static |
Definition at line 763 of file decklink.cpp.
References video_frame::fps.
Referenced by display_decklink_putf().
|
static |
Definition at line 2256 of file decklink.cpp.