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

Function ndi_source_thread_process_video2

src/ndi-source.cpp:791–851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)
793{
794 switch (ndi_video_frame->FourCC) {
795 case NDIlib_FourCC_type_BGRA:
796 obs_video_frame->format = VIDEO_FORMAT_BGRA;
797 break;
798
799 case NDIlib_FourCC_type_BGRX:
800 obs_video_frame->format = VIDEO_FORMAT_BGRX;
801 break;
802
803 case NDIlib_FourCC_type_RGBA:
804 case NDIlib_FourCC_type_RGBX:
805 obs_video_frame->format = VIDEO_FORMAT_RGBA;
806 break;
807
808 case NDIlib_FourCC_type_UYVY:
809 case NDIlib_FourCC_type_UYVA:
810 obs_video_frame->format = VIDEO_FORMAT_UYVY;
811 break;
812
813 case NDIlib_FourCC_type_I420:
814 obs_video_frame->format = VIDEO_FORMAT_I420;
815 break;
816
817 case NDIlib_FourCC_type_NV12:
818 obs_video_frame->format = VIDEO_FORMAT_NV12;
819 break;
820
821 default:
822 obs_log(LOG_ERROR, "ERR-430 - NDI Source uses an unsupported video pixel format: %d.",
823 ndi_video_frame->FourCC);
824 obs_log(LOG_DEBUG, "ndi_source_thread_process_video2: warning: unsupported video pixel format: %d",
825 ndi_video_frame->FourCC);
826 break;
827 }
828
829 auto config = &source->config;
830
831 switch (config->sync_mode) {
832 case PROP_SYNC_NDI_TIMESTAMP:
833 obs_video_frame->timestamp = (uint64_t)(ndi_video_frame->timestamp * 100);
834 break;
835
836 case PROP_SYNC_NDI_SOURCE_TIMECODE:
837 obs_video_frame->timestamp = (uint64_t)(ndi_video_frame->timecode * 100);
838 break;
839 }
840
841 source->width = ndi_video_frame->xres;
842 source->height = ndi_video_frame->yres;
843 source->last_frame_timestamp = obs_get_video_frame_time();
844
845 obs_video_frame->width = ndi_video_frame->xres;
846 obs_video_frame->height = ndi_video_frame->yres;
847 obs_video_frame->linesize[0] = ndi_video_frame->line_stride_in_bytes;
848 obs_video_frame->data[0] = ndi_video_frame->p_data;

Callers 1

ndi_source_threadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected