forked from mirrors/gstreamer-rs
fix-getters-calls 0.3.0 pass
This commit is contained in:
parent
e80a29372a
commit
6ab9164dca
66 changed files with 288 additions and 323 deletions
|
@ -59,8 +59,8 @@ fn example_main() {
|
|||
.expect("Unable to set the pipeline to the `Playing` state");
|
||||
let pipeline = pipeline.dynamic_cast::<gst::Pipeline>().unwrap();
|
||||
|
||||
let sink = pipeline.get_by_name("sink").unwrap();
|
||||
let sinkpad = sink.get_static_pad("sink").unwrap();
|
||||
let sink = pipeline.by_name("sink").unwrap();
|
||||
let sinkpad = sink.static_pad("sink").unwrap();
|
||||
|
||||
// Need to move a new reference into the closure.
|
||||
// !!ATTENTION!!:
|
||||
|
|
|
@ -243,7 +243,7 @@ fn example_main() {
|
|||
|
||||
// Retrieve the custom meta from the buffer and print it.
|
||||
let meta = buffer
|
||||
.get_meta::<custom_meta::CustomMeta>()
|
||||
.meta::<custom_meta::CustomMeta>()
|
||||
.expect("No custom meta found");
|
||||
println!("Got buffer with label: {}", meta.label());
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ fn example_main() -> Result<(), Error> {
|
|||
// just now is either audio or video (or none of both, e.g. subtitles).
|
||||
let (is_audio, is_video) = {
|
||||
let media_type = src_pad.current_caps().and_then(|caps| {
|
||||
caps.get_structure(0).map(|s| {
|
||||
caps.structure(0).map(|s| {
|
||||
let name = s.name();
|
||||
(name.starts_with("audio/"), name.starts_with("video/"))
|
||||
})
|
||||
|
@ -163,7 +163,7 @@ fn example_main() -> Result<(), Error> {
|
|||
|
||||
// Get the queue element's sink pad and link the decodebin's newly created
|
||||
// src pad for the audio stream to it.
|
||||
let sink_pad = queue.get_static_pad("sink").expect("queue has no sinkpad");
|
||||
let sink_pad = queue.static_pad("sink").expect("queue has no sinkpad");
|
||||
src_pad.link(&sink_pad)?;
|
||||
} else if is_video {
|
||||
// decodebin found a raw videostream, so we build the follow-up pipeline to
|
||||
|
@ -187,7 +187,7 @@ fn example_main() -> Result<(), Error> {
|
|||
|
||||
// Get the queue element's sink pad and link the decodebin's newly created
|
||||
// src pad for the video stream to it.
|
||||
let sink_pad = queue.get_static_pad("sink").expect("queue has no sinkpad");
|
||||
let sink_pad = queue.static_pad("sink").expect("queue has no sinkpad");
|
||||
src_pad.link(&sink_pad)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ fn example_main() -> Result<(), Error> {
|
|||
|
||||
let (is_audio, is_video) = {
|
||||
let media_type = dbin_src_pad.current_caps().and_then(|caps| {
|
||||
caps.get_structure(0).map(|s| {
|
||||
caps.structure(0).map(|s| {
|
||||
let name = s.name();
|
||||
(name.starts_with("audio/"), name.starts_with("video/"))
|
||||
})
|
||||
|
@ -185,11 +185,9 @@ fn example_main() -> Result<(), Error> {
|
|||
// The encodebin will then automatically create an internal pipeline, that encodes
|
||||
// the audio stream in the format we specified in the EncodingProfile.
|
||||
let enc_sink_pad = encodebin
|
||||
.get_request_pad("audio_%u")
|
||||
.request_pad("audio_%u")
|
||||
.expect("Could not get audio pad from encodebin");
|
||||
let src_pad = resample
|
||||
.get_static_pad("src")
|
||||
.expect("resample has no srcpad");
|
||||
let src_pad = resample.static_pad("src").expect("resample has no srcpad");
|
||||
src_pad.link(&enc_sink_pad)?;
|
||||
|
||||
for e in elements {
|
||||
|
@ -198,7 +196,7 @@ fn example_main() -> Result<(), Error> {
|
|||
|
||||
// Get the queue element's sink pad and link the decodebin's newly created
|
||||
// src pad for the audio stream to it.
|
||||
let sink_pad = queue.get_static_pad("sink").expect("queue has no sinkpad");
|
||||
let sink_pad = queue.static_pad("sink").expect("queue has no sinkpad");
|
||||
dbin_src_pad.link(&sink_pad)?;
|
||||
} else if is_video {
|
||||
let queue = gst::ElementFactory::make("queue", None)
|
||||
|
@ -218,11 +216,9 @@ fn example_main() -> Result<(), Error> {
|
|||
// The encodebin will then automatically create an internal pipeline, that encodes
|
||||
// the audio stream in the format we specified in the EncodingProfile.
|
||||
let enc_sink_pad = encodebin
|
||||
.get_request_pad("video_%u")
|
||||
.request_pad("video_%u")
|
||||
.expect("Could not get video pad from encodebin");
|
||||
let src_pad = scale
|
||||
.get_static_pad("src")
|
||||
.expect("videoscale has no srcpad");
|
||||
let src_pad = scale.static_pad("src").expect("videoscale has no srcpad");
|
||||
src_pad.link(&enc_sink_pad)?;
|
||||
|
||||
for e in elements {
|
||||
|
@ -231,7 +227,7 @@ fn example_main() -> Result<(), Error> {
|
|||
|
||||
// Get the queue element's sink pad and link the decodebin's newly created
|
||||
// src pad for the video stream to it.
|
||||
let sink_pad = queue.get_static_pad("sink").expect("queue has no sinkpad");
|
||||
let sink_pad = queue.static_pad("sink").expect("queue has no sinkpad");
|
||||
dbin_src_pad.link(&sink_pad)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ fn main_loop(uri: &str) -> Result<(), glib::BoolError> {
|
|||
|
||||
println!(
|
||||
"Agingtv scratch-lines: {}",
|
||||
clip.get_child_property("scratch-lines")
|
||||
clip.child_property("scratch-lines")
|
||||
.unwrap()
|
||||
.serialize()
|
||||
.unwrap()
|
||||
|
|
|
@ -36,7 +36,7 @@ fn create_ui(app: >k::Application) {
|
|||
glsinkbin.set_property("sink", >kglsink).unwrap();
|
||||
// The gtkglsink creates the gtk widget for us. This is accessible through a property.
|
||||
// So we get it and use it later to add it to our gui.
|
||||
let widget = gtkglsink.get_property("widget").unwrap();
|
||||
let widget = gtkglsink.property("widget").unwrap();
|
||||
(glsinkbin, widget.get::<gtk::Widget>().unwrap().unwrap())
|
||||
} else {
|
||||
// Unfortunately, using the OpenGL widget didn't work out, so we will have to render
|
||||
|
@ -45,7 +45,7 @@ fn create_ui(app: >k::Application) {
|
|||
let sink = gst::ElementFactory::make("gtksink", None).unwrap();
|
||||
// The gtksink creates the gtk widget for us. This is accessible through a property.
|
||||
// So we get it and use it later to add it to our gui.
|
||||
let widget = sink.get_property("widget").unwrap();
|
||||
let widget = sink.property("widget").unwrap();
|
||||
(sink, widget.get::<gtk::Widget>().unwrap().unwrap())
|
||||
};
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ fn example_main() {
|
|||
|
||||
// Get the audiotestsrc element from the pipeline that GStreamer
|
||||
// created for us while parsing the launch syntax above.
|
||||
let src = pipeline.get_by_name("src").unwrap();
|
||||
let src = pipeline.by_name("src").unwrap();
|
||||
// Get the audiotestsrc's src-pad.
|
||||
let src_pad = src.get_static_pad("src").unwrap();
|
||||
let src_pad = src.static_pad("src").unwrap();
|
||||
// Add a probe handler on the audiotestsrc's src-pad.
|
||||
// This handler gets called for every buffer that passes the pad we probe.
|
||||
src_pad.add_probe(gst::PadProbeType::BUFFER, |_, probe_info| {
|
||||
|
|
|
@ -45,7 +45,7 @@ fn make_element(
|
|||
}
|
||||
|
||||
fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> {
|
||||
match element.get_static_pad(pad_name) {
|
||||
match element.static_pad(pad_name) {
|
||||
Some(pad) => Ok(pad),
|
||||
None => {
|
||||
let element_name = element.name();
|
||||
|
@ -55,7 +55,7 @@ fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad
|
|||
}
|
||||
|
||||
fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> {
|
||||
match element.get_request_pad(pad_name) {
|
||||
match element.request_pad(pad_name) {
|
||||
Some(pad) => Ok(pad),
|
||||
None => {
|
||||
let element_name = element.name();
|
||||
|
@ -72,7 +72,7 @@ fn connect_rtpbin_srcpad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(),
|
|||
|
||||
match pt {
|
||||
96 => {
|
||||
let sinkpad = get_static_pad(sink, "sink")?;
|
||||
let sinkpad = static_pad(sink, "sink")?;
|
||||
src_pad.link(&sinkpad)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -206,8 +206,8 @@ fn example_main() -> Result<(), Error> {
|
|||
}
|
||||
})?;
|
||||
|
||||
let srcpad = get_static_pad(&netsim, "src")?;
|
||||
let sinkpad = get_request_pad(&rtpbin, "recv_rtp_sink_0")?;
|
||||
let srcpad = static_pad(&netsim, "src")?;
|
||||
let sinkpad = request_pad(&rtpbin, "recv_rtp_sink_0")?;
|
||||
srcpad.link(&sinkpad)?;
|
||||
|
||||
let depay_weak = depay.downgrade();
|
||||
|
|
|
@ -41,7 +41,7 @@ fn make_element(
|
|||
}
|
||||
|
||||
fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> {
|
||||
match element.get_static_pad(pad_name) {
|
||||
match element.static_pad(pad_name) {
|
||||
Some(pad) => Ok(pad),
|
||||
None => {
|
||||
let element_name = element.name();
|
||||
|
@ -51,7 +51,7 @@ fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad
|
|||
}
|
||||
|
||||
fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> {
|
||||
match element.get_request_pad(pad_name) {
|
||||
match element.request_pad(pad_name) {
|
||||
Some(pad) => Ok(pad),
|
||||
None => {
|
||||
let element_name = element.name();
|
||||
|
@ -61,7 +61,7 @@ fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pa
|
|||
}
|
||||
|
||||
fn connect_decodebin_pad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(), Error> {
|
||||
let sinkpad = get_static_pad(&sink, "sink")?;
|
||||
let sinkpad = static_pad(&sink, "sink")?;
|
||||
src_pad.link(&sinkpad)?;
|
||||
|
||||
Ok(())
|
||||
|
@ -126,12 +126,12 @@ fn example_main() -> Result<(), Error> {
|
|||
}
|
||||
})?;
|
||||
|
||||
let srcpad = get_static_pad(&q2, "src")?;
|
||||
let sinkpad = get_request_pad(&rtpbin, "send_rtp_sink_0")?;
|
||||
let srcpad = static_pad(&q2, "src")?;
|
||||
let sinkpad = request_pad(&rtpbin, "send_rtp_sink_0")?;
|
||||
srcpad.link(&sinkpad)?;
|
||||
|
||||
let srcpad = get_static_pad(&rtpbin, "send_rtp_src_0")?;
|
||||
let sinkpad = get_static_pad(&sink, "sink")?;
|
||||
let srcpad = static_pad(&rtpbin, "send_rtp_src_0")?;
|
||||
let sinkpad = static_pad(&sink, "sink")?;
|
||||
srcpad.link(&sinkpad)?;
|
||||
|
||||
src.connect_pad_added(
|
||||
|
|
|
@ -67,7 +67,7 @@ fn example_main() -> Result<(), Error> {
|
|||
// Query the pipeline for elements implementing the GstTagsetter interface.
|
||||
// In our case, this will return the flacenc element.
|
||||
let tagsetter = pipeline
|
||||
.get_by_interface(gst::TagSetter::static_type())
|
||||
.by_interface(gst::TagSetter::static_type())
|
||||
.ok_or_else(|| anyhow!("No TagSetter found"))?;
|
||||
let tagsetter = tagsetter
|
||||
.dynamic_cast::<gst::TagSetter>()
|
||||
|
|
|
@ -41,7 +41,7 @@ fn create_pipeline(uri: String, out_path: std::path::PathBuf) -> Result<gst::Pip
|
|||
|
||||
// Get access to the appsink element.
|
||||
let appsink = pipeline
|
||||
.get_by_name("sink")
|
||||
.by_name("sink")
|
||||
.expect("Sink element not found")
|
||||
.downcast::<gst_app::AppSink>()
|
||||
.expect("Sink element is expected to be an appsink!");
|
||||
|
|
|
@ -70,7 +70,7 @@ fn example_main() {
|
|||
e.sync_state_with_parent().unwrap();
|
||||
}
|
||||
|
||||
let sink_pad = queue.get_static_pad("sink").unwrap();
|
||||
let sink_pad = queue.static_pad("sink").unwrap();
|
||||
src_pad
|
||||
.link(&sink_pad)
|
||||
.expect("Unable to link src pad to sink pad");
|
||||
|
|
|
@ -102,10 +102,7 @@ fn example_main() -> Result<(), Error> {
|
|||
.get::<gst::Caps>()
|
||||
.expect("typefinder \"have-type\" signal values[2]")
|
||||
.expect("typefinder \"have-type\" signal values[2]: no `caps`");
|
||||
let format_name = caps
|
||||
.get_structure(0)
|
||||
.expect("Failed to get format name")
|
||||
.name();
|
||||
let format_name = caps.structure(0).expect("Failed to get format name").name();
|
||||
|
||||
let demuxer = match format_name {
|
||||
"video/x-matroska" | "video/webm" => {
|
||||
|
@ -198,7 +195,7 @@ fn handle_demux_pad_added(
|
|||
// For that, we need to request a sink pad that fits our needs.
|
||||
let link_to_muxer = || -> Result<(), Error> {
|
||||
let queue_sink_pad = queue
|
||||
.get_request_pad("sink_%u")
|
||||
.request_pad("sink_%u")
|
||||
.expect("If this happened, something is terribly wrong");
|
||||
demux_src_pad.link(&queue_sink_pad)?;
|
||||
// Now that we requested a sink pad fitting our needs from the multiqueue,
|
||||
|
@ -213,7 +210,7 @@ fn handle_demux_pad_added(
|
|||
// Link the multiqueue's output for this stream to the matroskamuxer.
|
||||
// For that, we request an appropriate pad at the muxer, that fits our needs.
|
||||
let muxer_sink_pad = muxer
|
||||
.get_compatible_pad(&queue_src_pad, None)
|
||||
.compatible_pad(&queue_src_pad, None)
|
||||
.expect("Aww, you found a format that matroska doesn't support!");
|
||||
queue_src_pad.link(&muxer_sink_pad)?;
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ fn example_main() {
|
|||
.unwrap();
|
||||
|
||||
let pipeline = pipeline.dynamic_cast::<gst::Pipeline>().unwrap();
|
||||
let compositor = pipeline.get_by_name("compositor0").unwrap();
|
||||
let sinkpad = compositor.get_static_pad("sink_0").unwrap();
|
||||
let compositor = pipeline.by_name("compositor0").unwrap();
|
||||
let sinkpad = compositor.static_pad("sink_0").unwrap();
|
||||
|
||||
/* Completely contrived example that takes the 4:3 input video, cuts out a 5:4 frame
|
||||
* and then adds pillarbox borders to place it in a 16:9 target area */
|
||||
|
|
|
@ -53,7 +53,7 @@ where
|
|||
{
|
||||
use std::thread;
|
||||
|
||||
let l = runloop::CFRunLoop::get_main();
|
||||
let l = runloop::CFRunLoop::main();
|
||||
let t = thread::spawn(move || {
|
||||
let res = main();
|
||||
l.stop();
|
||||
|
|
|
@ -190,7 +190,7 @@ impl Gl {
|
|||
}
|
||||
|
||||
fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl {
|
||||
let gl = gl::Gl::load_with(|ptr| gl_context.get_proc_address(ptr) as *const _);
|
||||
let gl = gl::Gl::load_with(|ptr| gl_context.proc_address(ptr) as *const _);
|
||||
|
||||
let version = unsafe {
|
||||
let data = CStr::from_ptr(gl.GetString(gl::VERSION) as *const _)
|
||||
|
@ -353,7 +353,7 @@ impl App {
|
|||
use glutin::platform::unix::WindowExtUnix;
|
||||
use glutin::platform::ContextTraitExt;
|
||||
|
||||
let api = App::map_gl_api(windowed_context.get_api());
|
||||
let api = App::map_gl_api(windowed_context.api());
|
||||
|
||||
let (gl_context, gl_display, platform) = match unsafe { windowed_context.raw_handle() }
|
||||
{
|
||||
|
@ -362,7 +362,7 @@ impl App {
|
|||
let mut gl_display = None;
|
||||
|
||||
#[cfg(feature = "gst-gl-egl")]
|
||||
if let Some(display) = unsafe { windowed_context.get_egl_display() } {
|
||||
if let Some(display) = unsafe { windowed_context.egl_display() } {
|
||||
gl_display = Some(
|
||||
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) }
|
||||
.unwrap()
|
||||
|
@ -625,7 +625,7 @@ pub(crate) fn main_loop(app: App) -> Result<(), Error> {
|
|||
|
||||
println!(
|
||||
"Pixel format of the window's GL context {:?}",
|
||||
app.windowed_context.get_pixel_format()
|
||||
app.windowed_context.pixel_format()
|
||||
);
|
||||
|
||||
let gl = load(&app.windowed_context);
|
||||
|
@ -681,13 +681,13 @@ pub(crate) fn main_loop(app: App) -> Result<(), Error> {
|
|||
{
|
||||
if gst_gl_context.is_none() {
|
||||
gst_gl_context = glupload
|
||||
.get_property("context")
|
||||
.property("context")
|
||||
.unwrap()
|
||||
.get::<gst_gl::GLContext>()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let sync_meta = buffer.get_meta::<gst_gl::GLSyncMeta>().unwrap();
|
||||
let sync_meta = buffer.meta::<gst_gl::GLSyncMeta>().unwrap();
|
||||
sync_meta.set_sync_point(gst_gl_context.as_ref().unwrap());
|
||||
}
|
||||
|
||||
|
@ -705,9 +705,9 @@ pub(crate) fn main_loop(app: App) -> Result<(), Error> {
|
|||
|
||||
if needs_redraw {
|
||||
if let Some(frame) = curr_frame.as_ref() {
|
||||
let sync_meta = frame.buffer().get_meta::<gst_gl::GLSyncMeta>().unwrap();
|
||||
let sync_meta = frame.buffer().meta::<gst_gl::GLSyncMeta>().unwrap();
|
||||
sync_meta.wait(&shared_context);
|
||||
if let Some(texture) = frame.get_texture_id(0) {
|
||||
if let Some(texture) = frame.texture_id(0) {
|
||||
gl.draw_frame(texture as gl::types::GLuint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,10 +183,10 @@ impl AudioInfo {
|
|||
&self.0,
|
||||
src_val.format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
U::default_format().to_glib(),
|
||||
dest_val.as_mut_ptr(),
|
||||
)) {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
Some(U::from_raw(U::default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ mod tests {
|
|||
}
|
||||
|
||||
{
|
||||
let cmeta = buffer.get_meta::<AudioClippingMeta>().unwrap();
|
||||
let cmeta = buffer.meta::<AudioClippingMeta>().unwrap();
|
||||
assert_eq!(cmeta.start().try_into(), Ok(gst::format::Default(Some(1))));
|
||||
assert_eq!(cmeta.end().try_into(), Ok(gst::format::Default(Some(2))));
|
||||
}
|
||||
|
|
|
@ -766,7 +766,7 @@ unsafe extern "C" fn audio_decoder_getcaps<T: AudioDecoderImpl>(
|
|||
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||
AudioDecoderImpl::get_caps(
|
||||
AudioDecoderImpl::caps(
|
||||
imp,
|
||||
wrap.unsafe_cast_ref(),
|
||||
Option::<gst::Caps>::from_glib_borrow(filter)
|
||||
|
|
|
@ -682,7 +682,7 @@ unsafe extern "C" fn audio_encoder_getcaps<T: AudioEncoderImpl>(
|
|||
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||
AudioEncoderImpl::get_caps(
|
||||
AudioEncoderImpl::caps(
|
||||
imp,
|
||||
wrap.unsafe_cast_ref(),
|
||||
Option::<gst::Caps>::from_glib_borrow(filter)
|
||||
|
|
|
@ -293,19 +293,19 @@ impl UniqueAdapter {
|
|||
}
|
||||
|
||||
pub fn buffer(&self, nbytes: usize) -> Result<gst::Buffer, glib::BoolError> {
|
||||
self.0.get_buffer(nbytes)
|
||||
self.0.buffer(nbytes)
|
||||
}
|
||||
|
||||
pub fn buffer_fast(&self, nbytes: usize) -> Result<gst::Buffer, glib::BoolError> {
|
||||
self.0.get_buffer_fast(nbytes)
|
||||
self.0.buffer_fast(nbytes)
|
||||
}
|
||||
|
||||
pub fn buffer_list(&self, nbytes: usize) -> Result<gst::BufferList, glib::BoolError> {
|
||||
self.0.get_buffer_list(nbytes)
|
||||
self.0.buffer_list(nbytes)
|
||||
}
|
||||
|
||||
pub fn list(&self, nbytes: usize) -> Result<Vec<gst::Buffer>, glib::BoolError> {
|
||||
self.0.get_list(nbytes)
|
||||
self.0.list(nbytes)
|
||||
}
|
||||
|
||||
pub fn masked_scan_uint32(
|
||||
|
|
|
@ -83,11 +83,11 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
|||
self.as_ref().to_glib_none().0,
|
||||
src_val.format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
U::default_format().to_glib(),
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
Some(U::from_raw(U::default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -553,7 +553,7 @@ unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>(
|
|||
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||
imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||
})
|
||||
.map(|caps| caps.into_ptr())
|
||||
.unwrap_or(ptr::null_mut())
|
||||
|
|
|
@ -686,7 +686,7 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
|||
*stop = gst::ffi::GST_CLOCK_TIME_NONE;
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||
let (start_, stop_) = imp.get_times(wrap.unsafe_cast_ref(), buffer);
|
||||
let (start_, stop_) = imp.times(wrap.unsafe_cast_ref(), buffer);
|
||||
*start = start_.to_glib();
|
||||
*stop = stop_.to_glib();
|
||||
});
|
||||
|
@ -878,7 +878,7 @@ unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>(
|
|||
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||
imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||
})
|
||||
.map(|caps| caps.into_ptr())
|
||||
.unwrap_or(ptr::null_mut())
|
||||
|
|
|
@ -1080,7 +1080,7 @@ unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>(
|
|||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||
match imp.get_unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||
match imp.unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||
Some(s) => {
|
||||
*size = s;
|
||||
true
|
||||
|
|
|
@ -80,7 +80,7 @@ impl Harness {
|
|||
// Reimplementation of the C code so we don't have to duplicate all the callback code
|
||||
|
||||
let element = self.find_element(element_name).expect("Element not found");
|
||||
let pad = element.get_static_pad(pad_name).expect("Pad not found");
|
||||
let pad = element.static_pad(pad_name).expect("Pad not found");
|
||||
pad.add_probe(mask, func);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ impl VideoFrameGLExt for gst_video::VideoFrame<Readable> {
|
|||
}
|
||||
|
||||
fn texture_id(&self, idx: u32) -> Option<u32> {
|
||||
self.as_video_frame_ref().get_texture_id(idx)
|
||||
self.as_video_frame_ref().texture_id(idx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ mod tests {
|
|||
}
|
||||
|
||||
{
|
||||
let meta = buffer.get_meta::<NetAddressMeta>().unwrap();
|
||||
let meta = buffer.meta::<NetAddressMeta>().unwrap();
|
||||
let actual_addr = meta.addr().downcast::<gio::InetSocketAddress>().unwrap();
|
||||
|
||||
assert_eq!(actual_addr.port(), expected_addr.port());
|
||||
|
|
|
@ -389,9 +389,9 @@ mod tests {
|
|||
assert_eq!(rtp_buffer.csrc_count(), csrc_count);
|
||||
rtp_buffer.set_csrc(0, 12);
|
||||
rtp_buffer.set_csrc(1, 15);
|
||||
assert_eq!(rtp_buffer.get_csrc(0).unwrap(), 12);
|
||||
assert_eq!(rtp_buffer.get_csrc(1).unwrap(), 15);
|
||||
assert!(rtp_buffer.get_csrc(2).is_none());
|
||||
assert_eq!(rtp_buffer.csrc(0).unwrap(), 12);
|
||||
assert_eq!(rtp_buffer.csrc(1).unwrap(), 15);
|
||||
assert!(rtp_buffer.csrc(2).is_none());
|
||||
|
||||
rtp_buffer.set_extension(true);
|
||||
assert_eq!(rtp_buffer.is_extension(), true);
|
||||
|
@ -444,10 +444,10 @@ mod tests {
|
|||
assert_eq!(bytes[i + 1], extension_data[i]);
|
||||
}
|
||||
|
||||
let result = rtp_buffer.get_extension_onebyte_header(2, 0);
|
||||
let result = rtp_buffer.extension_onebyte_header(2, 0);
|
||||
assert!(result.is_none());
|
||||
|
||||
let result = rtp_buffer.get_extension_onebyte_header(1, 0);
|
||||
let result = rtp_buffer.extension_onebyte_header(1, 0);
|
||||
assert!(result.is_some());
|
||||
assert_eq!(result.unwrap(), &extension_data);
|
||||
}
|
||||
|
@ -485,10 +485,10 @@ mod tests {
|
|||
assert_eq!(bytes[i + 2], extension_data[i]);
|
||||
}
|
||||
|
||||
let result = rtp_buffer.get_extension_twobytes_header(2, 0);
|
||||
let result = rtp_buffer.extension_twobytes_header(2, 0);
|
||||
assert!(result.is_none());
|
||||
|
||||
let result = rtp_buffer.get_extension_twobytes_header(id, 0);
|
||||
let result = rtp_buffer.extension_twobytes_header(id, 0);
|
||||
assert!(result.is_some());
|
||||
let (extracted_appbits, data) = result.unwrap();
|
||||
assert_eq!(appbits, extracted_appbits);
|
||||
|
|
|
@ -1073,7 +1073,7 @@ unsafe extern "C" fn client_get_parameter_request<T: RTSPClientImpl>(
|
|||
let imp = instance.impl_();
|
||||
let wrap: Borrowed<RTSPClient> = from_glib_borrow(ptr);
|
||||
|
||||
imp.get_parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx));
|
||||
imp.parameter_request(wrap.unsafe_cast_ref(), &from_glib_borrow(ctx));
|
||||
}
|
||||
|
||||
unsafe extern "C" fn client_announce_request<T: RTSPClientImpl>(
|
||||
|
|
|
@ -606,7 +606,7 @@ macro_rules! define_iter(
|
|||
impl<'a> $name<'a> {
|
||||
fn new(media: &'a SDPMediaRef) -> $name<'a> {
|
||||
skip_assert_initialized!();
|
||||
let len = $get_len(media);
|
||||
let len = $len(media);
|
||||
|
||||
$name {
|
||||
media,
|
||||
|
@ -624,7 +624,7 @@ macro_rules! define_iter(
|
|||
return None;
|
||||
}
|
||||
|
||||
let item = $get_item(self.media, self.idx)?;
|
||||
let item = $item(self.media, self.idx)?;
|
||||
self.idx += 1;
|
||||
Some(item)
|
||||
}
|
||||
|
@ -648,7 +648,7 @@ macro_rules! define_iter(
|
|||
|
||||
self.len -= 1;
|
||||
|
||||
$get_item(self.media, self.len)
|
||||
$item(self.media, self.len)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -659,25 +659,25 @@ macro_rules! define_iter(
|
|||
define_iter!(
|
||||
BandwidthsIter,
|
||||
&'a SDPBandwidth,
|
||||
|media: &'a SDPMediaRef, idx| media.get_bandwidth(idx),
|
||||
|media: &'a SDPMediaRef, idx| media.bandwidth(idx),
|
||||
|media: &SDPMediaRef| media.bandwidths_len()
|
||||
);
|
||||
define_iter!(
|
||||
FormatsIter,
|
||||
&'a str,
|
||||
|media: &'a SDPMediaRef, idx| media.get_format(idx),
|
||||
|media: &'a SDPMediaRef, idx| media.format(idx),
|
||||
|media: &SDPMediaRef| media.formats_len()
|
||||
);
|
||||
define_iter!(
|
||||
ConnectionsIter,
|
||||
&'a SDPConnection,
|
||||
|media: &'a SDPMediaRef, idx| media.get_connection(idx),
|
||||
|media: &'a SDPMediaRef, idx| media.connection(idx),
|
||||
|media: &SDPMediaRef| media.connections_len()
|
||||
);
|
||||
define_iter!(
|
||||
AttributesIter,
|
||||
&'a SDPAttribute,
|
||||
|media: &'a SDPMediaRef, idx| media.get_attribute(idx),
|
||||
|media: &'a SDPMediaRef, idx| media.attribute(idx),
|
||||
|media: &SDPMediaRef| media.attributes_len()
|
||||
);
|
||||
|
||||
|
|
|
@ -927,7 +927,7 @@ macro_rules! define_iter(
|
|||
impl<'a> $name<'a> {
|
||||
fn new(message: &'a SDPMessageRef) -> $name<'a> {
|
||||
skip_assert_initialized!();
|
||||
let len = $get_len(message);
|
||||
let len = $len(message);
|
||||
|
||||
$name {
|
||||
message,
|
||||
|
@ -945,7 +945,7 @@ macro_rules! define_iter(
|
|||
return None;
|
||||
}
|
||||
|
||||
let item = $get_item(self.message, self.idx)?;
|
||||
let item = $item(self.message, self.idx)?;
|
||||
self.idx += 1;
|
||||
Some(item)
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ macro_rules! define_iter(
|
|||
|
||||
self.len -= 1;
|
||||
|
||||
$get_item(self.message, self.len)
|
||||
$item(self.message, self.len)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -989,7 +989,7 @@ macro_rules! define_iter_mut(
|
|||
impl<'a> $name<'a> {
|
||||
fn new(message: &'a mut SDPMessageRef) -> $name<'a> {
|
||||
skip_assert_initialized!();
|
||||
let len = $get_len(message);
|
||||
let len = $len(message);
|
||||
|
||||
$name {
|
||||
message,
|
||||
|
@ -1019,7 +1019,7 @@ macro_rules! define_iter_mut(
|
|||
return None;
|
||||
}
|
||||
|
||||
let item = $get_item(message, self.idx)?;
|
||||
let item = $item(message, self.idx)?;
|
||||
self.idx += 1;
|
||||
Some(item)
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@ macro_rules! define_iter_mut(
|
|||
|
||||
self.len -= 1;
|
||||
|
||||
$get_item(message, self.len)
|
||||
$item(message, self.len)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1057,49 +1057,49 @@ macro_rules! define_iter_mut(
|
|||
define_iter!(
|
||||
AttributesIter,
|
||||
&'a SDPAttribute,
|
||||
|message: &'a SDPMessageRef, idx| message.get_attribute(idx),
|
||||
|message: &'a SDPMessageRef, idx| message.attribute(idx),
|
||||
|message: &SDPMessageRef| message.attributes_len()
|
||||
);
|
||||
define_iter!(
|
||||
BandwidthsIter,
|
||||
&'a SDPBandwidth,
|
||||
|message: &'a SDPMessageRef, idx| message.get_bandwidth(idx),
|
||||
|message: &'a SDPMessageRef, idx| message.bandwidth(idx),
|
||||
|message: &SDPMessageRef| message.bandwidths_len()
|
||||
);
|
||||
define_iter!(
|
||||
EmailsIter,
|
||||
&'a str,
|
||||
|message: &'a SDPMessageRef, idx| message.get_email(idx),
|
||||
|message: &'a SDPMessageRef, idx| message.email(idx),
|
||||
|message: &SDPMessageRef| message.emails_len()
|
||||
);
|
||||
define_iter!(
|
||||
MediasIter,
|
||||
&'a SDPMediaRef,
|
||||
|message: &'a SDPMessageRef, idx| message.get_media(idx),
|
||||
|message: &'a SDPMessageRef, idx| message.media(idx),
|
||||
|message: &SDPMessageRef| message.medias_len()
|
||||
);
|
||||
define_iter_mut!(
|
||||
MediasIterMut,
|
||||
&'a mut SDPMediaRef,
|
||||
|message: &'a mut SDPMessageRef, idx| message.get_media_mut(idx),
|
||||
|message: &'a mut SDPMessageRef, idx| message.media_mut(idx),
|
||||
|message: &SDPMessageRef| message.medias_len()
|
||||
);
|
||||
define_iter!(
|
||||
PhonesIter,
|
||||
&'a str,
|
||||
|message: &'a SDPMessageRef, idx| message.get_phone(idx),
|
||||
|message: &'a SDPMessageRef, idx| message.phone(idx),
|
||||
|message: &SDPMessageRef| message.phones_len()
|
||||
);
|
||||
define_iter!(
|
||||
TimesIter,
|
||||
&'a SDPTime,
|
||||
|message: &'a SDPMessageRef, idx| message.get_time(idx),
|
||||
|message: &'a SDPMessageRef, idx| message.time(idx),
|
||||
|message: &SDPMessageRef| message.times_len()
|
||||
);
|
||||
define_iter!(
|
||||
ZonesIter,
|
||||
&'a SDPZone,
|
||||
|message: &'a SDPMessageRef, idx| message.get_zone(idx),
|
||||
|message: &'a SDPMessageRef, idx| message.zone(idx),
|
||||
|message: &SDPMessageRef| message.zones_len()
|
||||
);
|
||||
|
||||
|
@ -1117,7 +1117,7 @@ mod tests {
|
|||
|
||||
let sdp = "v=0\r\no=- 1938737043334325940 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=ice-options:trickle\r\nm=video 9 UDP/TLS/RTP/SAVPF 96\r\nc=IN IP4 0.0.0.0\r\na=setup:actpass\r\na=ice-ufrag:YZxU9JlWHzHcF6O2U09/q3PvBhbTPdZW\r\na=ice-pwd:fyrt730GWo5mFGc9m2z/vbUu3z1lewla\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=framerate:30\r\na=mid:video0\r\na=fingerprint:sha-256 DB:48:8F:18:13:F3:AA:13:31:B3:75:3D:1A:D3:BA:88:4A:ED:1B:56:14:C3:09:CD:BC:4D:18:42:B9:6A:5F:98\r\nm=audio 9 UDP/TLS/RTP/SAVPF 97\r\nc=IN IP4 0.0.0.0\r\na=setup:actpass\r\na=ice-ufrag:04KZM9qE2S4r06AN6A9CeXOM6mzO0LZY\r\na=ice-pwd:cJTSfHF6hHDAcsTJXZVJeuYCC6rKqBvW\r\na=sendrecv\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:97 OPUS/48000/2\r\na=rtcp-fb:97 nack\r\na=rtcp-fb:97 nack pli\r\na=mid:audio1\r\na=fingerprint:sha-256 DB:48:8F:18:13:F3:AA:13:31:B3:75:3D:1A:D3:BA:88:4A:ED:1B:56:14:C3:09:CD:BC:4D:18:42:B9:6A:5F:98\r\n";
|
||||
let sdp = SDPMessage::parse_buffer(sdp.as_bytes()).unwrap();
|
||||
let media = sdp.get_media(0).unwrap();
|
||||
let media = sdp.media(0).unwrap();
|
||||
assert_eq!(media.formats_len(), 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -762,7 +762,7 @@ unsafe extern "C" fn video_decoder_getcaps<T: VideoDecoderImpl>(
|
|||
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||
VideoDecoderImpl::get_caps(
|
||||
VideoDecoderImpl::caps(
|
||||
imp,
|
||||
wrap.unsafe_cast_ref(),
|
||||
Option::<gst::Caps>::from_glib_borrow(filter)
|
||||
|
|
|
@ -660,7 +660,7 @@ unsafe extern "C" fn video_encoder_getcaps<T: VideoEncoderImpl>(
|
|||
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||
|
||||
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||
VideoEncoderImpl::get_caps(
|
||||
VideoEncoderImpl::caps(
|
||||
imp,
|
||||
wrap.unsafe_cast_ref(),
|
||||
Option::<gst::Caps>::from_glib_borrow(filter)
|
||||
|
|
|
@ -751,10 +751,10 @@ impl VideoInfo {
|
|||
&self.0 as *const _ as *mut _,
|
||||
src_val.format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
U::default_format().to_glib(),
|
||||
dest_val.as_mut_ptr(),
|
||||
)) {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
Some(U::from_raw(U::default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -778,7 +778,7 @@ mod tests {
|
|||
}
|
||||
|
||||
{
|
||||
let meta = buffer.get_meta::<VideoMeta>().unwrap();
|
||||
let meta = buffer.meta::<VideoMeta>().unwrap();
|
||||
assert_eq!(meta.id(), 0);
|
||||
assert_eq!(meta.flags(), crate::VideoFrameFlags::empty());
|
||||
assert_eq!(meta.format(), crate::VideoFormat::Argb);
|
||||
|
@ -817,7 +817,7 @@ mod tests {
|
|||
}
|
||||
|
||||
{
|
||||
let meta = buffer.get_meta::<VideoMeta>().unwrap();
|
||||
let meta = buffer.meta::<VideoMeta>().unwrap();
|
||||
assert_eq!(meta.id(), 0);
|
||||
assert_eq!(meta.flags(), crate::VideoFrameFlags::empty());
|
||||
assert_eq!(meta.format(), crate::VideoFormat::Argb);
|
||||
|
|
|
@ -38,7 +38,7 @@ impl VideoOverlayRectangle {
|
|||
flags: crate::VideoOverlayFormatFlags,
|
||||
) -> Self {
|
||||
assert_initialized_main_thread!();
|
||||
assert!(buffer.get_meta::<crate::VideoMeta>().is_some());
|
||||
assert!(buffer.meta::<crate::VideoMeta>().is_some());
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_video_overlay_rectangle_new_raw(
|
||||
buffer.to_glib_none().0,
|
||||
|
|
|
@ -386,7 +386,7 @@ impl BufferRef {
|
|||
|
||||
pub fn meta<T: MetaAPI>(&self) -> Option<MetaRef<T>> {
|
||||
unsafe {
|
||||
let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::get_meta_api().to_glib());
|
||||
let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::meta_api().to_glib());
|
||||
if meta.is_null() {
|
||||
None
|
||||
} else {
|
||||
|
@ -397,7 +397,7 @@ impl BufferRef {
|
|||
|
||||
pub fn meta_mut<T: MetaAPI>(&mut self) -> Option<MetaRefMut<T, crate::meta::Standalone>> {
|
||||
unsafe {
|
||||
let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::get_meta_api().to_glib());
|
||||
let meta = ffi::gst_buffer_get_meta(self.as_mut_ptr(), T::meta_api().to_glib());
|
||||
if meta.is_null() {
|
||||
None
|
||||
} else {
|
||||
|
@ -711,7 +711,7 @@ macro_rules! define_meta_iter(
|
|||
$name {
|
||||
buffer,
|
||||
state: ptr::null_mut(),
|
||||
meta_api: T::get_meta_api(),
|
||||
meta_api: T::meta_api(),
|
||||
items: PhantomData,
|
||||
}
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ macro_rules! define_iter(
|
|||
|
||||
#[allow(unused_unsafe)]
|
||||
unsafe {
|
||||
let item = $get_item(self.buffer, self.idx)?;
|
||||
let item = $item(self.buffer, self.idx)?;
|
||||
self.idx += 1;
|
||||
Some(item)
|
||||
}
|
||||
|
@ -824,7 +824,7 @@ macro_rules! define_iter(
|
|||
|
||||
#[allow(unused_unsafe)]
|
||||
unsafe {
|
||||
$get_item(self.buffer, self.n_memory)
|
||||
$item(self.buffer, self.n_memory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ define_iter!(
|
|||
IterOwned,
|
||||
&'a BufferRef,
|
||||
Memory,
|
||||
|buffer: &BufferRef, idx| { buffer.get_memory(idx) }
|
||||
|buffer: &BufferRef, idx| { buffer.memory(idx) }
|
||||
);
|
||||
|
||||
impl fmt::Debug for Buffer {
|
||||
|
@ -1184,7 +1184,7 @@ mod tests {
|
|||
|
||||
for i in 0..5 {
|
||||
{
|
||||
let mem = buffer.get_memory(i).unwrap();
|
||||
let mem = buffer.memory(i).unwrap();
|
||||
assert_eq!(mem.size(), if i < 4 { 5 } else { 10 });
|
||||
let map = mem.map_readable().unwrap();
|
||||
assert_eq!(map.size(), if i < 4 { 5 } else { 10 });
|
||||
|
|
|
@ -74,8 +74,8 @@ macro_rules! define_seek_impl(
|
|||
}
|
||||
|
||||
// Work around lifetime annotation issues with closures
|
||||
let get_buffer_ref: fn(&Self) -> &BufferRef = $get_buffer_ref;
|
||||
let (idx, _, skip) = get_buffer_ref(self)
|
||||
let buffer_ref: fn(&Self) -> &BufferRef = $get_buffer_ref;
|
||||
let (idx, _, skip) = buffer_ref(self)
|
||||
.find_memory(self.cur_offset as usize, None)
|
||||
.expect("Failed to find memory");
|
||||
|
||||
|
@ -113,9 +113,9 @@ macro_rules! define_read_write_fn_impl(
|
|||
if $self.map_info.memory.is_null() {
|
||||
unsafe {
|
||||
// Work around lifetime annotation issues with closures
|
||||
let get_buffer_ref: fn(&Self) -> &BufferRef = $get_buffer_ref;
|
||||
let buffer_ref: fn(&Self) -> &BufferRef = $get_buffer_ref;
|
||||
let memory = ffi::gst_buffer_peek_memory(
|
||||
get_buffer_ref($self).as_mut_ptr(),
|
||||
buffer_ref($self).as_mut_ptr(),
|
||||
$self.cur_mem_idx,
|
||||
);
|
||||
assert!(!memory.is_null());
|
||||
|
|
|
@ -218,7 +218,7 @@ macro_rules! define_iter(
|
|||
return None;
|
||||
}
|
||||
|
||||
let item = $get_item(self.list, self.idx)?;
|
||||
let item = $item(self.list, self.idx)?;
|
||||
self.idx += 1;
|
||||
|
||||
Some(item)
|
||||
|
@ -242,7 +242,7 @@ macro_rules! define_iter(
|
|||
}
|
||||
|
||||
self.size -= 1;
|
||||
$get_item(self.list, self.size)
|
||||
$item(self.list, self.size)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ macro_rules! define_iter(
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let item = $get_item(self.caps, self.idx)?;
|
||||
let item = $item(self.caps, self.idx)?;
|
||||
self.idx += 1;
|
||||
Some(item)
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ macro_rules! define_iter(
|
|||
self.n_structures -= 1;
|
||||
|
||||
unsafe {
|
||||
$get_item(self.caps, self.n_structures)
|
||||
$item(self.caps, self.n_structures)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -741,7 +741,7 @@ mod tests {
|
|||
);
|
||||
|
||||
{
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
let s = caps.structure(0).unwrap();
|
||||
assert_eq!(
|
||||
s,
|
||||
Structure::new(
|
||||
|
@ -758,7 +758,7 @@ mod tests {
|
|||
);
|
||||
}
|
||||
assert!(caps
|
||||
.get_features(0)
|
||||
.features(0)
|
||||
.unwrap()
|
||||
.is_equal(crate::CAPS_FEATURES_MEMORY_SYSTEM_MEMORY.as_ref()));
|
||||
|
||||
|
@ -767,7 +767,7 @@ mod tests {
|
|||
caps.set_features(0, Some(CapsFeatures::new(&["foo:bla"])));
|
||||
}
|
||||
assert!(caps
|
||||
.get_features(0)
|
||||
.features(0)
|
||||
.unwrap()
|
||||
.is_equal(CapsFeatures::new(&["foo:bla"]).as_ref()));
|
||||
}
|
||||
|
|
|
@ -367,7 +367,7 @@ mod tests {
|
|||
),
|
||||
])"#;
|
||||
let caps: Caps = ron::de::from_str(caps_ron).unwrap();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
let s = caps.structure(0).unwrap();
|
||||
assert_eq!(
|
||||
s,
|
||||
Structure::new(
|
||||
|
@ -400,7 +400,7 @@ mod tests {
|
|||
),
|
||||
])"#;
|
||||
let caps: Caps = ron::de::from_str(caps_ron).unwrap();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
let s = caps.structure(0).unwrap();
|
||||
let str_none: Option<&str> = None;
|
||||
assert_eq!(
|
||||
s,
|
||||
|
@ -416,7 +416,7 @@ mod tests {
|
|||
)
|
||||
.as_ref()
|
||||
);
|
||||
let f = caps.get_features(0).unwrap();
|
||||
let f = caps.features(0).unwrap();
|
||||
assert!(f.is_equal(CapsFeatures::new(&["foo:bar", "foo:baz"]).as_ref()));
|
||||
|
||||
let caps_ron = r#"
|
||||
|
@ -436,7 +436,7 @@ mod tests {
|
|||
),
|
||||
])"#;
|
||||
let caps: Caps = ron::de::from_str(caps_ron).unwrap();
|
||||
let s = caps.get_structure(0).unwrap();
|
||||
let s = caps.structure(0).unwrap();
|
||||
assert_eq!(
|
||||
s,
|
||||
Structure::new(
|
||||
|
@ -451,7 +451,7 @@ mod tests {
|
|||
)
|
||||
.as_ref()
|
||||
);
|
||||
let f = caps.get_features(0).unwrap();
|
||||
let f = caps.features(0).unwrap();
|
||||
assert!(f.is_any());
|
||||
}
|
||||
|
||||
|
|
|
@ -371,14 +371,14 @@ impl cmp::PartialOrd for DateTime {
|
|||
|
||||
let year_delta = self_norm.year() - other_norm.year();
|
||||
if year_delta != 0 {
|
||||
return get_cmp(year_delta);
|
||||
return cmp(year_delta);
|
||||
}
|
||||
|
||||
// Same year
|
||||
|
||||
if !self.has_month() && !other.has_month() {
|
||||
// Nothing left to compare
|
||||
return get_cmp(year_delta);
|
||||
return cmp(year_delta);
|
||||
}
|
||||
|
||||
if !(self.has_month() && other.has_month()) {
|
||||
|
@ -388,7 +388,7 @@ impl cmp::PartialOrd for DateTime {
|
|||
|
||||
let month_delta = self_norm.month().unwrap() - other_norm.month().unwrap();
|
||||
if month_delta != 0 {
|
||||
return get_cmp(month_delta);
|
||||
return cmp(month_delta);
|
||||
}
|
||||
|
||||
// Same year, same month
|
||||
|
@ -405,7 +405,7 @@ impl cmp::PartialOrd for DateTime {
|
|||
|
||||
let day_delta = self_norm.day().unwrap() - other_norm.day().unwrap();
|
||||
if day_delta != 0 {
|
||||
return get_cmp(day_delta);
|
||||
return cmp(day_delta);
|
||||
}
|
||||
|
||||
// Same year, same month, same day
|
||||
|
@ -422,12 +422,12 @@ impl cmp::PartialOrd for DateTime {
|
|||
|
||||
let hour_delta = self_norm.hour().unwrap() - other_norm.hour().unwrap();
|
||||
if hour_delta != 0 {
|
||||
return get_cmp(hour_delta);
|
||||
return cmp(hour_delta);
|
||||
}
|
||||
|
||||
let minute_delta = self_norm.minute().unwrap() - other_norm.minute().unwrap();
|
||||
if minute_delta != 0 {
|
||||
return get_cmp(minute_delta);
|
||||
return cmp(minute_delta);
|
||||
}
|
||||
|
||||
// Same year, same month, same day, same time
|
||||
|
@ -443,10 +443,10 @@ impl cmp::PartialOrd for DateTime {
|
|||
}
|
||||
let second_delta = self_norm.second().unwrap() - other_norm.second().unwrap();
|
||||
if second_delta != 0 {
|
||||
return get_cmp(second_delta);
|
||||
return cmp(second_delta);
|
||||
}
|
||||
|
||||
get_cmp(self_norm.microsecond().unwrap() - other_norm.microsecond().unwrap())
|
||||
cmp(self_norm.microsecond().unwrap() - other_norm.microsecond().unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,11 +136,11 @@ pub trait ElementExtManual: 'static {
|
|||
fn set_state(&self, state: State) -> Result<StateChangeSuccess, StateChangeError>;
|
||||
|
||||
fn current_state(&self) -> State {
|
||||
self.get_state(ClockTime::from(0)).1
|
||||
self.state(ClockTime::from(0)).1
|
||||
}
|
||||
|
||||
fn pending_state(&self) -> State {
|
||||
self.get_state(ClockTime::from(0)).2
|
||||
self.state(ClockTime::from(0)).2
|
||||
}
|
||||
|
||||
fn query(&self, query: &mut QueryRef) -> bool;
|
||||
|
@ -353,11 +353,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
}
|
||||
|
||||
fn metadata<'a>(&self, key: &str) -> Option<&'a str> {
|
||||
self.element_class().get_metadata(key)
|
||||
self.element_class().metadata(key)
|
||||
}
|
||||
|
||||
fn pad_template(&self, name: &str) -> Option<PadTemplate> {
|
||||
self.element_class().get_pad_template(name)
|
||||
self.element_class().pad_template(name)
|
||||
}
|
||||
|
||||
fn pad_template_list(&self) -> Vec<PadTemplate> {
|
||||
|
@ -617,11 +617,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
self.as_ref().to_glib_none().0,
|
||||
src_val.format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
U::default_format().to_glib(),
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
Some(U::from_raw(U::default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -659,11 +659,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_element_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
T::default_format().to_glib(),
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), duration.assume_init()))
|
||||
Some(T::from_raw(T::default_format(), duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -691,11 +691,11 @@ impl<O: IsA<Element>> ElementExtManual for O {
|
|||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_element_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
T::default_format().to_glib(),
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), cur.assume_init()))
|
||||
Some(T::from_raw(T::default_format(), cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
|||
unsafe fn from_ptr(buffer: &BufferRef, ptr: *const Self::GstType) -> MetaRef<Self> {
|
||||
assert!(!ptr.is_null());
|
||||
|
||||
let meta_api = Self::get_meta_api();
|
||||
let meta_api = Self::meta_api();
|
||||
if meta_api != glib::Type::INVALID {
|
||||
assert_eq!(
|
||||
meta_api,
|
||||
|
@ -49,7 +49,7 @@ pub unsafe trait MetaAPI: Sync + Send + Sized {
|
|||
) -> MetaRefMut<Self, T> {
|
||||
assert!(!ptr.is_null());
|
||||
|
||||
let meta_api = Self::get_meta_api();
|
||||
let meta_api = Self::meta_api();
|
||||
if meta_api != glib::Type::INVALID {
|
||||
assert_eq!(
|
||||
meta_api,
|
||||
|
@ -162,7 +162,7 @@ impl<'a, T: MetaAPI> MetaRef<'a, T> {
|
|||
|
||||
impl<'a> MetaRef<'a, Meta> {
|
||||
pub fn downcast_ref<T: MetaAPI>(&self) -> Option<&MetaRef<'a, T>> {
|
||||
let target_type = T::get_meta_api();
|
||||
let target_type = T::meta_api();
|
||||
let type_ = self.api();
|
||||
|
||||
if type_ == glib::Type::INVALID || target_type == type_ {
|
||||
|
@ -214,7 +214,7 @@ impl<'a, T: MetaAPI> MetaRefMut<'a, T, Standalone> {
|
|||
|
||||
impl<'a, U> MetaRefMut<'a, Meta, U> {
|
||||
pub fn downcast_ref<T: MetaAPI>(&mut self) -> Option<&MetaRefMut<'a, T, U>> {
|
||||
let target_type = T::get_meta_api();
|
||||
let target_type = T::meta_api();
|
||||
let type_ = self.api();
|
||||
|
||||
if type_ == glib::Type::INVALID || target_type == type_ {
|
||||
|
@ -457,7 +457,7 @@ mod tests {
|
|||
let meta = buffer
|
||||
.get_mut()
|
||||
.unwrap()
|
||||
.get_meta_mut::<ParentBufferMeta>()
|
||||
.meta_mut::<ParentBufferMeta>()
|
||||
.unwrap();
|
||||
unsafe {
|
||||
assert_eq!(meta.parent().as_ptr(), parent.as_ptr());
|
||||
|
@ -485,6 +485,6 @@ mod tests {
|
|||
assert_eq!(metas.count(), 0);
|
||||
}
|
||||
|
||||
assert!(buffer.get_meta::<ParentBufferMeta>().is_none());
|
||||
assert!(buffer.meta::<ParentBufferMeta>().is_none());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -420,7 +420,7 @@ macro_rules! mini_object_wrapper (
|
|||
|
||||
impl $crate::glib::types::StaticType for $ref_name {
|
||||
fn static_type() -> $crate::glib::types::Type {
|
||||
unsafe { $crate::glib::translate::from_glib($get_type()) }
|
||||
unsafe { $crate::glib::translate::from_glib($type_()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -768,11 +768,11 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
self.as_ref().to_glib_none().0,
|
||||
src_val.format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
U::default_format().to_glib(),
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
Some(U::from_raw(U::default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -810,11 +810,11 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_pad_peer_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
T::default_format().to_glib(),
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), duration.assume_init()))
|
||||
Some(T::from_raw(T::default_format(), duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -842,11 +842,11 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_pad_peer_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
T::default_format().to_glib(),
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), cur.assume_init()))
|
||||
Some(T::from_raw(T::default_format(), cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -881,11 +881,11 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
self.as_ref().to_glib_none().0,
|
||||
src_val.format().to_glib(),
|
||||
src_val.to_raw_value(),
|
||||
U::get_default_format().to_glib(),
|
||||
U::default_format().to_glib(),
|
||||
dest_val.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(U::from_raw(U::get_default_format(), dest_val.assume_init()))
|
||||
Some(U::from_raw(U::default_format(), dest_val.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -924,11 +924,11 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
let mut duration = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_pad_query_duration(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
T::default_format().to_glib(),
|
||||
duration.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), duration.assume_init()))
|
||||
Some(T::from_raw(T::default_format(), duration.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -956,11 +956,11 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
let mut cur = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_pad_query_position(
|
||||
self.as_ref().to_glib_none().0,
|
||||
T::get_default_format().to_glib(),
|
||||
T::default_format().to_glib(),
|
||||
cur.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(T::from_raw(T::get_default_format(), cur.assume_init()))
|
||||
Some(T::from_raw(T::default_format(), cur.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -1661,7 +1661,7 @@ impl<T: IsA<Pad> + IsA<glib::Object> + glib::object::IsClass> PadBuilder<T> {
|
|||
// additional checks here now
|
||||
if templ.has_property("gtype", Some(glib::Type::static_type())) {
|
||||
let gtype = templ
|
||||
.get_property("gtype")
|
||||
.property("gtype")
|
||||
.unwrap()
|
||||
.get_some::<glib::Type>()
|
||||
.unwrap();
|
||||
|
@ -1934,12 +1934,12 @@ mod tests {
|
|||
.build();
|
||||
pad.set_active(true).unwrap();
|
||||
|
||||
let buffer = pad.get_range(0, 5).unwrap();
|
||||
let buffer = pad.range(0, 5).unwrap();
|
||||
let map = buffer.map_readable().unwrap();
|
||||
assert_eq!(&*map, b"abcde");
|
||||
|
||||
let mut buffer = crate::Buffer::with_size(5).unwrap();
|
||||
pad.get_range_fill(0, buffer.get_mut().unwrap(), 5).unwrap();
|
||||
pad.range_fill(0, buffer.get_mut().unwrap(), 5).unwrap();
|
||||
let map = buffer.map_readable().unwrap();
|
||||
assert_eq!(&*map, b"abcde");
|
||||
|
||||
|
@ -1965,12 +1965,12 @@ mod tests {
|
|||
.build();
|
||||
pad.set_active(true).unwrap();
|
||||
|
||||
let buffer = pad.get_range(0, 5).unwrap();
|
||||
let buffer = pad.range(0, 5).unwrap();
|
||||
let map = buffer.map_readable().unwrap();
|
||||
assert_eq!(&*map, b"abcde");
|
||||
|
||||
let mut buffer = crate::Buffer::with_size(5).unwrap();
|
||||
pad.get_range_fill(0, buffer.get_mut().unwrap(), 5).unwrap();
|
||||
pad.range_fill(0, buffer.get_mut().unwrap(), 5).unwrap();
|
||||
let map = buffer.map_readable().unwrap();
|
||||
assert_eq!(&*map, b"fghij");
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ impl Promise {
|
|||
let promise: Borrowed<Promise> = from_glib_borrow(promise);
|
||||
|
||||
let res = match promise.wait() {
|
||||
PromiseResult::Replied => Ok(promise.get_reply()),
|
||||
PromiseResult::Replied => Ok(promise.reply()),
|
||||
PromiseResult::Interrupted => Err(PromiseError::Interrupted),
|
||||
PromiseResult::Expired => Err(PromiseError::Expired),
|
||||
PromiseResult::Pending => {
|
||||
|
|
|
@ -946,7 +946,7 @@ impl<T: AsPtr> Allocation<T> {
|
|||
let mut idx = mem::MaybeUninit::uninit();
|
||||
if ffi::gst_query_find_allocation_meta(
|
||||
self.0.as_ptr(),
|
||||
U::get_meta_api().to_glib(),
|
||||
U::meta_api().to_glib(),
|
||||
idx.as_mut_ptr(),
|
||||
) != glib::ffi::GFALSE
|
||||
{
|
||||
|
@ -1010,7 +1010,7 @@ impl<T: AsMutPtr> Allocation<T> {
|
|||
unsafe {
|
||||
ffi::gst_query_add_allocation_meta(
|
||||
self.0.as_mut_ptr(),
|
||||
U::get_meta_api().to_glib(),
|
||||
U::meta_api().to_glib(),
|
||||
if let Some(structure) = structure {
|
||||
structure.as_ptr()
|
||||
} else {
|
||||
|
|
|
@ -27,8 +27,7 @@ impl Segment {
|
|||
}
|
||||
|
||||
pub fn downcast<T: FormattedValue>(self) -> Result<FormattedSegment<T>, Self> {
|
||||
if T::get_default_format() == Format::Undefined || T::get_default_format() == self.format()
|
||||
{
|
||||
if T::default_format() == Format::Undefined || T::default_format() == self.format() {
|
||||
Ok(FormattedSegment(self.0, PhantomData))
|
||||
} else {
|
||||
Err(self)
|
||||
|
@ -36,8 +35,7 @@ impl Segment {
|
|||
}
|
||||
|
||||
pub fn downcast_ref<T: FormattedValue>(&self) -> Option<&FormattedSegment<T>> {
|
||||
if T::get_default_format() == Format::Undefined || T::get_default_format() == self.format()
|
||||
{
|
||||
if T::default_format() == Format::Undefined || T::default_format() == self.format() {
|
||||
Some(unsafe {
|
||||
&*(self as *const FormattedSegment<GenericFormattedValue>
|
||||
as *const FormattedSegment<T>)
|
||||
|
@ -48,8 +46,7 @@ impl Segment {
|
|||
}
|
||||
|
||||
pub fn downcast_mut<T: FormattedValue>(&mut self) -> Option<&mut FormattedSegment<T>> {
|
||||
if T::get_default_format() == Format::Undefined || T::get_default_format() == self.format()
|
||||
{
|
||||
if T::default_format() == Format::Undefined || T::default_format() == self.format() {
|
||||
Some(unsafe {
|
||||
&mut *(self as *mut FormattedSegment<GenericFormattedValue>
|
||||
as *mut FormattedSegment<T>)
|
||||
|
@ -65,7 +62,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
assert_initialized_main_thread!();
|
||||
let segment = unsafe {
|
||||
let mut segment = mem::MaybeUninit::zeroed();
|
||||
ffi::gst_segment_init(segment.as_mut_ptr(), T::get_default_format().to_glib());
|
||||
ffi::gst_segment_init(segment.as_mut_ptr(), T::default_format().to_glib());
|
||||
segment.assume_init()
|
||||
};
|
||||
FormattedSegment(segment, PhantomData)
|
||||
|
@ -83,7 +80,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
|
||||
pub fn reset(&mut self) {
|
||||
unsafe {
|
||||
ffi::gst_segment_init(&mut self.0, T::get_default_format().to_glib());
|
||||
ffi::gst_segment_init(&mut self.0, T::default_format().to_glib());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +88,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
let start = start.into();
|
||||
let stop = stop.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), start.format());
|
||||
assert_eq!(self.format(), stop.format());
|
||||
}
|
||||
|
@ -132,7 +129,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
let start = start.into();
|
||||
let stop = stop.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), start.format());
|
||||
assert_eq!(self.format(), stop.format());
|
||||
}
|
||||
|
@ -170,7 +167,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn position_from_running_time<V: Into<T>>(&self, running_time: V) -> T {
|
||||
let running_time = running_time.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), running_time.format());
|
||||
}
|
||||
|
||||
|
@ -189,7 +186,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn position_from_running_time_full<V: Into<T>>(&self, running_time: V) -> (i32, T) {
|
||||
let running_time = running_time.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), running_time.format());
|
||||
}
|
||||
|
||||
|
@ -211,7 +208,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn position_from_stream_time<V: Into<T>>(&self, stream_time: V) -> T {
|
||||
let stream_time = stream_time.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), stream_time.format());
|
||||
}
|
||||
|
||||
|
@ -230,7 +227,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn position_from_stream_time_full<V: Into<T>>(&self, stream_time: V) -> (i32, T) {
|
||||
let stream_time = stream_time.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), stream_time.format());
|
||||
}
|
||||
|
||||
|
@ -252,7 +249,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_running_time<V: Into<T>>(&mut self, running_time: V) -> Result<(), glib::BoolError> {
|
||||
let running_time = running_time.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), running_time.format());
|
||||
}
|
||||
|
||||
|
@ -271,7 +268,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn to_running_time<V: Into<T>>(&self, position: V) -> T {
|
||||
let position = position.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), position.format());
|
||||
}
|
||||
|
||||
|
@ -290,7 +287,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn to_running_time_full<V: Into<T>>(&self, position: V) -> (i32, T) {
|
||||
let position = position.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), position.format());
|
||||
}
|
||||
|
||||
|
@ -312,7 +309,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn to_stream_time<V: Into<T>>(&self, position: V) -> T {
|
||||
let position = position.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), position.format());
|
||||
}
|
||||
|
||||
|
@ -331,7 +328,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn to_stream_time_full<V: Into<T>>(&self, position: V) -> (i32, T) {
|
||||
let position = position.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), position.format());
|
||||
}
|
||||
|
||||
|
@ -389,7 +386,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_base<V: Into<T>>(&mut self, base: V) {
|
||||
let base = base.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), base.format());
|
||||
}
|
||||
|
||||
|
@ -403,7 +400,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_offset<V: Into<T>>(&mut self, offset: V) {
|
||||
let offset = offset.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), offset.format());
|
||||
}
|
||||
|
||||
|
@ -417,7 +414,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_start<V: Into<T>>(&mut self, start: V) {
|
||||
let start = start.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), start.format());
|
||||
}
|
||||
|
||||
|
@ -431,7 +428,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_stop<V: Into<T>>(&mut self, stop: V) {
|
||||
let stop = stop.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), stop.format());
|
||||
}
|
||||
|
||||
|
@ -445,7 +442,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_time<V: Into<T>>(&mut self, time: V) {
|
||||
let time = time.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), time.format());
|
||||
}
|
||||
|
||||
|
@ -459,7 +456,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_position<V: Into<T>>(&mut self, position: V) {
|
||||
let position = position.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), position.format());
|
||||
}
|
||||
|
||||
|
@ -473,7 +470,7 @@ impl<T: FormattedValue> FormattedSegment<T> {
|
|||
pub fn set_duration<V: Into<T>>(&mut self, duration: V) {
|
||||
let duration = duration.into();
|
||||
|
||||
if T::get_default_format() == Format::Undefined {
|
||||
if T::default_format() == Format::Undefined {
|
||||
assert_eq!(self.format(), duration.format());
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ impl<'de, T: FormattedValue + SpecificFormattedValue> Deserialize<'de> for Forma
|
|||
de::Error::custom(format!(
|
||||
"failed to convert segment with format {:?} to {:?}",
|
||||
segment.format(),
|
||||
T::get_default_format(),
|
||||
T::default_format(),
|
||||
))
|
||||
})
|
||||
})
|
||||
|
|
|
@ -31,7 +31,7 @@ impl<'a> Iterator for Iter<'a> {
|
|||
return None;
|
||||
}
|
||||
|
||||
let item = self.collection.get_stream(self.idx);
|
||||
let item = self.collection.stream(self.idx);
|
||||
self.idx += 1;
|
||||
|
||||
item
|
||||
|
@ -55,7 +55,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
|||
}
|
||||
|
||||
self.size -= 1;
|
||||
self.collection.get_stream(self.size)
|
||||
self.collection.stream(self.size)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ impl StructureRef {
|
|||
&'structure self,
|
||||
name: &'name str,
|
||||
) -> Result<Option<T>, GetError<'name>> {
|
||||
self.get_value(name)?
|
||||
self.value(name)?
|
||||
.get()
|
||||
.map_err(|err| GetError::from_value_get_error(name, err))
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ impl StructureRef {
|
|||
&'structure self,
|
||||
name: &'name str,
|
||||
) -> Result<Option<T>, GetError<'name>> {
|
||||
let value = self.get_value(name);
|
||||
let value = self.value(name);
|
||||
if let Ok(value) = value {
|
||||
value
|
||||
.get()
|
||||
|
@ -363,7 +363,7 @@ impl StructureRef {
|
|||
&'structure self,
|
||||
name: &'name str,
|
||||
) -> Result<T, GetError<'name>> {
|
||||
self.get_value(name)?
|
||||
self.value(name)?
|
||||
.get_some()
|
||||
.map_err(|err| GetError::from_value_get_error(name, err))
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ impl<'a> Iterator for FieldIterator<'a> {
|
|||
return None;
|
||||
}
|
||||
|
||||
if let Some(field_name) = self.structure.get_nth_field_name(self.idx) {
|
||||
if let Some(field_name) = self.structure.nth_field_name(self.idx) {
|
||||
self.idx += 1;
|
||||
Some(field_name)
|
||||
} else {
|
||||
|
@ -661,7 +661,7 @@ impl<'a> DoubleEndedIterator for FieldIterator<'a> {
|
|||
}
|
||||
|
||||
self.n_fields -= 1;
|
||||
if let Some(field_name) = self.structure.get_nth_field_name(self.n_fields) {
|
||||
if let Some(field_name) = self.structure.nth_field_name(self.n_fields) {
|
||||
Some(field_name)
|
||||
} else {
|
||||
None
|
||||
|
@ -690,7 +690,7 @@ impl<'a> Iterator for Iter<'a> {
|
|||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
if let Some(f) = self.iter.next() {
|
||||
let v = self.iter.structure.get_value(f);
|
||||
let v = self.iter.structure.value(f);
|
||||
Some((f, v.unwrap()))
|
||||
} else {
|
||||
None
|
||||
|
@ -705,7 +705,7 @@ impl<'a> Iterator for Iter<'a> {
|
|||
impl<'a> DoubleEndedIterator for Iter<'a> {
|
||||
fn next_back(&mut self) -> Option<Self::Item> {
|
||||
if let Some(f) = self.iter.next_back() {
|
||||
let v = self.iter.structure.get_value(f);
|
||||
let v = self.iter.structure.value(f);
|
||||
Some((f, v.unwrap()))
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -644,7 +644,7 @@ mod tests {
|
|||
type ParentType = Element;
|
||||
|
||||
fn with_class(klass: &Self::Class) -> Self {
|
||||
let templ = klass.get_pad_template("sink").unwrap();
|
||||
let templ = klass.pad_template("sink").unwrap();
|
||||
let sinkpad = crate::Pad::builder_with_template(&templ, Some("sink"))
|
||||
.chain_function(|pad, parent, buffer| {
|
||||
TestElement::catch_panic_pad_function(
|
||||
|
@ -669,7 +669,7 @@ mod tests {
|
|||
})
|
||||
.build();
|
||||
|
||||
let templ = klass.get_pad_template("src").unwrap();
|
||||
let templ = klass.pad_template("src").unwrap();
|
||||
let srcpad = crate::Pad::builder_with_template(&templ, Some("src"))
|
||||
.event_function(|pad, parent, event| {
|
||||
TestElement::catch_panic_pad_function(
|
||||
|
@ -783,7 +783,7 @@ mod tests {
|
|||
assert_eq!(element.name(), "test");
|
||||
|
||||
assert_eq!(
|
||||
element.get_metadata(&crate::ELEMENT_METADATA_LONGNAME),
|
||||
element.metadata(&crate::ELEMENT_METADATA_LONGNAME),
|
||||
Some("Test Element")
|
||||
);
|
||||
|
||||
|
|
|
@ -432,7 +432,7 @@ impl TagListRef {
|
|||
}
|
||||
|
||||
pub fn get<'a, T: Tag<'a>>(&self) -> Option<TagValue<T::TagType>> {
|
||||
self.get_generic(T::tag_name()).map(|value| {
|
||||
self.generic(T::tag_name()).map(|value| {
|
||||
if !value.is::<T::TagType>() {
|
||||
panic!(
|
||||
"TagListRef::get type mismatch for tag {}: {}",
|
||||
|
@ -475,7 +475,7 @@ impl TagListRef {
|
|||
}
|
||||
|
||||
pub fn index<'a, T: Tag<'a>>(&self, idx: u32) -> Option<&'a TagValue<T::TagType>> {
|
||||
self.get_index_generic(T::tag_name(), idx).map(|value| {
|
||||
self.index_generic(T::tag_name(), idx).map(|value| {
|
||||
if !value.is::<T::TagType>() {
|
||||
panic!(
|
||||
"TagListRef::get_index type mismatch for tag {}: {}",
|
||||
|
@ -501,7 +501,7 @@ impl TagListRef {
|
|||
}
|
||||
|
||||
pub fn size<'a, T: Tag<'a>>(&self) -> u32 {
|
||||
self.get_size_by_name(T::tag_name())
|
||||
self.size_by_name(T::tag_name())
|
||||
}
|
||||
|
||||
pub fn size_by_name(&self, tag_name: &str) -> u32 {
|
||||
|
@ -603,7 +603,7 @@ impl<'a, T: Tag<'a>> TagIter<'a, T> {
|
|||
TagIter {
|
||||
taglist,
|
||||
idx: 0,
|
||||
size: taglist.get_size::<T>(),
|
||||
size: taglist.size::<T>(),
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ where
|
|||
return None;
|
||||
}
|
||||
|
||||
let item = self.taglist.get_index::<T>(self.idx);
|
||||
let item = self.taglist.index::<T>(self.idx);
|
||||
self.idx += 1;
|
||||
|
||||
item
|
||||
|
@ -649,7 +649,7 @@ where
|
|||
}
|
||||
|
||||
self.size -= 1;
|
||||
self.taglist.get_index::<T>(self.size)
|
||||
self.taglist.index::<T>(self.size)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -675,7 +675,7 @@ impl<'a> GenericTagIter<'a> {
|
|||
taglist,
|
||||
name,
|
||||
idx: 0,
|
||||
size: taglist.get_size_by_name(name),
|
||||
size: taglist.size_by_name(name),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ impl<'a> Iterator for GenericTagIter<'a> {
|
|||
return None;
|
||||
}
|
||||
|
||||
let item = self.taglist.get_index_generic(self.name, self.idx);
|
||||
let item = self.taglist.index_generic(self.name, self.idx);
|
||||
self.idx += 1;
|
||||
|
||||
item
|
||||
|
@ -712,7 +712,7 @@ impl<'a> DoubleEndedIterator for GenericTagIter<'a> {
|
|||
}
|
||||
|
||||
self.size -= 1;
|
||||
self.taglist.get_index_generic(self.name, self.size)
|
||||
self.taglist.index_generic(self.name, self.size)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -805,7 +805,7 @@ impl<'a> Iterator for Iter<'a> {
|
|||
}
|
||||
|
||||
let name = self.taglist.nth_tag_name(self.idx);
|
||||
let item = (name, self.taglist.get_generic(name).unwrap());
|
||||
let item = (name, self.taglist.generic(name).unwrap());
|
||||
self.idx += 1;
|
||||
|
||||
Some(item)
|
||||
|
@ -830,7 +830,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
|
|||
|
||||
self.size -= 1;
|
||||
let name = self.taglist.nth_tag_name(self.idx);
|
||||
Some((name, self.taglist.get_generic(name).unwrap()))
|
||||
Some((name, self.taglist.generic(name).unwrap()))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -974,12 +974,9 @@ mod tests {
|
|||
tags.get::<Duration>().unwrap().get_some(),
|
||||
(crate::SECOND * 120)
|
||||
);
|
||||
assert_eq!(tags.index::<Title>(0).unwrap().get(), Some("some title"));
|
||||
assert_eq!(
|
||||
tags.get_index::<Title>(0).unwrap().get(),
|
||||
Some("some title")
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<Duration>(0).unwrap().get_some(),
|
||||
tags.index::<Duration>(0).unwrap().get_some(),
|
||||
(crate::SECOND * 120)
|
||||
);
|
||||
}
|
||||
|
@ -1029,32 +1026,32 @@ mod tests {
|
|||
}
|
||||
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_TITLE, 0).unwrap().get(),
|
||||
tags.index_generic(&TAG_TITLE, 0).unwrap().get(),
|
||||
Ok(Some("some title"))
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_TITLE, 1).unwrap().get(),
|
||||
tags.index_generic(&TAG_TITLE, 1).unwrap().get(),
|
||||
Ok(Some("second title"))
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_DURATION, 0).unwrap().get(),
|
||||
tags.index_generic(&TAG_DURATION, 0).unwrap().get(),
|
||||
Ok(Some(crate::SECOND * 120))
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index_generic(&TAG_TITLE, 2).unwrap().get(),
|
||||
tags.index_generic(&TAG_TITLE, 2).unwrap().get(),
|
||||
Ok(Some("third title"))
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
tags.get_generic(&TAG_TITLE).unwrap().get(),
|
||||
tags.generic(&TAG_TITLE).unwrap().get(),
|
||||
Ok(Some("some title, second title, third title"))
|
||||
);
|
||||
|
||||
assert_eq!(tags.n_tags(), 2);
|
||||
assert_eq!(tags.nth_tag_name(0), *TAG_TITLE);
|
||||
assert_eq!(tags.get_size_by_name(&TAG_TITLE), 3);
|
||||
assert_eq!(tags.size_by_name(&TAG_TITLE), 3);
|
||||
assert_eq!(tags.nth_tag_name(1), *TAG_DURATION);
|
||||
assert_eq!(tags.get_size_by_name(&TAG_DURATION), 1);
|
||||
assert_eq!(tags.size_by_name(&TAG_DURATION), 1);
|
||||
|
||||
// GenericTagIter
|
||||
let mut title_iter = tags.iter_tag_generic(&TAG_TITLE);
|
||||
|
|
|
@ -464,28 +464,23 @@ mod tests {
|
|||
let tags: TagList = ron::de::from_str(tag_list_ron).unwrap();
|
||||
assert_eq!(tags.scope(), TagScope::Global);
|
||||
|
||||
assert_eq!(tags.get_index::<Title>(0).unwrap().get(), Some("a title"));
|
||||
assert_eq!(tags.index::<Title>(0).unwrap().get(), Some("a title"));
|
||||
assert_eq!(tags.index::<Title>(1).unwrap().get(), Some("another title"));
|
||||
assert_eq!(
|
||||
tags.get_index::<Title>(1).unwrap().get(),
|
||||
Some("another title")
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<Duration>(0).unwrap().get_some(),
|
||||
tags.index::<Duration>(0).unwrap().get_some(),
|
||||
crate::SECOND * 120
|
||||
);
|
||||
assert_eq!(tags.get_index::<Bitrate>(0).unwrap().get_some(), 96_000);
|
||||
assert!(
|
||||
(tags.get_index::<TrackGain>(0).unwrap().get_some() - 1f64).abs() < std::f64::EPSILON
|
||||
);
|
||||
assert_eq!(tags.index::<Bitrate>(0).unwrap().get_some(), 96_000);
|
||||
assert!((tags.index::<TrackGain>(0).unwrap().get_some() - 1f64).abs() < std::f64::EPSILON);
|
||||
assert_eq!(
|
||||
tags.get_index::<Date>(0).unwrap().get().unwrap(),
|
||||
tags.index::<Date>(0).unwrap().get().unwrap(),
|
||||
glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
tags.index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
crate::DateTime::new_ymd(2018, 5, 28).unwrap()
|
||||
);
|
||||
let sample = tags.get_index::<Image>(0).unwrap().get().unwrap();
|
||||
let sample = tags.index::<Image>(0).unwrap().get().unwrap();
|
||||
let buffer = sample.buffer().unwrap();
|
||||
{
|
||||
let data = buffer.map_readable().unwrap();
|
||||
|
@ -509,24 +504,19 @@ mod tests {
|
|||
let tags: TagList = serde_json::from_str(tag_json).unwrap();
|
||||
assert_eq!(tags.scope(), TagScope::Global);
|
||||
|
||||
assert_eq!(tags.get_index::<Title>(0).unwrap().get(), Some("a title"));
|
||||
assert_eq!(tags.index::<Title>(0).unwrap().get(), Some("a title"));
|
||||
assert_eq!(tags.index::<Title>(1).unwrap().get(), Some("another title"));
|
||||
assert_eq!(tags.index::<Bitrate>(0).unwrap().get_some(), 96_000);
|
||||
assert!((tags.index::<TrackGain>(0).unwrap().get_some() - 1f64).abs() < std::f64::EPSILON);
|
||||
assert_eq!(
|
||||
tags.get_index::<Title>(1).unwrap().get(),
|
||||
Some("another title")
|
||||
);
|
||||
assert_eq!(tags.get_index::<Bitrate>(0).unwrap().get_some(), 96_000);
|
||||
assert!(
|
||||
(tags.get_index::<TrackGain>(0).unwrap().get_some() - 1f64).abs() < std::f64::EPSILON
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<Date>(0).unwrap().get().unwrap(),
|
||||
tags.index::<Date>(0).unwrap().get().unwrap(),
|
||||
glib::Date::new_dmy(28, glib::DateMonth::May, 2018).unwrap()
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
tags.index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
crate::DateTime::new_ymd(2018, 5, 28).unwrap()
|
||||
);
|
||||
let sample = tags.get_index::<Image>(0).unwrap().get().unwrap();
|
||||
let sample = tags.index::<Image>(0).unwrap().get().unwrap();
|
||||
let buffer = sample.buffer().unwrap();
|
||||
{
|
||||
let data = buffer.map_readable().unwrap();
|
||||
|
@ -574,36 +564,36 @@ mod tests {
|
|||
assert_eq!(tags_de.scope(), TagScope::Global);
|
||||
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Title>(0).unwrap().get(),
|
||||
tags.get_index::<Title>(0).unwrap().get(),
|
||||
tags_de.index::<Title>(0).unwrap().get(),
|
||||
tags.index::<Title>(0).unwrap().get(),
|
||||
);
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Title>(1).unwrap().get(),
|
||||
tags.get_index::<Title>(1).unwrap().get(),
|
||||
tags_de.index::<Title>(1).unwrap().get(),
|
||||
tags.index::<Title>(1).unwrap().get(),
|
||||
);
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Duration>(0).unwrap().get_some(),
|
||||
tags.get_index::<Duration>(0).unwrap().get_some(),
|
||||
tags_de.index::<Duration>(0).unwrap().get_some(),
|
||||
tags.index::<Duration>(0).unwrap().get_some(),
|
||||
);
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Bitrate>(0).unwrap().get_some(),
|
||||
tags.get_index::<Bitrate>(0).unwrap().get_some(),
|
||||
tags_de.index::<Bitrate>(0).unwrap().get_some(),
|
||||
tags.index::<Bitrate>(0).unwrap().get_some(),
|
||||
);
|
||||
assert!(
|
||||
(tags_de.get_index::<TrackGain>(0).unwrap().get_some()
|
||||
- tags.get_index::<TrackGain>(0).unwrap().get_some())
|
||||
(tags_de.index::<TrackGain>(0).unwrap().get_some()
|
||||
- tags.index::<TrackGain>(0).unwrap().get_some())
|
||||
.abs()
|
||||
< std::f64::EPSILON
|
||||
);
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Date>(0).unwrap().get(),
|
||||
tags.get_index::<Date>(0).unwrap().get(),
|
||||
tags_de.index::<Date>(0).unwrap().get(),
|
||||
tags.index::<Date>(0).unwrap().get(),
|
||||
);
|
||||
assert_eq!(
|
||||
tags.get_index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
tags.index::<DateTime>(0).unwrap().get().unwrap(),
|
||||
crate::DateTime::new_ymd(2018, 5, 28).unwrap()
|
||||
);
|
||||
let sample = tags.get_index::<Image>(0).unwrap().get().unwrap();
|
||||
let sample = tags.index::<Image>(0).unwrap().get().unwrap();
|
||||
let buffer = sample.buffer().unwrap();
|
||||
{
|
||||
let data = buffer.map_readable().unwrap();
|
||||
|
|
|
@ -387,10 +387,7 @@ mod tests {
|
|||
assert_eq!("chapter1.1", chapter1_1.uid());
|
||||
assert_eq!(Some((0, 4)), chapter1_1.start_stop_times());
|
||||
let tags = chapter1_1.tags().unwrap();
|
||||
assert_eq!(
|
||||
Some("chapter 1.1"),
|
||||
tags.get_index::<Title>(0).unwrap().get()
|
||||
);
|
||||
assert_eq!(Some("chapter 1.1"), tags.index::<Title>(0).unwrap().get());
|
||||
assert_eq!(0, chapter1_1.sub_entries().len());
|
||||
|
||||
let chapter1_2 = &chap1_sub_entries[1];
|
||||
|
@ -398,17 +395,14 @@ mod tests {
|
|||
assert_eq!("chapter1.2", chapter1_2.uid());
|
||||
assert_eq!(Some((4, 10)), chapter1_2.start_stop_times());
|
||||
let tags = chapter1_2.tags().unwrap();
|
||||
assert_eq!(
|
||||
Some("chapter 1.2"),
|
||||
tags.get_index::<Title>(0).unwrap().get()
|
||||
);
|
||||
assert_eq!(Some("chapter 1.2"), tags.index::<Title>(0).unwrap().get());
|
||||
assert_eq!(0, chapter1_2.sub_entries().len());
|
||||
|
||||
let chapter2 = &sub_entries[1];
|
||||
assert_eq!(TocEntryType::Chapter, chapter2.entry_type());
|
||||
assert_eq!("chapter2", chapter2.uid());
|
||||
let tags = chapter2.tags().unwrap();
|
||||
assert_eq!(Some("chapter 2"), tags.get_index::<Title>(0).unwrap().get());
|
||||
assert_eq!(Some("chapter 2"), tags.index::<Title>(0).unwrap().get());
|
||||
assert_eq!(Some((10, 15)), chapter2.start_stop_times());
|
||||
assert_eq!(0, chapter2.sub_entries().len());
|
||||
}
|
||||
|
@ -518,8 +512,8 @@ mod tests {
|
|||
let tags_de = chapter1_1_de.tags().unwrap();
|
||||
let tags = chapter1_1.tags().unwrap();
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Title>(0).unwrap().get(),
|
||||
tags.get_index::<Title>(0).unwrap().get()
|
||||
tags_de.index::<Title>(0).unwrap().get(),
|
||||
tags.index::<Title>(0).unwrap().get()
|
||||
);
|
||||
assert_eq!(
|
||||
chapter1_1_de.sub_entries().len(),
|
||||
|
@ -537,8 +531,8 @@ mod tests {
|
|||
let tags_de = chapter1_2_de.tags().unwrap();
|
||||
let tags = chapter1_2.tags().unwrap();
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Title>(0).unwrap().get(),
|
||||
tags.get_index::<Title>(0).unwrap().get()
|
||||
tags_de.index::<Title>(0).unwrap().get(),
|
||||
tags.index::<Title>(0).unwrap().get()
|
||||
);
|
||||
assert_eq!(
|
||||
chapter1_2_de.sub_entries().len(),
|
||||
|
@ -552,8 +546,8 @@ mod tests {
|
|||
let tags_de = chapter2_de.tags().unwrap();
|
||||
let tags = chapter2.tags().unwrap();
|
||||
assert_eq!(
|
||||
tags_de.get_index::<Title>(0).unwrap().get(),
|
||||
tags.get_index::<Title>(0).unwrap().get()
|
||||
tags_de.index::<Title>(0).unwrap().get(),
|
||||
tags.index::<Title>(0).unwrap().get()
|
||||
);
|
||||
assert_eq!(chapter2_de.start_stop_times(), chapter2.start_stop_times());
|
||||
assert_eq!(
|
||||
|
|
|
@ -164,7 +164,7 @@ impl<T: AsRef<[u8]>> SliceTypeFind<T> {
|
|||
}
|
||||
|
||||
pub fn run(&mut self) {
|
||||
let factories = TypeFindFactory::get_list();
|
||||
let factories = TypeFindFactory::list();
|
||||
|
||||
for factory in factories {
|
||||
factory.call_function(self);
|
||||
|
@ -239,13 +239,13 @@ mod tests {
|
|||
fn test_typefind_call_function() {
|
||||
crate::init().unwrap();
|
||||
|
||||
let xml_factory = TypeFindFactory::get_list()
|
||||
let xml_factory = TypeFindFactory::list()
|
||||
.iter()
|
||||
.cloned()
|
||||
.find(|f| {
|
||||
f.caps()
|
||||
.map(|c| {
|
||||
c.get_structure(0)
|
||||
c.structure(0)
|
||||
.map(|s| s.name() == "application/xml")
|
||||
.unwrap_or(false)
|
||||
})
|
||||
|
|
|
@ -56,11 +56,7 @@ fn send_seek_event(pipeline: &Element, rate: f64) -> bool {
|
|||
};
|
||||
|
||||
// If we have not done so, obtain the sink through which we will send the seek events
|
||||
if let Ok(Some(video_sink)) = pipeline
|
||||
.get_property("video-sink")
|
||||
.unwrap()
|
||||
.get::<Element>()
|
||||
{
|
||||
if let Ok(Some(video_sink)) = pipeline.property("video-sink").unwrap().get::<Element>() {
|
||||
println!("Current rate: {}\r", rate);
|
||||
// Send the event
|
||||
video_sink.send_event(seek_event)
|
||||
|
@ -175,10 +171,8 @@ USAGE: Choose one of the following options, then press enter:
|
|||
}
|
||||
}
|
||||
Command::NextFrame => {
|
||||
if let Ok(Some(video_sink)) = pipeline
|
||||
.get_property("video-sink")
|
||||
.unwrap()
|
||||
.get::<Element>()
|
||||
if let Ok(Some(video_sink)) =
|
||||
pipeline.property("video-sink").unwrap().get::<Element>()
|
||||
{
|
||||
// Send the event
|
||||
let step = Step::new(gst::format::Buffers(Some(1)), rate.abs(), true, false);
|
||||
|
|
|
@ -39,7 +39,7 @@ fn tutorial_main() {
|
|||
println!("Received new pad {} from {}", src_pad.name(), src.name());
|
||||
|
||||
let sink_pad = convert
|
||||
.get_static_pad("sink")
|
||||
.static_pad("sink")
|
||||
.expect("Failed to get static sink pad from convert");
|
||||
if sink_pad.is_linked() {
|
||||
println!("We are already linked. Ignoring.");
|
||||
|
@ -50,7 +50,7 @@ fn tutorial_main() {
|
|||
.current_caps()
|
||||
.expect("Failed to get caps of new pad.");
|
||||
let new_pad_struct = new_pad_caps
|
||||
.get_structure(0)
|
||||
.structure(0)
|
||||
.expect("Failed to get first structure of caps.");
|
||||
let new_pad_type = new_pad_struct.name();
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ mod tutorial5 {
|
|||
let propname: &str = &format!("n-{}", stype);
|
||||
let signame: &str = &format!("get-{}-tags", stype);
|
||||
|
||||
match playbin.get_property(propname).unwrap().get() {
|
||||
match playbin.property(propname).unwrap().get() {
|
||||
Ok(Some(x)) => {
|
||||
for i in 0..x {
|
||||
let tags = playbin.emit_by_name(signame, &[&i]).unwrap().unwrap();
|
||||
|
|
|
@ -30,7 +30,7 @@ fn print_caps(caps: &gst::Caps, prefix: &str) {
|
|||
// Prints information about a Pad Template, including its Capabilitites
|
||||
fn print_pad_template_information(factory: &gst::ElementFactory) {
|
||||
let long_name = factory
|
||||
.get_metadata("long-name")
|
||||
.metadata("long-name")
|
||||
.expect("Failed to get long-name of element factory.");
|
||||
println!("Pad Template for {}:", long_name);
|
||||
|
||||
|
@ -66,7 +66,7 @@ fn print_pad_template_information(factory: &gst::ElementFactory) {
|
|||
|
||||
fn print_pad_capabilities(element: &gst::Element, pad_name: &str) {
|
||||
let pad = element
|
||||
.get_static_pad(pad_name)
|
||||
.static_pad(pad_name)
|
||||
.expect("Could not retrieve pad");
|
||||
|
||||
println!("Caps for the {} pad:", pad_name);
|
||||
|
|
|
@ -47,20 +47,20 @@ fn tutorial_main() {
|
|||
gst::Element::link_many(&[&audio_queue, &audio_convert, &audio_resample, &audio_sink]).unwrap();
|
||||
gst::Element::link_many(&[&video_queue, &visual, &video_convert, &video_sink]).unwrap();
|
||||
|
||||
let tee_audio_pad = tee.get_request_pad("src_%u").unwrap();
|
||||
let tee_audio_pad = tee.request_pad("src_%u").unwrap();
|
||||
println!(
|
||||
"Obtained request pad {} for audio branch",
|
||||
tee_audio_pad.name()
|
||||
);
|
||||
let queue_audio_pad = audio_queue.get_static_pad("sink").unwrap();
|
||||
let queue_audio_pad = audio_queue.static_pad("sink").unwrap();
|
||||
tee_audio_pad.link(&queue_audio_pad).unwrap();
|
||||
|
||||
let tee_video_pad = tee.get_request_pad("src_%u").unwrap();
|
||||
let tee_video_pad = tee.request_pad("src_%u").unwrap();
|
||||
println!(
|
||||
"Obtained request pad {} for video branch",
|
||||
tee_video_pad.name()
|
||||
);
|
||||
let queue_video_pad = video_queue.get_static_pad("sink").unwrap();
|
||||
let queue_video_pad = video_queue.static_pad("sink").unwrap();
|
||||
tee_video_pad.link(&queue_video_pad).unwrap();
|
||||
|
||||
pipeline
|
||||
|
|
|
@ -98,23 +98,23 @@ fn main() {
|
|||
.unwrap();
|
||||
gst::Element::link_many(&[&app_queue, &appsink]).unwrap();
|
||||
|
||||
let tee_audio_pad = tee.get_request_pad("src_%u").unwrap();
|
||||
let tee_audio_pad = tee.request_pad("src_%u").unwrap();
|
||||
println!(
|
||||
"Obtained request pad {} for audio branch",
|
||||
tee_audio_pad.name()
|
||||
);
|
||||
let queue_audio_pad = audio_queue.get_static_pad("sink").unwrap();
|
||||
let queue_audio_pad = audio_queue.static_pad("sink").unwrap();
|
||||
tee_audio_pad.link(&queue_audio_pad).unwrap();
|
||||
|
||||
let tee_video_pad = tee.get_request_pad("src_%u").unwrap();
|
||||
let tee_video_pad = tee.request_pad("src_%u").unwrap();
|
||||
println!(
|
||||
"Obtained request pad {} for video branch",
|
||||
tee_video_pad.name()
|
||||
);
|
||||
let queue_video_pad = video_queue.get_static_pad("sink").unwrap();
|
||||
let queue_video_pad = video_queue.static_pad("sink").unwrap();
|
||||
tee_video_pad.link(&queue_video_pad).unwrap();
|
||||
let tee_app_pad = tee.get_request_pad("src_%u").unwrap();
|
||||
let queue_app_pad = app_queue.get_static_pad("sink").unwrap();
|
||||
let tee_app_pad = tee.request_pad("src_%u").unwrap();
|
||||
let queue_app_pad = app_queue.static_pad("sink").unwrap();
|
||||
tee_app_pad.link(&queue_app_pad).unwrap();
|
||||
|
||||
// configure appsrc
|
||||
|
|
|
@ -23,7 +23,7 @@ fn tutorial_main() -> Result<(), Error> {
|
|||
pipeline.set_property("uri", &uri).unwrap();
|
||||
|
||||
// Set the download flag
|
||||
let flags = pipeline.get_property("flags")?;
|
||||
let flags = pipeline.property("flags")?;
|
||||
let flags_class = FlagsClass::new(flags.type_()).unwrap();
|
||||
let flags = flags_class
|
||||
.builder_with_value(flags)
|
||||
|
@ -107,7 +107,7 @@ fn tutorial_main() -> Result<(), Error> {
|
|||
println!(
|
||||
"Temporary file: {:?}",
|
||||
download_buffer
|
||||
.get_property("temp-location")
|
||||
.property("temp-location")
|
||||
.unwrap()
|
||||
.get::<String>()
|
||||
.unwrap()
|
||||
|
|
|
@ -53,7 +53,7 @@ where
|
|||
{
|
||||
use std::thread;
|
||||
|
||||
let l = runloop::CFRunLoop::get_main();
|
||||
let l = runloop::CFRunLoop::main();
|
||||
let t = thread::spawn(move || {
|
||||
let res = main();
|
||||
l.stop();
|
||||
|
|
Loading…
Reference in a new issue