MCPcopy Create free account
hub / github.com/DistroAV/DistroAV / ndi_source_thread_process_audio3

Function ndi_source_thread_process_audio3

src/ndi-source.cpp:759–789  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

757}
758
759void ndi_source_thread_process_audio3(ndi_source_config_t *config, NDIlib_audio_frame_v3_t *ndi_audio_frame,
760 obs_source_t *obs_source, obs_source_audio *obs_audio_frame)
761{
762 if (!config->audio_enabled) {
763 return;
764 }
765
766 const int channelCount = ndi_audio_frame->no_channels > 8 ? 8 : ndi_audio_frame->no_channels;
767
768 obs_audio_frame->speakers = channel_count_to_layout(channelCount);
769
770 switch (config->sync_mode) {
771 case PROP_SYNC_NDI_TIMESTAMP:
772 obs_audio_frame->timestamp = (uint64_t)(ndi_audio_frame->timestamp * 100);
773 break;
774
775 case PROP_SYNC_NDI_SOURCE_TIMECODE:
776 obs_audio_frame->timestamp = (uint64_t)(ndi_audio_frame->timecode * 100);
777 break;
778 }
779
780 obs_audio_frame->samples_per_sec = ndi_audio_frame->sample_rate;
781 obs_audio_frame->format = AUDIO_FORMAT_FLOAT_PLANAR;
782 obs_audio_frame->frames = ndi_audio_frame->no_samples;
783 for (int i = 0; i < channelCount; ++i) {
784 obs_audio_frame->data[i] =
785 (uint8_t *)ndi_audio_frame->p_data + (i * ndi_audio_frame->channel_stride_in_bytes);
786 }
787
788 obs_source_output_audio(obs_source, obs_audio_frame);
789}
790
791void ndi_source_thread_process_video2(ndi_source_t *source, NDIlib_video_frame_v2_t *ndi_video_frame,
792 obs_source *obs_source, obs_source_frame *obs_video_frame)

Callers 1

ndi_source_threadFunction · 0.85

Calls 1

channel_count_to_layoutFunction · 0.85

Tested by

no test coverage detected