Add Buffer::get_dts_or_pts()

This commit is contained in:
Sebastian Dröge 2017-12-02 12:15:07 +02:00
parent 411f54afed
commit c6c7693550

View file

@ -332,6 +332,15 @@ impl BufferRef {
self.0.dts = dts.to_glib();
}
pub fn get_dts_or_pts(&self) -> ClockTime {
let val = self.get_dts();
if val.is_none() {
self.get_pts()
} else {
val
}
}
pub fn get_duration(&self) -> ClockTime {
from_glib(self.0.duration)
}