forked from mirrors/gstreamer-rs
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;
|
||||
|
||||
use std::env;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub mod utils;
|
||||
|
||||
|
@ -27,7 +28,7 @@ fn main_loop(uri: &str) -> Result<(), utils::ExampleError> {
|
|||
.set_property("uri", &glib::Value::from(uri))
|
||||
.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 main_loop_clone = main_loop.clone();
|
||||
|
@ -40,14 +41,13 @@ fn main_loop(uri: &str) -> Result<(), utils::ExampleError> {
|
|||
|
||||
let player_clone = player.clone();
|
||||
let main_loop_clone = main_loop.clone();
|
||||
let error_clone = error.clone();
|
||||
let error_clone = Arc::clone(&error);
|
||||
player.connect_error(move |_, err| {
|
||||
let main_loop = &main_loop_clone;
|
||||
let player = &player_clone;
|
||||
let error = &error_clone;
|
||||
|
||||
let error = std::sync::Arc::clone(&error_clone);
|
||||
let mut guard = error.lock().unwrap();
|
||||
*guard = Err(utils::ExampleError::ElementError(
|
||||
*error.lock().unwrap() = Err(utils::ExampleError::ElementError(
|
||||
"player".to_owned(),
|
||||
err.clone(),
|
||||
"".to_owned(),
|
||||
|
|
Loading…
Reference in a new issue