Update for gstreamer-rs/glib/etc API changes and add more explicit Some()

This commit is contained in:
Sebastian Dröge 2019-04-16 10:09:42 +03:00
parent f5b88d37c5
commit 129f6a28b0
18 changed files with 47 additions and 44 deletions

View file

@ -316,7 +316,7 @@ impl BaseTransformImpl for AudioEcho {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rsaudioecho", 0, AudioEcho::get_type())
gst::Element::register(Some(plugin), "rsaudioecho", 0, AudioEcho::get_type())
}
struct RingBuffer {

View file

@ -488,9 +488,9 @@ impl ObjectSubclass for MccEnc {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, "sink");
let sinkpad = gst::Pad::new_from_template(&templ, Some("sink"));
let templ = klass.get_pad_template("src").unwrap();
let srcpad = gst::Pad::new_from_template(&templ, "src");
let srcpad = gst::Pad::new_from_template(&templ, Some("src"));
MccEnc::set_pad_functions(&sinkpad, &srcpad);
@ -630,5 +630,5 @@ impl ElementImpl for MccEnc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "mccenc", 0, MccEnc::get_type())
gst::Element::register(Some(plugin), "mccenc", 0, MccEnc::get_type())
}

View file

@ -58,7 +58,10 @@ impl PullState {
fn new(element: &gst::Element, pad: &gst::Pad) -> Self {
Self {
need_stream_start: true,
stream_id: pad.create_stream_id(element, "src").unwrap().to_string(),
stream_id: pad
.create_stream_id(element, Some("src"))
.unwrap()
.to_string(),
offset: 0,
duration: gst::CLOCK_TIME_NONE,
}
@ -1195,9 +1198,9 @@ impl ObjectSubclass for MccParse {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, "sink");
let sinkpad = gst::Pad::new_from_template(&templ, Some("sink"));
let templ = klass.get_pad_template("src").unwrap();
let srcpad = gst::Pad::new_from_template(&templ, "src");
let srcpad = gst::Pad::new_from_template(&templ, Some("src"));
MccParse::set_pad_functions(&sinkpad, &srcpad);
@ -1287,5 +1290,5 @@ impl ElementImpl for MccParse {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "mccparse", 0, MccParse::get_type())
gst::Element::register(Some(plugin), "mccparse", 0, MccParse::get_type())
}

View file

@ -368,9 +368,9 @@ impl ObjectSubclass for SccEnc {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, "sink");
let sinkpad = gst::Pad::new_from_template(&templ, Some("sink"));
let templ = klass.get_pad_template("src").unwrap();
let srcpad = gst::Pad::new_from_template(&templ, "src");
let srcpad = gst::Pad::new_from_template(&templ, Some("src"));
SccEnc::set_pad_functions(&sinkpad, &srcpad);
@ -450,5 +450,5 @@ impl ElementImpl for SccEnc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "sccenc", 0, SccEnc::get_type())
gst::Element::register(Some(plugin), "sccenc", 0, SccEnc::get_type())
}

View file

@ -480,9 +480,9 @@ impl ObjectSubclass for SccParse {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, "sink");
let sinkpad = gst::Pad::new_from_template(&templ, Some("sink"));
let templ = klass.get_pad_template("src").unwrap();
let srcpad = gst::Pad::new_from_template(&templ, "src");
let srcpad = gst::Pad::new_from_template(&templ, Some("src"));
SccParse::set_pad_functions(&sinkpad, &srcpad);
@ -559,5 +559,5 @@ impl ElementImpl for SccParse {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "sccparse", 0, SccParse::get_type())
gst::Element::register(Some(plugin), "sccparse", 0, SccParse::get_type())
}

View file

@ -324,5 +324,5 @@ impl URIHandlerImpl for FileSink {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rsfilesink", 256 + 100, FileSink::get_type())
gst::Element::register(Some(plugin), "rsfilesink", 256 + 100, FileSink::get_type())
}

View file

@ -378,5 +378,5 @@ impl URIHandlerImpl for FileSrc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rsfilesrc", 256 + 100, FileSrc::get_type())
gst::Element::register(Some(plugin), "rsfilesrc", 256 + 100, FileSrc::get_type())
}

View file

@ -136,7 +136,7 @@ impl ObjectSubclass for FlvDemux {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, "sink");
let sinkpad = gst::Pad::new_from_template(&templ, Some("sink"));
sinkpad.set_activate_function(|pad, parent| {
FlvDemux::catch_panic_pad_function(
@ -644,7 +644,7 @@ impl FlvDemux {
fn create_srcpad(&self, element: &gst::Element, name: &str, caps: &gst::Caps) -> gst::Pad {
let templ = element.get_element_class().get_pad_template(name).unwrap();
let srcpad = gst::Pad::new_from_template(&templ, name);
let srcpad = gst::Pad::new_from_template(&templ, Some(name));
srcpad.set_event_function(|pad, parent, event| {
FlvDemux::catch_panic_pad_function(
@ -664,7 +664,7 @@ impl FlvDemux {
srcpad.set_active(true).unwrap();
let full_stream_id = srcpad.create_stream_id(element, name).unwrap();
let full_stream_id = srcpad.create_stream_id(element, Some(name)).unwrap();
// FIXME group id
srcpad.push_event(gst::Event::new_stream_start(&full_stream_id).build());
srcpad.push_event(gst::Event::new_caps(&caps).build());
@ -1580,5 +1580,5 @@ impl Metadata {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rsflvdemux", 256 + 100, FlvDemux::get_type())
gst::Element::register(Some(plugin), "rsflvdemux", 256 + 100, FlvDemux::get_type())
}

View file

@ -471,5 +471,5 @@ impl ObjectSubclass for HttpSrc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rshttpsrc", 256 + 100, HttpSrc::get_type())
gst::Element::register(Some(plugin), "rshttpsrc", 256 + 100, HttpSrc::get_type())
}

View file

@ -542,7 +542,7 @@ impl ObjectSubclass for AppSrc {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("src").unwrap();
let src_pad = gst::Pad::new_from_template(&templ, "src");
let src_pad = gst::Pad::new_from_template(&templ, Some("src"));
src_pad.set_event_function(|pad, parent, event| {
AppSrc::catch_panic_pad_function(
@ -686,5 +686,5 @@ impl ElementImpl for AppSrc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "ts-appsrc", 0, AppSrc::get_type())
gst::Element::register(Some(plugin), "ts-appsrc", 0, AppSrc::get_type())
}

View file

@ -658,7 +658,7 @@ impl ObjectSubclass for ProxySink {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sink_pad = gst::Pad::new_from_template(&templ, "sink");
let sink_pad = gst::Pad::new_from_template(&templ, Some("sink"));
sink_pad.set_chain_function(|pad, parent, buffer| {
ProxySink::catch_panic_pad_function(
@ -1200,7 +1200,7 @@ impl ObjectSubclass for ProxySrc {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("src").unwrap();
let src_pad = gst::Pad::new_from_template(&templ, "src");
let src_pad = gst::Pad::new_from_template(&templ, Some("src"));
src_pad.set_event_function(|pad, parent, event| {
ProxySrc::catch_panic_pad_function(
@ -1348,6 +1348,6 @@ impl ElementImpl for ProxySrc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "ts-proxysink", 0, ProxySink::get_type())?;
gst::Element::register(plugin, "ts-proxysrc", 0, ProxySrc::get_type())
gst::Element::register(Some(plugin), "ts-proxysink", 0, ProxySink::get_type())?;
gst::Element::register(Some(plugin), "ts-proxysrc", 0, ProxySrc::get_type())
}

View file

@ -792,9 +792,9 @@ impl ObjectSubclass for Queue {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sink_pad = gst::Pad::new_from_template(&templ, "sink");
let sink_pad = gst::Pad::new_from_template(&templ, Some("sink"));
let templ = klass.get_pad_template("src").unwrap();
let src_pad = gst::Pad::new_from_template(&templ, "src");
let src_pad = gst::Pad::new_from_template(&templ, Some("src"));
sink_pad.set_chain_function(|pad, parent, buffer| {
Queue::catch_panic_pad_function(
@ -957,5 +957,5 @@ impl ElementImpl for Queue {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "ts-queue", 0, Queue::get_type())
gst::Element::register(Some(plugin), "ts-queue", 0, Queue::get_type())
}

View file

@ -605,7 +605,7 @@ impl ObjectSubclass for TcpClientSrc {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("src").unwrap();
let src_pad = gst::Pad::new_from_template(&templ, "src");
let src_pad = gst::Pad::new_from_template(&templ, Some("src"));
src_pad.set_event_function(|pad, parent, event| {
TcpClientSrc::catch_panic_pad_function(
@ -755,5 +755,5 @@ impl ElementImpl for TcpClientSrc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "ts-tcpclientsrc", 0, TcpClientSrc::get_type())
gst::Element::register(Some(plugin), "ts-tcpclientsrc", 0, TcpClientSrc::get_type())
}

View file

@ -947,7 +947,7 @@ impl ObjectSubclass for UdpSrc {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("src").unwrap();
let src_pad = gst::Pad::new_from_template(&templ, "src");
let src_pad = gst::Pad::new_from_template(&templ, Some("src"));
src_pad.set_event_function(|pad, parent, event| {
UdpSrc::catch_panic_pad_function(
@ -1139,5 +1139,5 @@ impl ElementImpl for UdpSrc {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "ts-udpsrc", 0, UdpSrc::get_type())
gst::Element::register(Some(plugin), "ts-udpsrc", 0, UdpSrc::get_type())
}

View file

@ -1149,9 +1149,9 @@ impl ObjectSubclass for ToggleRecord {
fn new_with_class(klass: &subclass::simple::ClassStruct<Self>) -> Self {
let templ = klass.get_pad_template("sink").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, "sink");
let sinkpad = gst::Pad::new_from_template(&templ, Some("sink"));
let templ = klass.get_pad_template("src").unwrap();
let srcpad = gst::Pad::new_from_template(&templ, "src");
let srcpad = gst::Pad::new_from_template(&templ, Some("src"));
ToggleRecord::set_pad_functions(&sinkpad, &srcpad);
@ -1350,10 +1350,10 @@ impl ElementImpl for ToggleRecord {
*pad_count += 1;
let templ = element.get_pad_template("sink_%u").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, format!("sink_{}", id).as_str());
let sinkpad = gst::Pad::new_from_template(&templ, Some(format!("sink_{}", id).as_str()));
let templ = element.get_pad_template("src_%u").unwrap();
let srcpad = gst::Pad::new_from_template(&templ, format!("src_{}", id).as_str());
let srcpad = gst::Pad::new_from_template(&templ, Some(format!("src_{}", id).as_str()));
ToggleRecord::set_pad_functions(&sinkpad, &srcpad);
@ -1399,5 +1399,5 @@ impl ElementImpl for ToggleRecord {
}
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "togglerecord", 0, ToggleRecord::get_type())
gst::Element::register(Some(plugin), "togglerecord", 0, ToggleRecord::get_type())
}

View file

@ -168,9 +168,9 @@ impl ObjectSubclass for Identity {
// Create our two pads from the templates that were registered with
// the class
let templ = klass.get_pad_template("sink").unwrap();
let sinkpad = gst::Pad::new_from_template(&templ, "sink");
let sinkpad = gst::Pad::new_from_template(&templ, Some("sink"));
let templ = klass.get_pad_template("src").unwrap();
let srcpad = gst::Pad::new_from_template(&templ, "src");
let srcpad = gst::Pad::new_from_template(&templ, Some("src"));
// And then set all our pad functions for handling anything that happens
// on these pads
@ -274,5 +274,5 @@ impl ElementImpl for Identity {
// the name "rsidentity" for being able to instantiate it via e.g.
// gst::ElementFactory::make().
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rsidentity", 0, Identity::get_type())
gst::Element::register(Some(plugin), "rsidentity", 0, Identity::get_type())
}

View file

@ -567,5 +567,5 @@ impl BaseTransformImpl for Rgb2Gray {
// the name "rsrgb2gray" for being able to instantiate it via e.g.
// gst::ElementFactory::make().
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rsrgb2gray", 0, Rgb2Gray::get_type())
gst::Element::register(Some(plugin), "rsrgb2gray", 0, Rgb2Gray::get_type())
}

View file

@ -859,5 +859,5 @@ impl BaseSrcImpl for SineSrc {
// the name "sinesrc" for being able to instantiate it via e.g.
// gst::ElementFactory::make().
pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
gst::Element::register(plugin, "rssinesrc", 0, SineSrc::get_type())
gst::Element::register(Some(plugin), "rssinesrc", 0, SineSrc::get_type())
}