sccparse: Simplify timecode handling a bit

This commit is contained in:
Sebastian Dröge 2020-12-30 13:02:09 +02:00
parent a88fe95fee
commit 02310d8720

View file

@ -124,10 +124,7 @@ fn parse_timecode(
0, 0,
); );
match gst_video::ValidVideoTimeCode::try_from(timecode).map_err(|_| gst::FlowError::Error) { gst_video::ValidVideoTimeCode::try_from(timecode).map_err(|_| gst::FlowError::Error)
Ok(timecode) => Ok(timecode),
Err(timecode) => Err(timecode),
}
} }
impl State { impl State {
@ -157,7 +154,7 @@ impl State {
) -> Result<gst_video::ValidVideoTimeCode, gst::FlowError> { ) -> Result<gst_video::ValidVideoTimeCode, gst::FlowError> {
match parse_timecode(framerate, &tc) { match parse_timecode(framerate, &tc) {
Ok(timecode) => Ok(timecode), Ok(timecode) => Ok(timecode),
Err(timecode) => { Err(err) => {
let last_timecode = let last_timecode =
self.last_timecode self.last_timecode
.as_ref() .as_ref()
@ -166,7 +163,7 @@ impl State {
element_error!( element_error!(
element, element,
gst::StreamError::Decode, gst::StreamError::Decode,
["Invalid first timecode {:?}", timecode] ["Invalid first timecode {:?}", err]
); );
gst::FlowError::Error gst::FlowError::Error
@ -176,7 +173,7 @@ impl State {
CAT, CAT,
obj: element, obj: element,
"Invalid timecode {:?}, using previous {:?}", "Invalid timecode {:?}, using previous {:?}",
timecode, err,
last_timecode last_timecode
); );