From ea14f36a0d1dda10e465f149a1d8d0c2a3162694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 3 Jun 2019 19:47:26 +0300 Subject: Update for the TryInto/TryFrom gstreamer API changes --- gst-plugin-closedcaption/src/mcc_parse.rs | 7 ++++--- gst-plugin-closedcaption/src/scc_parse.rs | 2 ++ gst-plugin-closedcaption/tests/scc_parse.rs | 2 ++ gst-plugin-sodium/src/decrypter.rs | 4 +++- gst-plugin-sodium/src/encrypter.rs | 4 +++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/gst-plugin-closedcaption/src/mcc_parse.rs b/gst-plugin-closedcaption/src/mcc_parse.rs index 298a55ce7..8b3403fb2 100644 --- a/gst-plugin-closedcaption/src/mcc_parse.rs +++ b/gst-plugin-closedcaption/src/mcc_parse.rs @@ -25,6 +25,7 @@ use gst::subclass::prelude::*; use gst_video::{self, ValidVideoTimeCode}; use std::cmp; +use std::convert::TryInto; use std::sync::{Mutex, MutexGuard}; use crate::line_reader::LineReader; @@ -735,7 +736,7 @@ impl MccParse { )); } - let size = match q.get_result().try_into_bytes().unwrap() { + let size = match q.get_result().try_into().unwrap() { gst::format::Bytes(Some(size)) => size, gst::format::Bytes(None) => { return Err(gst_loggable_error!( @@ -1037,7 +1038,7 @@ impl MccParse { let (rate, flags, start_type, start, stop_type, stop) = event.get(); - let mut start = match start.try_into_time() { + let mut start = match start.try_into() { Ok(start) => start, Err(_) => { gst_error!(CAT, obj: element, "seek has invalid format"); @@ -1045,7 +1046,7 @@ impl MccParse { } }; - let mut stop = match stop.try_into_time() { + let mut stop = match stop.try_into() { Ok(stop) => stop, Err(_) => { gst_error!(CAT, obj: element, "seek has invalid format"); diff --git a/gst-plugin-closedcaption/src/scc_parse.rs b/gst-plugin-closedcaption/src/scc_parse.rs index 866434a4b..379556e9a 100644 --- a/gst-plugin-closedcaption/src/scc_parse.rs +++ b/gst-plugin-closedcaption/src/scc_parse.rs @@ -97,6 +97,8 @@ impl State { framerate: gst::Fraction, element: &gst::Element, ) -> Result { + use std::convert::TryInto; + let timecode = gst_video::VideoTimeCode::new( framerate, None, diff --git a/gst-plugin-closedcaption/tests/scc_parse.rs b/gst-plugin-closedcaption/tests/scc_parse.rs index 1f16e3085..447f253d5 100644 --- a/gst-plugin-closedcaption/tests/scc_parse.rs +++ b/gst-plugin-closedcaption/tests/scc_parse.rs @@ -111,6 +111,8 @@ fn test_parse() { /// Test that ensures timecode parsing is the expected one #[test] fn test_timecodes() { + use std::convert::TryInto; + init(); let data = include_bytes!("timecodes-cut-down-sample.scc").as_ref(); diff --git a/gst-plugin-sodium/src/decrypter.rs b/gst-plugin-sodium/src/decrypter.rs index e11bca861..7bcd18c78 100644 --- a/gst-plugin-sodium/src/decrypter.rs +++ b/gst-plugin-sodium/src/decrypter.rs @@ -327,6 +327,8 @@ impl Decrypter { true } QueryView::Duration(ref mut q) => { + use std::convert::TryInto; + if q.get_format() != gst::Format::Bytes { return pad.query_default(Some(element), query); } @@ -339,7 +341,7 @@ impl Decrypter { return false; } - let size = match peer_query.get_result().try_into_bytes().unwrap() { + let size = match peer_query.get_result().try_into().unwrap() { gst::format::Bytes(Some(size)) => size, gst::format::Bytes(None) => { gst_error!(CAT, "Failed to query upstream duration"); diff --git a/gst-plugin-sodium/src/encrypter.rs b/gst-plugin-sodium/src/encrypter.rs index 28d2a614a..21d08ac78 100644 --- a/gst-plugin-sodium/src/encrypter.rs +++ b/gst-plugin-sodium/src/encrypter.rs @@ -368,6 +368,8 @@ impl Encrypter { true } QueryView::Duration(ref mut q) => { + use std::convert::TryInto; + if q.get_format() != gst::Format::Bytes { return pad.query_default(Some(element), query); } @@ -380,7 +382,7 @@ impl Encrypter { return false; } - let size = match peer_query.get_result().try_into_bytes().unwrap() { + let size = match peer_query.get_result().try_into().unwrap() { gst::format::Bytes(Some(size)) => size, gst::format::Bytes(None) => { gst_error!(CAT, "Failed to query upstream duration"); -- cgit v1.2.3