From 8d8e2aa94efcfdebbc83b38b592206d390c6e6f9 Mon Sep 17 00:00:00 2001 From: meh Date: Wed, 9 Sep 2015 16:45:16 +0200 Subject: [PATCH] codec/subtitle: properly use Option for pts handling --- src/codec/subtitle/mod.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/codec/subtitle/mod.rs b/src/codec/subtitle/mod.rs index 9d61823..308890b 100644 --- a/src/codec/subtitle/mod.rs +++ b/src/codec/subtitle/mod.rs @@ -62,12 +62,15 @@ impl Subtitle { } } - pub fn pts(&self) -> i64 { - self.0.pts as i64 + pub fn pts(&self) -> Option { + match self.0.pts { + AV_NOPTS_VALUE => None, + pts => Some(pts) + } } - pub fn set_pts(&mut self, value: i64) { - self.0.pts = value as int64_t; + pub fn set_pts(&mut self, value: Option) { + self.0.pts = value.unwrap_or(AV_NOPTS_VALUE); } pub fn start(&self) -> u32 {