diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2019-06-07 13:36:41 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.com> | 2019-06-07 14:27:30 +0300 |
commit | 9af2823f588d678d1391073b3337bfec5b8df650 (patch) | |
tree | f052d9984f859be47c4fa925ec90f9d569f29fb5 | |
parent | 288908edc049b547a72531951b0e711f0dbbeaae (diff) |
cdgparse: fix time to bytes None conversion
Time(None) should be converted to Bytes(None).
Fix seeking with stop=-1
-rw-r--r-- | gst-plugin-cdg/src/cdgparse.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gst-plugin-cdg/src/cdgparse.rs b/gst-plugin-cdg/src/cdgparse.rs index 8a97b2474..4534e76c4 100644 --- a/gst-plugin-cdg/src/cdgparse.rs +++ b/gst-plugin-cdg/src/cdgparse.rs @@ -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, } |