Commit 9af2823f authored by Guillaume Desmottes's avatar Guillaume Desmottes 🐐

cdgparse: fix time to bytes None conversion

Time(None) should be converted to Bytes(None).

Fix seeking with stop=-1
parent 288908ed
......@@ -96,13 +96,13 @@ fn bytes_to_time(bytes: u64) -> gst::ClockTime {
gst::ClockTime::from_nseconds(ns)
}
fn time_to_bytes(time: gst::ClockTime) -> Option<Bytes> {
fn time_to_bytes(time: gst::ClockTime) -> Bytes {
match time.nseconds() {
Some(time) => {
let bytes = time.mul_div_round(CDG_PACKET_PERIOD * CDG_PACKET_SIZE as u64, SECOND_VAL);
Some(Bytes(bytes))
Bytes(bytes)
}
None => None,
None => Bytes(None),
}
}
......@@ -212,10 +212,7 @@ impl BaseParseImpl for CdgParse {
gst::GenericFormattedValue::Time(bytes_to_time(bytes.unwrap())),
),
(gst::GenericFormattedValue::Time(time), gst::Format::Bytes) => {
match time_to_bytes(time) {
Some(bytes) => Some(gst::GenericFormattedValue::Bytes(bytes)),
None => None,
}
Some(time_to_bytes(time).into())
}
_ => None,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment