mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
Add functions using queries
This commit is contained in:
parent
5afa1858ed
commit
52dbf03d4f
6 changed files with 91 additions and 37 deletions
35
Gir_Gst.toml
35
Gir_Gst.toml
|
@ -132,6 +132,11 @@ name = "Gst.TagList"
|
|||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Query"
|
||||
status = "manual"
|
||||
ref_mode = "ref"
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Clock"
|
||||
status = "generate"
|
||||
|
@ -198,6 +203,11 @@ status = "generate"
|
|||
[object.function.return]
|
||||
bool_return_is_error = "Failed to sync state with parent"
|
||||
|
||||
[[object.function]]
|
||||
name = "query"
|
||||
# correct mutability
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "Gst.ElementFactory"
|
||||
status = "generate"
|
||||
|
@ -331,6 +341,31 @@ status = "generate"
|
|||
# Has getter/setter functions
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "query"
|
||||
# Correct mutability
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "peer_query"
|
||||
# Correct mutability
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "query_default"
|
||||
# Correct mutability
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "proxy_query_caps"
|
||||
# Correct mutability
|
||||
ignore = true
|
||||
|
||||
[[object.function]]
|
||||
name = "proxy_query_accept_caps"
|
||||
# Correct mutability
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "Gst.Stream"
|
||||
status = "generate"
|
||||
|
|
|
@ -160,8 +160,6 @@ pub trait ElementExt {
|
|||
|
||||
fn provide_clock(&self) -> Option<Clock>;
|
||||
|
||||
//fn query(&self, query: /*Ignored*/&mut Query) -> bool;
|
||||
|
||||
fn query_convert(&self, src_format: Format, src_val: i64, dest_format: Format) -> Option<i64>;
|
||||
|
||||
fn query_duration(&self, format: Format) -> Option<i64>;
|
||||
|
@ -438,10 +436,6 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
//fn query(&self, query: /*Ignored*/&mut Query) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_element_query() }
|
||||
//}
|
||||
|
||||
fn query_convert(&self, src_format: Format, src_val: i64, dest_format: Format) -> Option<i64> {
|
||||
unsafe {
|
||||
let mut dest_val = mem::uninitialized();
|
||||
|
|
|
@ -148,8 +148,6 @@ pub trait PadExt {
|
|||
|
||||
fn pause_task(&self) -> Result<(), glib::error::BoolError>;
|
||||
|
||||
//fn peer_query(&self, query: /*Ignored*/&mut Query) -> bool;
|
||||
|
||||
fn peer_query_accept_caps(&self, caps: &Caps) -> bool;
|
||||
|
||||
fn peer_query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps>;
|
||||
|
@ -160,24 +158,16 @@ pub trait PadExt {
|
|||
|
||||
fn peer_query_position(&self, format: Format) -> Option<i64>;
|
||||
|
||||
//fn proxy_query_accept_caps(&self, query: /*Ignored*/&mut Query) -> bool;
|
||||
|
||||
//fn proxy_query_caps(&self, query: /*Ignored*/&mut Query) -> bool;
|
||||
|
||||
//fn push_event(&self, event: /*Ignored*/&mut Event) -> bool;
|
||||
|
||||
//fn push_list(&self, list: /*Ignored*/&mut BufferList) -> FlowReturn;
|
||||
|
||||
//fn query(&self, query: /*Ignored*/&mut Query) -> bool;
|
||||
|
||||
fn query_accept_caps(&self, caps: &Caps) -> bool;
|
||||
|
||||
fn query_caps<'a, P: Into<Option<&'a Caps>>>(&self, filter: P) -> Option<Caps>;
|
||||
|
||||
fn query_convert(&self, src_format: Format, src_val: i64, dest_format: Format) -> Option<i64>;
|
||||
|
||||
//fn query_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, query: /*Ignored*/&mut Query) -> bool;
|
||||
|
||||
fn query_duration(&self, format: Format) -> Option<i64>;
|
||||
|
||||
fn query_position(&self, format: Format) -> Option<i64>;
|
||||
|
@ -438,10 +428,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
//fn peer_query(&self, query: /*Ignored*/&mut Query) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_pad_peer_query() }
|
||||
//}
|
||||
|
||||
fn peer_query_accept_caps(&self, caps: &Caps) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pad_peer_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0))
|
||||
|
@ -480,14 +466,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
//fn proxy_query_accept_caps(&self, query: /*Ignored*/&mut Query) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_pad_proxy_query_accept_caps() }
|
||||
//}
|
||||
|
||||
//fn proxy_query_caps(&self, query: /*Ignored*/&mut Query) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_pad_proxy_query_caps() }
|
||||
//}
|
||||
|
||||
//fn push_event(&self, event: /*Ignored*/&mut Event) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_pad_push_event() }
|
||||
//}
|
||||
|
@ -496,10 +474,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
|
|||
// unsafe { TODO: call ffi::gst_pad_push_list() }
|
||||
//}
|
||||
|
||||
//fn query(&self, query: /*Ignored*/&mut Query) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_pad_query() }
|
||||
//}
|
||||
|
||||
fn query_accept_caps(&self, caps: &Caps) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pad_query_accept_caps(self.to_glib_none().0, caps.to_glib_none().0))
|
||||
|
@ -522,10 +496,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
|
|||
}
|
||||
}
|
||||
|
||||
//fn query_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, query: /*Ignored*/&mut Query) -> bool {
|
||||
// unsafe { TODO: call ffi::gst_pad_query_default() }
|
||||
//}
|
||||
|
||||
fn query_duration(&self, format: Format) -> Option<i64> {
|
||||
unsafe {
|
||||
let mut duration = mem::uninitialized();
|
||||
|
|
|
@ -11,6 +11,8 @@ use Element;
|
|||
use glib;
|
||||
use glib::IsA;
|
||||
use glib::translate::{ToGlibPtr, from_glib};
|
||||
use QueryRef;
|
||||
use miniobject::MiniObject;
|
||||
|
||||
use ffi;
|
||||
|
||||
|
@ -39,3 +41,15 @@ impl Element {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ElementExtManual {
|
||||
fn query(&self, query: &mut QueryRef) -> bool;
|
||||
}
|
||||
|
||||
impl<O: IsA<Element>> ElementExtManual for O {
|
||||
fn query(&self, query: &mut QueryRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_query(self.to_glib_none().0, query.as_mut_ptr()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ mod bus;
|
|||
mod pad;
|
||||
mod gobject;
|
||||
mod segment;
|
||||
pub use element::ElementExtManual;
|
||||
pub use bin::BinExtManual;
|
||||
pub use pad::{PadExtManual, PadProbeId, PadProbeInfo, PadProbeData, PAD_PROBE_ID_INVALID};
|
||||
pub use gobject::GObjectExtManualGst;
|
||||
|
|
|
@ -12,6 +12,7 @@ use PadProbeReturn;
|
|||
use Buffer;
|
||||
use BufferList;
|
||||
use FlowReturn;
|
||||
use QueryRef;
|
||||
use miniobject::MiniObject;
|
||||
|
||||
use std::cell::RefCell;
|
||||
|
@ -19,9 +20,10 @@ use std::mem::transmute;
|
|||
use std::ptr;
|
||||
|
||||
use glib::{IsA, StaticType};
|
||||
use glib::translate::{ToGlib, FromGlib, from_glib, from_glib_none, from_glib_full};
|
||||
use glib::translate::{ToGlib, ToGlibPtr, FromGlib, from_glib, from_glib_none, from_glib_full};
|
||||
use glib::source::CallbackGuard;
|
||||
use glib_ffi::gpointer;
|
||||
use glib::Object;
|
||||
|
||||
use libc;
|
||||
|
||||
|
@ -72,6 +74,12 @@ pub trait PadExtManual {
|
|||
|
||||
fn pull_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowReturn>;
|
||||
fn get_range(&self, offset: u64, size: u32) -> Result<Buffer, FlowReturn>;
|
||||
|
||||
fn peer_query(&self, query: &mut QueryRef) -> bool;
|
||||
fn query(&self, query: &mut QueryRef) -> bool;
|
||||
fn query_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, query: &mut QueryRef) -> bool;
|
||||
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool;
|
||||
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool;
|
||||
}
|
||||
|
||||
impl<O: IsA<Pad>> PadExtManual for O {
|
||||
|
@ -139,6 +147,38 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn query(&self, query: &mut QueryRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pad_query(self.to_glib_none().0, query.as_mut_ptr()))
|
||||
}
|
||||
}
|
||||
|
||||
fn peer_query(&self, query: &mut QueryRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pad_peer_query(self.to_glib_none().0, query.as_mut_ptr()))
|
||||
}
|
||||
}
|
||||
|
||||
fn query_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, query: &mut QueryRef) -> bool {
|
||||
let parent = parent.into();
|
||||
let parent = parent.to_glib_none();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pad_query_default(self.to_glib_none().0, parent.0 as *mut _, query.as_mut_ptr()))
|
||||
}
|
||||
}
|
||||
|
||||
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pad_proxy_query_accept_caps(self.to_glib_none().0, query.as_mut_ptr()))
|
||||
}
|
||||
}
|
||||
|
||||
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pad_proxy_query_accept_caps(self.to_glib_none().0, query.as_mut_ptr()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" fn trampoline_pad_probe(
|
||||
|
|
Loading…
Reference in a new issue