Skip to content

Commit

Permalink
Merge pull request #459 from Palakis/bugfix/source-remove-internal-sy…
Browse files Browse the repository at this point in the history
…nc-mode

NDI Source: remove "Internal" from the options of the "Sync" property
  • Loading branch information
Palakis committed Apr 28, 2020
2 parents 6b71ea6 + ccbdf30 commit 79b216b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 22 deletions.
1 change: 0 additions & 1 deletion data/locale/ca-ES.ini
Expand Up @@ -12,7 +12,6 @@ NDIPlugin.SourceProps.ColorSpace="Espai de color YUV"
NDIPlugin.BWMode.Highest="El més alt"
NDIPlugin.BWMode.Lowest="El més baix"
NDIPlugin.BWMode.AudioOnly="Només àudio"
NDIPlugin.SyncMode.Internal="Intern"
NDIPlugin.SyncMode.NDITimestamp="Xarxa"
NDIPlugin.SyncMode.NDISourceTimecode="Temps de la font"
NDIPlugin.OutputName="Sortida NDI™"
Expand Down
1 change: 0 additions & 1 deletion data/locale/en-US.ini
Expand Up @@ -15,7 +15,6 @@ NDIPlugin.SourceProps.Latency.Low="Low (experimental)"
NDIPlugin.BWMode.Highest="Highest"
NDIPlugin.BWMode.Lowest="Lowest"
NDIPlugin.BWMode.AudioOnly="Audio Only"
NDIPlugin.SyncMode.Internal="Internal"
NDIPlugin.SyncMode.NDITimestamp="Network"
NDIPlugin.SyncMode.NDISourceTimecode="Source Timing"
NDIPlugin.OutputName="NDI™ Output"
Expand Down
1 change: 0 additions & 1 deletion data/locale/es-ES.ini
Expand Up @@ -15,7 +15,6 @@ NDIPlugin.SourceProps.Latency.Low="Baja (experimental)"
NDIPlugin.BWMode.Highest="La más alta"
NDIPlugin.BWMode.Lowest="La más baja"
NDIPlugin.BWMode.AudioOnly="Solo Audio"
NDIPlugin.SyncMode.Internal="Interno"
NDIPlugin.SyncMode.NDITimestamp="Red"
NDIPlugin.SyncMode.NDISourceTimecode="Tiempo de la fuente"
NDIPlugin.OutputName="Salida NDI™"
Expand Down
1 change: 0 additions & 1 deletion data/locale/fr-FR.ini
Expand Up @@ -15,7 +15,6 @@ NDIPlugin.SourceProps.Latency.Low="Réduite (expérimental)"
NDIPlugin.BWMode.Highest="Haut débit"
NDIPlugin.BWMode.Lowest="Bas débit"
NDIPlugin.BWMode.AudioOnly="Audio seulement"
NDIPlugin.SyncMode.Internal="Interne"
NDIPlugin.SyncMode.NDITimestamp="Réseau"
NDIPlugin.SyncMode.NDISourceTimecode="Timing de la source"
NDIPlugin.OutputName="Sortie NDI™"
Expand Down
1 change: 0 additions & 1 deletion data/locale/zh-CN.ini
Expand Up @@ -12,7 +12,6 @@ NDIPlugin.SourceProps.ColorSpace="YUV 颜色空间"
NDIPlugin.BWMode.Highest="最高"
NDIPlugin.BWMode.Lowest="最低"
NDIPlugin.BWMode.AudioOnly="仅音频"
NDIPlugin.SyncMode.Internal="内部"
NDIPlugin.SyncMode.NDITimestamp="网络"
NDIPlugin.SyncMode.NDISourceTimecode="来源定时"
NDIPlugin.OutputName="NDI™ 输出"
Expand Down
26 changes: 9 additions & 17 deletions src/obs-ndi-source.cpp
Expand Up @@ -41,6 +41,7 @@ along with this program; If not, see <https://www.gnu.org/licenses/>
#define PROP_BW_LOWEST 1
#define PROP_BW_AUDIO_ONLY 2

// sync mode "Internal" got removed
#define PROP_SYNC_INTERNAL 0
#define PROP_SYNC_NDI_TIMESTAMP 1
#define PROP_SYNC_NDI_SOURCE_TIMECODE 2
Expand Down Expand Up @@ -216,9 +217,6 @@ obs_properties_t* ndi_source_getproperties(void* data)
OBS_COMBO_TYPE_LIST,
OBS_COMBO_FORMAT_INT);

obs_property_list_add_int(sync_modes,
obs_module_text("NDIPlugin.SyncMode.Internal"),
PROP_SYNC_INTERNAL);
obs_property_list_add_int(sync_modes,
obs_module_text("NDIPlugin.SyncMode.NDITimestamp"),
PROP_SYNC_NDI_TIMESTAMP);
Expand Down Expand Up @@ -281,7 +279,7 @@ obs_properties_t* ndi_source_getproperties(void* data)
void ndi_source_getdefaults(obs_data_t* settings)
{
obs_data_set_default_int(settings, PROP_BANDWIDTH, PROP_BW_HIGHEST);
obs_data_set_default_int(settings, PROP_SYNC, PROP_SYNC_NDI_TIMESTAMP);
obs_data_set_default_int(settings, PROP_SYNC, PROP_SYNC_NDI_SOURCE_TIMECODE);
obs_data_set_default_int(settings, PROP_YUV_RANGE, PROP_YUV_RANGE_PARTIAL);
obs_data_set_default_int(settings, PROP_YUV_COLORSPACE, PROP_YUV_SPACE_BT709);
obs_data_set_default_int(settings, PROP_LATENCY, PROP_LATENCY_NORMAL);
Expand Down Expand Up @@ -314,14 +312,6 @@ void* ndi_source_poll_audio_video(void* data)
channel_count_to_layout(audio_frame.no_channels);

switch (s->sync_mode) {
case PROP_SYNC_INTERNAL:
default:
obs_audio_frame.timestamp = os_gettime_ns();
obs_audio_frame.timestamp +=
((uint64_t)audio_frame.no_samples * 1000000000ULL /
(uint64_t)audio_frame.sample_rate);
break;

case PROP_SYNC_NDI_TIMESTAMP:
obs_audio_frame.timestamp =
(uint64_t)(audio_frame.timestamp * 100.0);
Expand Down Expand Up @@ -377,11 +367,6 @@ void* ndi_source_poll_audio_video(void* data)
}

switch (s->sync_mode) {
case PROP_SYNC_INTERNAL:
default:
obs_video_frame.timestamp = os_gettime_ns();
break;

case PROP_SYNC_NDI_TIMESTAMP:
obs_video_frame.timestamp =
(uint64_t)(video_frame.timestamp * 100);
Expand Down Expand Up @@ -473,6 +458,13 @@ void ndi_source_update(void* data, obs_data_t* settings)
}

s->sync_mode = (int)obs_data_get_int(settings, PROP_SYNC);
// if sync mode is set to the unsupported "Internal" mode, set it
// to "Source Timing" mode and apply that change to the settings data
if (s->sync_mode == PROP_SYNC_INTERNAL) {
s->sync_mode == PROP_SYNC_NDI_SOURCE_TIMECODE;
obs_data_set_int(settings, PROP_SYNC, PROP_SYNC_NDI_SOURCE_TIMECODE);
}

s->yuv_range =
prop_to_range_type((int)obs_data_get_int(settings, PROP_YUV_RANGE));
s->yuv_colorspace =
Expand Down

0 comments on commit 79b216b

Please sign in to comment.