mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-02 00:11:01 +00:00
Add new timestamp mode based on the receive time and timecode
In addition to the old one based on the receive time and timestamp. Also make that new mode the default as it will usually give more accurate results because the timestamp is just the send time while the timecode is usually set by the sender based on the media timestamps.
This commit is contained in:
parent
a02fe56871
commit
84e4fe7f59
4 changed files with 16 additions and 9 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -20,12 +20,14 @@ use once_cell::sync::Lazy;
|
|||
#[repr(u32)]
|
||||
#[genum(type_name = "GstNdiTimestampMode")]
|
||||
pub enum TimestampMode {
|
||||
#[genum(name = "Receive Time", nick = "receive-time")]
|
||||
ReceiveTime = 0,
|
||||
#[genum(name = "Receive Time / Timecode", nick = "receive-time-vs-timecode")]
|
||||
ReceiveTimeTimecode = 0,
|
||||
#[genum(name = "Receive Time / Timestamp", nick = "receive-time-vs-timestamp")]
|
||||
ReceiveTimeTimestamp = 1,
|
||||
#[genum(name = "NDI Timecode", nick = "timecode")]
|
||||
Timecode = 1,
|
||||
Timecode = 2,
|
||||
#[genum(name = "NDI Timestamp", nick = "timestamp")]
|
||||
Timestamp = 2,
|
||||
Timestamp = 3,
|
||||
}
|
||||
|
||||
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||
|
|
|
@ -39,7 +39,7 @@ impl Default for Settings {
|
|||
connect_timeout: 10000,
|
||||
timeout: 5000,
|
||||
bandwidth: ndisys::NDIlib_recv_bandwidth_highest,
|
||||
timestamp_mode: TimestampMode::ReceiveTime,
|
||||
timestamp_mode: TimestampMode::ReceiveTimeTimecode,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ static PROPERTIES: [subclass::Property; 7] = [
|
|||
"Timestamp Mode",
|
||||
"Timestamp information to use for outgoing PTS",
|
||||
TimestampMode::static_type(),
|
||||
TimestampMode::ReceiveTime as i32,
|
||||
TimestampMode::ReceiveTimeTimecode as i32,
|
||||
glib::ParamFlags::READWRITE,
|
||||
)
|
||||
}),
|
||||
|
|
|
@ -40,7 +40,7 @@ impl Default for Settings {
|
|||
connect_timeout: 10000,
|
||||
timeout: 5000,
|
||||
bandwidth: ndisys::NDIlib_recv_bandwidth_highest,
|
||||
timestamp_mode: TimestampMode::ReceiveTime,
|
||||
timestamp_mode: TimestampMode::ReceiveTimeTimecode,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ static PROPERTIES: [subclass::Property; 7] = [
|
|||
"Timestamp Mode",
|
||||
"Timestamp information to use for outgoing PTS",
|
||||
TimestampMode::static_type(),
|
||||
TimestampMode::ReceiveTime as i32,
|
||||
TimestampMode::ReceiveTimeTimecode as i32,
|
||||
glib::ParamFlags::READWRITE,
|
||||
)
|
||||
}),
|
||||
|
|
|
@ -812,7 +812,12 @@ impl<T: ReceiverType> Receiver<T> {
|
|||
);
|
||||
|
||||
let (pts, duration) = match self.0.timestamp_mode {
|
||||
TimestampMode::ReceiveTime => self.0.observations.process(
|
||||
TimestampMode::ReceiveTimeTimecode => {
|
||||
self.0
|
||||
.observations
|
||||
.process(self.0.cat, element, (timecode, receive_time), duration)
|
||||
}
|
||||
TimestampMode::ReceiveTimeTimestamp => self.0.observations.process(
|
||||
self.0.cat,
|
||||
element,
|
||||
(timestamp, receive_time),
|
||||
|
|
Loading…
Reference in a new issue