mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-24 07:58:12 +00:00
Clean up player example code a bit
This commit is contained in:
parent
6bb9eaf739
commit
50c8f32961
1 changed files with 5 additions and 5 deletions
|
@ -9,6 +9,7 @@ extern crate gstreamer_player as gst_player;
|
||||||
extern crate glib;
|
extern crate glib;
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ fn main_loop(uri: &str) -> Result<(), utils::ExampleError> {
|
||||||
.set_property("uri", &glib::Value::from(uri))
|
.set_property("uri", &glib::Value::from(uri))
|
||||||
.expect("Can't set uri property");
|
.expect("Can't set uri property");
|
||||||
|
|
||||||
let error = std::sync::Arc::new(std::sync::Mutex::new(Ok(())));
|
let error = Arc::new(Mutex::new(Ok(())));
|
||||||
|
|
||||||
let player_clone = player.clone();
|
let player_clone = player.clone();
|
||||||
let main_loop_clone = main_loop.clone();
|
let main_loop_clone = main_loop.clone();
|
||||||
|
@ -40,14 +41,13 @@ fn main_loop(uri: &str) -> Result<(), utils::ExampleError> {
|
||||||
|
|
||||||
let player_clone = player.clone();
|
let player_clone = player.clone();
|
||||||
let main_loop_clone = main_loop.clone();
|
let main_loop_clone = main_loop.clone();
|
||||||
let error_clone = error.clone();
|
let error_clone = Arc::clone(&error);
|
||||||
player.connect_error(move |_, err| {
|
player.connect_error(move |_, err| {
|
||||||
let main_loop = &main_loop_clone;
|
let main_loop = &main_loop_clone;
|
||||||
let player = &player_clone;
|
let player = &player_clone;
|
||||||
|
let error = &error_clone;
|
||||||
|
|
||||||
let error = std::sync::Arc::clone(&error_clone);
|
*error.lock().unwrap() = Err(utils::ExampleError::ElementError(
|
||||||
let mut guard = error.lock().unwrap();
|
|
||||||
*guard = Err(utils::ExampleError::ElementError(
|
|
||||||
"player".to_owned(),
|
"player".to_owned(),
|
||||||
err.clone(),
|
err.clone(),
|
||||||
"".to_owned(),
|
"".to_owned(),
|
||||||
|
|
Loading…
Reference in a new issue