diff --git a/net/ndi/Cargo.toml b/net/ndi/Cargo.toml index ba66332f..ba825dcf 100644 --- a/net/ndi/Cargo.toml +++ b/net/ndi/Cargo.toml @@ -19,12 +19,11 @@ byteorder = "1.0" atomic_refcell = "0.1" [build-dependencies] -gst-plugin-version-helper = "0.7" +gst-plugin-version-helper = { path = "../../version-helper" } [features] -default = ["interlaced-fields", "reference-timestamps", "sink"] +default = ["interlaced-fields", "sink"] interlaced-fields = ["gst/v1_16", "gst-video/v1_16"] -reference-timestamps = [] sink = ["gst/v1_18", "gst-base/v1_18"] advanced-sdk = [] diff --git a/net/ndi/src/lib.rs b/net/ndi/src/lib.rs index d1287ec4..2401c6c3 100644 --- a/net/ndi/src/lib.rs +++ b/net/ndi/src/lib.rs @@ -141,10 +141,8 @@ static DEFAULT_RECEIVER_NDI_NAME: Lazy = Lazy::new(|| { ) }); -#[cfg(feature = "reference-timestamps")] static TIMECODE_CAPS: Lazy = Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timecode", &[])); -#[cfg(feature = "reference-timestamps")] static TIMESTAMP_CAPS: Lazy = Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timestamp", &[])); diff --git a/net/ndi/src/ndisinkcombiner/imp.rs b/net/ndi/src/ndisinkcombiner/imp.rs index 1511e192..92d09223 100644 --- a/net/ndi/src/ndisinkcombiner/imp.rs +++ b/net/ndi/src/ndisinkcombiner/imp.rs @@ -83,16 +83,16 @@ impl ElementImpl for NdiSinkCombiner { static PAD_TEMPLATES: Lazy> = Lazy::new(|| { let caps = gst_video::VideoCapsBuilder::new() .format_list([ - gst_video::VideoFormat::Uyvy, - gst_video::VideoFormat::I420, - gst_video::VideoFormat::Nv12, - gst_video::VideoFormat::Nv21, - gst_video::VideoFormat::Yv12, - gst_video::VideoFormat::Bgra, - gst_video::VideoFormat::Bgrx, - gst_video::VideoFormat::Rgba, - gst_video::VideoFormat::Rgbx, - ]) + gst_video::VideoFormat::Uyvy, + gst_video::VideoFormat::I420, + gst_video::VideoFormat::Nv12, + gst_video::VideoFormat::Nv21, + gst_video::VideoFormat::Yv12, + gst_video::VideoFormat::Bgra, + gst_video::VideoFormat::Bgrx, + gst_video::VideoFormat::Rgba, + gst_video::VideoFormat::Rgbx, + ]) .framerate_range(gst::Fraction::new(1, i32::MAX)..gst::Fraction::new(i32::MAX, 1)) .build(); let src_pad_template = gst::PadTemplate::with_gtype( diff --git a/net/ndi/src/ndisrcdemux/imp.rs b/net/ndi/src/ndisrcdemux/imp.rs index cc460274..491e370d 100644 --- a/net/ndi/src/ndisrcdemux/imp.rs +++ b/net/ndi/src/ndisrcdemux/imp.rs @@ -283,7 +283,6 @@ impl NdiSrcDemux { if element.num_src_pads() == 2 { element.no_more_pads(); } - } for ev in events { diff --git a/net/ndi/src/receiver.rs b/net/ndi/src/receiver.rs index 74281b59..ca7d3b4e 100644 --- a/net/ndi/src/receiver.rs +++ b/net/ndi/src/receiver.rs @@ -1291,22 +1291,19 @@ impl Receiver { buffer.set_pts(pts); buffer.set_duration(duration); - #[cfg(feature = "reference-timestamps")] - { + gst::ReferenceTimestampMeta::add( + buffer, + &*TIMECODE_CAPS, + gst::ClockTime::from_nseconds(video_frame.timecode() as u64 * 100), + gst::ClockTime::NONE, + ); + if video_frame.timestamp() != ndisys::NDIlib_recv_timestamp_undefined { gst::ReferenceTimestampMeta::add( buffer, - &*TIMECODE_CAPS, - gst::ClockTime::from_nseconds(video_frame.timecode() as u64 * 100), + &*TIMESTAMP_CAPS, + gst::ClockTime::from_nseconds(video_frame.timestamp() as u64 * 100), gst::ClockTime::NONE, ); - if video_frame.timestamp() != ndisys::NDIlib_recv_timestamp_undefined { - gst::ReferenceTimestampMeta::add( - buffer, - &*TIMESTAMP_CAPS, - gst::ClockTime::from_nseconds(video_frame.timestamp() as u64 * 100), - gst::ClockTime::NONE, - ); - } } #[cfg(feature = "interlaced-fields")] @@ -1667,22 +1664,19 @@ impl Receiver { buffer.set_pts(pts); buffer.set_duration(duration); - #[cfg(feature = "reference-timestamps")] - { + gst::ReferenceTimestampMeta::add( + buffer, + &*TIMECODE_CAPS, + gst::ClockTime::from_nseconds(audio_frame.timecode() as u64 * 100), + gst::ClockTime::NONE, + ); + if audio_frame.timestamp() != ndisys::NDIlib_recv_timestamp_undefined { gst::ReferenceTimestampMeta::add( buffer, - &*TIMECODE_CAPS, - gst::ClockTime::from_nseconds(audio_frame.timecode() as u64 * 100), + &*TIMESTAMP_CAPS, + gst::ClockTime::from_nseconds(audio_frame.timestamp() as u64 * 100), gst::ClockTime::NONE, ); - if audio_frame.timestamp() != ndisys::NDIlib_recv_timestamp_undefined { - gst::ReferenceTimestampMeta::add( - buffer, - &*TIMESTAMP_CAPS, - gst::ClockTime::from_nseconds(audio_frame.timestamp() as u64 * 100), - gst::ClockTime::NONE, - ); - } } let mut dest = buffer.map_writable().unwrap();