Skip to content

Commit

Permalink
decklink: Add option to activate async compensation
Browse files Browse the repository at this point in the history
Since the audio from the device is asynchronous, it requires to be
compensated so that the audio source provides exactly necessary amount
of samples.
The option is enabled by default.
  • Loading branch information
norihiro authored and pkviet committed Jul 25, 2022
1 parent ccb8761 commit 010f1a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions plugins/decklink/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#define KEYER "keyer"
#define SWAP "swap"
#define ALLOW_10_BIT "allow_10_bit"
#define ASYNC_COMPENSATION "async_compensation"

#define TEXT_DEVICE obs_module_text("Device")
#define TEXT_VIDEO_CONNECTION obs_module_text("VideoConnection")
Expand Down Expand Up @@ -57,3 +58,4 @@
#define TEXT_SWAP obs_module_text("SwapFC-LFE")
#define TEXT_SWAP_TOOLTIP obs_module_text("SwapFC-LFE.Tooltip")
#define TEXT_ALLOW_10_BIT obs_module_text("Allow10Bit")
#define TEXT_ASYNC_COMPENSATION obs_module_text("AsyncCompensation")
3 changes: 2 additions & 1 deletion plugins/decklink/data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ SwapFC-LFE="Swap FC and LFE"
SwapFC-LFE.Tooltip="Swap Front Center Channel and LFE Channel"
VideoConnection="Video Connection"
AudioConnection="Audio Connection"
Allow10Bit="Allow 10 Bit (Required for SDI captions, may cause performance overhead)"
Allow10Bit="Allow 10 Bit (Required for SDI captions, may cause performance overhead)"
AsyncCompensation="Enable Asynchronous Compensation"
8 changes: 8 additions & 0 deletions plugins/decklink/decklink-source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ static void decklink_update(void *data, obs_data_t *settings)
decklink->swap = obs_data_get_bool(settings, SWAP);
decklink->allow10Bit = obs_data_get_bool(settings, ALLOW_10_BIT);
decklink->Activate(device, id, videoConnection, audioConnection);

obs_source_set_async_compensation(
decklink->GetSource(),
obs_data_get_bool(settings, ASYNC_COMPENSATION));
}

static void decklink_show(void *data)
Expand Down Expand Up @@ -106,6 +110,7 @@ static void decklink_get_defaults(obs_data_t *settings)
obs_data_set_default_int(settings, COLOR_RANGE, VIDEO_RANGE_DEFAULT);
obs_data_set_default_int(settings, CHANNEL_FORMAT, SPEAKERS_STEREO);
obs_data_set_default_bool(settings, SWAP, false);
obs_data_set_default_bool(settings, ASYNC_COMPENSATION, true);
}

static const char *decklink_get_name(void *)
Expand Down Expand Up @@ -399,6 +404,9 @@ static obs_properties_t *decklink_get_properties(void *data)

obs_properties_add_bool(props, ALLOW_10_BIT, TEXT_ALLOW_10_BIT);

obs_properties_add_bool(props, ASYNC_COMPENSATION,
TEXT_ASYNC_COMPENSATION);

UNUSED_PARAMETER(data);
return props;
}
Expand Down

0 comments on commit 010f1a4

Please sign in to comment.