Skip to content

Commit

Permalink
Add a property async_compensation to switch asynchronous SRC
Browse files Browse the repository at this point in the history
This commit implements a property to enable asynchronous sample rate
conversion (SRC) in the PR obsproject/obs-studio#6351.
This commit relies on the PR so that the implementation is disabled by
default.
Assuming the user of this plugin has enough knowledge for asynchronous
sample rate and genlock, the option is disabled by default.
  • Loading branch information
norihiro committed Apr 22, 2024
1 parent 68d922f commit c0d5e17
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(ID_PREFIX "net.nagater.obs-h8819-source.")
set(LINUX_MAINTAINER_EMAIL "[email protected]")

option(ENABLE_COVERAGE "Enable coverage option for GCC" OFF)
option(ENABLE_ASYNC_COMPENSATION "Enable async-compensation property for the PR 6351" OFF)

# TAKE NOTE: No need to edit things past this point

Expand Down
1 change: 1 addition & 0 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
"Ethernet device"="Ethernet device"
"Channel Left"="Channel Left"
"Channel Right"="Channel Right"
AsyncCompensation="Enable Asynchronous Compensation"
1 change: 1 addition & 0 deletions data/locale/ja-JP.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
"Ethernet device"="イーサネットデバイス"
"Channel Left"="左チャンネル"
"Channel Right"="右チャンネル"
AsyncCompensation="非同期補償を有効にする"
2 changes: 2 additions & 0 deletions src/plugin-macros.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#cmakedefine OS_LINUX
#cmakedefine OS_MACOS

#cmakedefine ENABLE_ASYNC_COMPENSATION

#define blog(level, msg, ...) blog(level, "[" PLUGIN_NAME "] " msg, ##__VA_ARGS__)

#endif // PLUGINNAME_H
7 changes: 7 additions & 0 deletions src/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ static obs_properties_t *get_properties(void *data)
capdev_enum_devices(device_name_enum_cb, prop);
obs_properties_add_int(props, "channel_l", obs_module_text("Channel Left"), 1, 40, 1);
obs_properties_add_int(props, "channel_r", obs_module_text("Channel Right"), 1, 40, 1);
#ifdef ENABLE_ASYNC_COMPENSATION
obs_properties_add_bool(props, "async_compensation", obs_module_text("AsyncCompensation"));
#endif

return props;
}
Expand Down Expand Up @@ -98,6 +101,10 @@ static void update(void *data, obs_data_t *settings)

if (channel_l != s->channel_l || channel_r != s->channel_r)
update_channels(s, channel_l, channel_r);

#ifdef ENABLE_ASYNC_COMPENSATION
obs_source_set_async_compensation(s->context, obs_data_get_bool(settings, "async_compensation"));
#endif
}

static void *create(obs_data_t *settings, obs_source_t *source)
Expand Down

0 comments on commit c0d5e17

Please sign in to comment.