codec/subtitle: properly use Option for pts handling

This commit is contained in:
meh 2015-09-09 16:45:16 +02:00
parent 3f282a8202
commit 8d8e2aa94e

View File

@ -62,12 +62,15 @@ impl Subtitle {
} }
} }
pub fn pts(&self) -> i64 { pub fn pts(&self) -> Option<i64> {
self.0.pts as i64 match self.0.pts {
AV_NOPTS_VALUE => None,
pts => Some(pts)
}
} }
pub fn set_pts(&mut self, value: i64) { pub fn set_pts(&mut self, value: Option<i64>) {
self.0.pts = value as int64_t; self.0.pts = value.unwrap_or(AV_NOPTS_VALUE);
} }
pub fn start(&self) -> u32 { pub fn start(&self) -> u32 {