ndi: Remove unnecessary reference-timestamps feature

This commit is contained in:
Sebastian Dröge 2022-10-12 19:39:33 +03:00
parent fedd67dcaa
commit fb8192f40b
5 changed files with 30 additions and 40 deletions

View file

@ -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 = []

View file

@ -141,10 +141,8 @@ static DEFAULT_RECEIVER_NDI_NAME: Lazy<String> = Lazy::new(|| {
)
});
#[cfg(feature = "reference-timestamps")]
static TIMECODE_CAPS: Lazy<gst::Caps> =
Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timecode", &[]));
#[cfg(feature = "reference-timestamps")]
static TIMESTAMP_CAPS: Lazy<gst::Caps> =
Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timestamp", &[]));

View file

@ -83,16 +83,16 @@ impl ElementImpl for NdiSinkCombiner {
static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = 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(

View file

@ -283,7 +283,6 @@ impl NdiSrcDemux {
if element.num_src_pads() == 2 {
element.no_more_pads();
}
}
for ev in events {

View file

@ -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();