mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-22 10:06:29 +00:00
Remove redundant ObjectType::RsType associated type
It's supposed to be the same as Self
This commit is contained in:
parent
5e9f42e7f8
commit
f45723c04e
5 changed files with 25 additions and 27 deletions
|
@ -82,7 +82,7 @@ pub unsafe trait BaseSink: IsA<gst_base::BaseSink> {
|
|||
|
||||
pub unsafe trait BaseSinkClass<T: ObjectType>
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSink>,
|
||||
T: IsA<gst_base::BaseSink>,
|
||||
T::ImplType: BaseSinkImpl,
|
||||
{
|
||||
fn override_vfuncs(&mut self) {
|
||||
|
@ -153,7 +153,6 @@ impl ObjectType for RsBaseSink {
|
|||
const NAME: &'static str = "RsBaseSink";
|
||||
type GlibType = gst_base_ffi::GstBaseSink;
|
||||
type GlibClassType = gst_base_ffi::GstBaseSinkClass;
|
||||
type RsType = RsBaseSink;
|
||||
type ImplType = Box<BaseSinkImpl>;
|
||||
|
||||
fn glib_type() -> glib::Type {
|
||||
|
@ -170,7 +169,7 @@ unsafe extern "C" fn base_sink_start<T: ObjectType>(
|
|||
ptr: *mut gst_base_ffi::GstBaseSink,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSink>,
|
||||
T: IsA<gst_base::BaseSink>,
|
||||
T::ImplType: BaseSinkImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -186,7 +185,7 @@ unsafe extern "C" fn base_sink_stop<T: ObjectType>(
|
|||
ptr: *mut gst_base_ffi::GstBaseSink,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSink>,
|
||||
T: IsA<gst_base::BaseSink>,
|
||||
T::ImplType: BaseSinkImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -203,7 +202,7 @@ unsafe extern "C" fn base_sink_render<T: ObjectType>(
|
|||
buffer: *mut gst_ffi::GstBuffer,
|
||||
) -> gst_ffi::GstFlowReturn
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSink>,
|
||||
T: IsA<gst_base::BaseSink>,
|
||||
T::ImplType: BaseSinkImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -223,7 +222,7 @@ unsafe extern "C" fn base_sink_query<T: ObjectType>(
|
|||
query_ptr: *mut gst_ffi::GstQuery,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSink>,
|
||||
T: IsA<gst_base::BaseSink>,
|
||||
T::ImplType: BaseSinkImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -241,7 +240,7 @@ unsafe extern "C" fn base_sink_event<T: ObjectType>(
|
|||
event_ptr: *mut gst_ffi::GstEvent,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSink>,
|
||||
T: IsA<gst_base::BaseSink>,
|
||||
T::ImplType: BaseSinkImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
|
|
@ -115,7 +115,7 @@ pub unsafe trait BaseSrc: IsA<gst_base::BaseSrc> {
|
|||
|
||||
pub unsafe trait BaseSrcClass<T: ObjectType>
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
fn override_vfuncs(&mut self) {
|
||||
|
@ -143,6 +143,7 @@ glib_wrapper! {
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME: This is wrong: it must be a basesrc but also backed by ObjectType<T>
|
||||
unsafe impl<T: IsA<gst_base::BaseSrc>> BaseSrc for T {}
|
||||
pub type RsBaseSrcClass = ClassStruct<RsBaseSrc>;
|
||||
|
||||
|
@ -209,7 +210,6 @@ impl ObjectType for RsBaseSrc {
|
|||
const NAME: &'static str = "RsBaseSrc";
|
||||
type GlibType = gst_base_ffi::GstBaseSrc;
|
||||
type GlibClassType = gst_base_ffi::GstBaseSrcClass;
|
||||
type RsType = RsBaseSrc;
|
||||
type ImplType = Box<BaseSrcImpl>;
|
||||
|
||||
fn glib_type() -> glib::Type {
|
||||
|
@ -226,7 +226,7 @@ unsafe extern "C" fn base_src_start<T: ObjectType>(
|
|||
ptr: *mut gst_base_ffi::GstBaseSrc,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -242,7 +242,7 @@ unsafe extern "C" fn base_src_stop<T: ObjectType>(
|
|||
ptr: *mut gst_base_ffi::GstBaseSrc,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -258,7 +258,7 @@ unsafe extern "C" fn base_src_is_seekable<T: ObjectType>(
|
|||
ptr: *mut gst_base_ffi::GstBaseSrc,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -275,7 +275,7 @@ unsafe extern "C" fn base_src_get_size<T: ObjectType>(
|
|||
size: *mut u64,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -302,7 +302,7 @@ unsafe extern "C" fn base_src_fill<T: ObjectType>(
|
|||
buffer: *mut gst_ffi::GstBuffer,
|
||||
) -> gst_ffi::GstFlowReturn
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -322,7 +322,7 @@ unsafe extern "C" fn base_src_do_seek<T: ObjectType>(
|
|||
segment: *mut gst_ffi::GstSegment,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -341,7 +341,7 @@ unsafe extern "C" fn base_src_query<T: ObjectType>(
|
|||
query_ptr: *mut gst_ffi::GstQuery,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
@ -359,7 +359,7 @@ unsafe extern "C" fn base_src_event<T: ObjectType>(
|
|||
event_ptr: *mut gst_ffi::GstEvent,
|
||||
) -> glib_ffi::gboolean
|
||||
where
|
||||
T::RsType: IsA<gst_base::BaseSrc>,
|
||||
T: IsA<gst_base::BaseSrc>,
|
||||
T::ImplType: BaseSrcImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
|
|
@ -55,7 +55,7 @@ pub unsafe trait Element: IsA<gst::Element> {
|
|||
|
||||
pub unsafe trait ElementClass<T: ObjectType>
|
||||
where
|
||||
T::RsType: IsA<gst::Element>,
|
||||
T: IsA<gst::Element>,
|
||||
T::ImplType: ElementImpl,
|
||||
{
|
||||
fn add_pad_template(&mut self, pad_template: gst::PadTemplate) {
|
||||
|
@ -142,7 +142,6 @@ impl ObjectType for RsElement {
|
|||
const NAME: &'static str = "RsElement";
|
||||
type GlibType = gst_ffi::GstElement;
|
||||
type GlibClassType = gst_ffi::GstElementClass;
|
||||
type RsType = RsElement;
|
||||
type ImplType = Box<ElementImpl>;
|
||||
|
||||
fn glib_type() -> glib::Type {
|
||||
|
@ -159,7 +158,7 @@ unsafe extern "C" fn element_change_state<T: ObjectType>(
|
|||
transition: gst_ffi::GstStateChange,
|
||||
) -> gst_ffi::GstStateChangeReturn
|
||||
where
|
||||
T::RsType: IsA<gst::Element>,
|
||||
T: IsA<gst::Element>,
|
||||
T::ImplType: ElementImpl,
|
||||
{
|
||||
callback_guard!();
|
||||
|
|
|
@ -80,5 +80,4 @@ pub mod element;
|
|||
pub mod base_src;
|
||||
#[macro_use]
|
||||
pub mod base_sink;
|
||||
#[macro_use]
|
||||
pub mod uri_handler;
|
||||
|
|
|
@ -55,32 +55,33 @@ macro_rules! box_object_impl(
|
|||
|
||||
pub trait ImplTypeStatic<T: ObjectType>: Send + Sync + 'static {
|
||||
fn get_name(&self) -> &str;
|
||||
fn new(&self, &T::RsType) -> T::ImplType;
|
||||
fn new(&self, &T) -> T::ImplType;
|
||||
// FIXME: Needs token, needs to become override_vfuncs()
|
||||
// override_vfuncs() functions need to take token
|
||||
fn class_init(&self, &mut ClassStruct<T>);
|
||||
fn type_init(&self, _: &TypeInitToken, _type_: glib::Type) {}
|
||||
}
|
||||
|
||||
pub struct TypeInitToken(());
|
||||
|
||||
pub trait ObjectType: 'static
|
||||
pub trait ObjectType: FromGlibPtrBorrow<*mut InstanceStruct<Self>> + 'static
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
const NAME: &'static str;
|
||||
type GlibType;
|
||||
type GlibClassType;
|
||||
type RsType: FromGlibPtrBorrow<*mut InstanceStruct<Self>>;
|
||||
type ImplType: ObjectImpl;
|
||||
|
||||
fn glib_type() -> glib::Type;
|
||||
|
||||
fn class_init(klass: &mut ClassStruct<Self>);
|
||||
|
||||
fn set_property(_obj: &Self::RsType, _id: u32, _value: &glib::Value) {
|
||||
fn set_property(_obj: &Self, _id: u32, _value: &glib::Value) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn get_property(_obj: &Self::RsType, _id: u32) -> Result<glib::Value, ()> {
|
||||
fn get_property(_obj: &Self, _id: u32) -> Result<glib::Value, ()> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
@ -514,7 +515,7 @@ unsafe extern "C" fn sub_init<T: ObjectType>(
|
|||
floating_reference_guard!(obj);
|
||||
let instance = &mut *(obj as *mut InstanceStruct<T>);
|
||||
let klass = &**(obj as *const *const ClassStruct<T>);
|
||||
let rs_instance: T::RsType = from_glib_borrow(obj as *mut InstanceStruct<T>);
|
||||
let rs_instance: T = from_glib_borrow(obj as *mut InstanceStruct<T>);
|
||||
|
||||
let imp = (*klass.imp_static).new(&rs_instance);
|
||||
instance.imp = Box::into_raw(Box::new(imp));
|
||||
|
|
Loading…
Reference in a new issue