mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 11:01:10 +00:00
Get rid of all usage of send-cell
This commit is contained in:
parent
c0422acf66
commit
8f9c0a72e0
3 changed files with 15 additions and 24 deletions
|
@ -18,7 +18,6 @@ gtk = { git = "https://github.com/gtk-rs/gtk", features = ["v3_6"], optional = t
|
|||
gdk = { git = "https://github.com/gtk-rs/gdk", optional = true }
|
||||
gio = { git = "https://github.com/gtk-rs/gio", optional = true }
|
||||
futures-preview = { version = "0.2", optional = true }
|
||||
send-cell = "0.1"
|
||||
byte-slice-cast = "0.2"
|
||||
failure = "0.1"
|
||||
failure_derive = "0.1"
|
||||
|
|
|
@ -11,7 +11,6 @@ gstreamer = { path = "../gstreamer" }
|
|||
gstreamer-audio = { path = "../gstreamer-audio" }
|
||||
gstreamer-video = { path = "../gstreamer-video" }
|
||||
gstreamer-app = { path = "../gstreamer-app" }
|
||||
send-cell = "0.1"
|
||||
byte-slice-cast = "0.2"
|
||||
|
||||
[badges]
|
||||
|
|
|
@ -13,9 +13,6 @@ mod tutorial5 {
|
|||
extern crate gtk;
|
||||
use self::gtk::*;
|
||||
|
||||
extern crate send_cell;
|
||||
use self::send_cell::SendCell;
|
||||
|
||||
extern crate gstreamer as gst;
|
||||
extern crate gstreamer_video as gst_video;
|
||||
use self::gst_video::prelude::*;
|
||||
|
@ -48,12 +45,7 @@ mod tutorial5 {
|
|||
}
|
||||
|
||||
// Extract tags from streams of @stype and add the info in the UI.
|
||||
fn add_streams_info(
|
||||
playbin: &gst::Element,
|
||||
textbufcell: &SendCell<gtk::TextBuffer>,
|
||||
stype: &str,
|
||||
) {
|
||||
let textbuf = textbufcell.borrow();
|
||||
fn add_streams_info(playbin: &gst::Element, textbuf: >k::TextBuffer, stype: &str) {
|
||||
let propname: &str = &format!("n-{}", stype);
|
||||
let signame: &str = &format!("get-{}-tags", stype);
|
||||
|
||||
|
@ -94,15 +86,14 @@ mod tutorial5 {
|
|||
}
|
||||
|
||||
// Extract metadata from all the streams and write it to the text widget in the GUI
|
||||
fn analyze_streams(playbin: &gst::Element, textbufcell: &SendCell<gtk::TextBuffer>) {
|
||||
fn analyze_streams(playbin: &gst::Element, textbuf: >k::TextBuffer) {
|
||||
{
|
||||
let textbuf = textbufcell.borrow();
|
||||
textbuf.set_text("");
|
||||
}
|
||||
|
||||
add_streams_info(playbin, textbufcell, "video");
|
||||
add_streams_info(playbin, textbufcell, "audio");
|
||||
add_streams_info(playbin, textbufcell, "text");
|
||||
add_streams_info(playbin, textbuf, "video");
|
||||
add_streams_info(playbin, textbuf, "audio");
|
||||
add_streams_info(playbin, textbuf, "text");
|
||||
}
|
||||
|
||||
// This creates all the GTK+ widgets that compose our application, and registers the callbacks
|
||||
|
@ -256,11 +247,7 @@ mod tutorial5 {
|
|||
let streams_list = gtk::TextView::new();
|
||||
streams_list.set_editable(false);
|
||||
let pipeline_weak = playbin.downgrade();
|
||||
let textbuf = SendCell::new(
|
||||
streams_list
|
||||
.get_buffer()
|
||||
.expect("Couldn't get buffer from text_view"),
|
||||
);
|
||||
let streams_list_weak = glib::SendWeakRef::from(streams_list.downgrade());
|
||||
playbin
|
||||
.get_bus()
|
||||
.unwrap()
|
||||
|
@ -271,7 +258,15 @@ mod tutorial5 {
|
|||
None => return,
|
||||
};
|
||||
|
||||
let streams_list = match streams_list_weak.upgrade() {
|
||||
Some(streams_list) => streams_list,
|
||||
None => return,
|
||||
};
|
||||
|
||||
if application.get_structure().map(|s| s.get_name()) == Some("tags-changed") {
|
||||
let textbuf = streams_list
|
||||
.get_buffer()
|
||||
.expect("Couldn't get buffer from text_view");
|
||||
analyze_streams(&pipeline, &textbuf);
|
||||
}
|
||||
}
|
||||
|
@ -326,9 +321,7 @@ mod tutorial5 {
|
|||
let uri = "https://www.freedesktop.org/software/gstreamer-sdk/\
|
||||
data/media/sintel_trailer-480p.webm";
|
||||
let playbin = gst::ElementFactory::make("playbin", None).unwrap();
|
||||
playbin
|
||||
.set_property("uri", &uri)
|
||||
.unwrap();
|
||||
playbin.set_property("uri", &uri).unwrap();
|
||||
|
||||
playbin
|
||||
.connect("video-tags-changed", false, |args| {
|
||||
|
|
Loading…
Reference in a new issue