Move all minobjects to newtype wrapper types

For consistency with external crates and to help rustdoc, which gets
confused on impl blocks for type aliases.
This commit is contained in:
Sebastian Dröge 2018-09-28 18:11:46 +03:00
parent 26ee546d1a
commit 6fd0ed4cb3
12 changed files with 105 additions and 307 deletions

View file

@ -21,19 +21,19 @@ use ClockTime;
use ffi;
use glib;
use glib::translate::{from_glib, from_glib_full, ToGlib};
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
use glib_ffi;
pub enum Readable {}
pub enum Writable {}
#[repr(C)]
pub struct BufferRef(ffi::GstBuffer);
pub type Buffer = GstRc<BufferRef>;
unsafe impl MiniObject for BufferRef {
type GstType = ffi::GstBuffer;
}
gst_define_mini_object_wrapper!(
Buffer,
BufferRef,
ffi::GstBuffer,
[Debug, PartialEq, Eq,],
|| ffi::gst_buffer_get_type()
);
pub struct BufferMap<'a, T> {
buffer: &'a BufferRef,
@ -47,7 +47,7 @@ pub struct MappedBuffer<T> {
phantom: PhantomData<T>,
}
impl GstRc<BufferRef> {
impl Buffer {
pub fn new() -> Self {
assert_initialized_main_thread!();
@ -161,7 +161,7 @@ impl GstRc<BufferRef> {
}
}
impl Default for GstRc<BufferRef> {
impl Default for Buffer {
fn default() -> Self {
Self::new()
}
@ -369,23 +369,6 @@ impl BufferRef {
}
}
unsafe impl Sync for BufferRef {}
unsafe impl Send for BufferRef {}
impl glib::types::StaticType for BufferRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_buffer_get_type()) }
}
}
impl ToOwned for BufferRef {
type Owned = GstRc<BufferRef>;
fn to_owned(&self) -> GstRc<BufferRef> {
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
}
}
impl fmt::Debug for BufferRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Buffer")

View file

@ -8,22 +8,23 @@
use ffi;
use glib;
use glib::translate::{from_glib, from_glib_full};
use glib::StaticType;
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlibPtr};
use glib_ffi;
use std::fmt;
use miniobject::*;
use Buffer;
use BufferRef;
pub type BufferList = GstRc<BufferListRef>;
pub struct BufferListRef(ffi::GstBufferList);
gst_define_mini_object_wrapper!(
BufferList,
BufferListRef,
ffi::GstBufferList,
[Debug,],
|| ffi::gst_buffer_list_get_type()
);
unsafe impl MiniObject for BufferListRef {
type GstType = ffi::GstBufferList;
}
impl GstRc<BufferListRef> {
impl BufferList {
pub fn new() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_buffer_list_new()) }
@ -95,23 +96,12 @@ impl BufferListRef {
}
}
impl Default for GstRc<BufferListRef> {
impl Default for BufferList {
fn default() -> Self {
Self::new()
}
}
impl ToOwned for BufferListRef {
type Owned = GstRc<BufferListRef>;
fn to_owned(&self) -> GstRc<BufferListRef> {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
}
}
}
impl fmt::Debug for BufferListRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let size = self.iter().map(|b| b.get_size()).sum::<usize>();
@ -130,15 +120,6 @@ impl fmt::Debug for BufferListRef {
}
}
impl StaticType for BufferListRef {
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_buffer_list_get_type()) }
}
}
unsafe impl Sync for BufferListRef {}
unsafe impl Send for BufferListRef {}
pub struct Iter<'a> {
list: &'a BufferListRef,
idx: u32,

View file

@ -17,19 +17,15 @@ use CapsIntersectMode;
use ffi;
use glib;
use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr};
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
use glib::value::ToSendValue;
use glib_ffi;
#[repr(C)]
pub struct CapsRef(ffi::GstCaps);
gst_define_mini_object_wrapper!(Caps, CapsRef, ffi::GstCaps, [Debug, PartialEq, Eq,], || {
ffi::gst_caps_get_type()
});
pub type Caps = GstRc<CapsRef>;
unsafe impl MiniObject for CapsRef {
type GstType = ffi::GstCaps;
}
impl GstRc<CapsRef> {
impl Caps {
pub fn builder(name: &str) -> Builder {
assert_initialized_main_thread!();
Builder::new(name)
@ -340,12 +336,6 @@ impl CapsRef {
}
}
impl glib::types::StaticType for CapsRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_caps_get_type()) }
}
}
macro_rules! define_iter(
($name:ident, $typ:ty, $styp:ty, $get_item:expr) => {
pub struct $name<'a> {
@ -500,17 +490,6 @@ impl PartialEq for CapsRef {
impl Eq for CapsRef {}
impl ToOwned for CapsRef {
type Owned = GstRc<CapsRef>;
fn to_owned(&self) -> GstRc<CapsRef> {
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
}
}
unsafe impl Sync for CapsRef {}
unsafe impl Send for CapsRef {}
pub struct Builder<'a> {
s: ::Structure,
features: Option<&'a [&'a str]>,

View file

@ -12,20 +12,17 @@ use std::fmt;
use ffi;
use glib;
use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr};
use glib::StaticType;
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr};
use glib_ffi;
use miniobject::*;
use StructureRef;
pub type Context = GstRc<ContextRef>;
pub struct ContextRef(ffi::GstContext);
gst_define_mini_object_wrapper!(Context, ContextRef, ffi::GstContext, [Debug,], || {
ffi::gst_context_get_type()
});
unsafe impl MiniObject for ContextRef {
type GstType = ffi::GstContext;
}
impl GstRc<ContextRef> {
impl Context {
pub fn new(context_type: &str, persistent: bool) -> Self {
assert_initialized_main_thread!();
unsafe {
@ -71,12 +68,6 @@ impl ContextRef {
}
}
impl StaticType for ContextRef {
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_context_get_type()) }
}
}
impl fmt::Debug for ContextRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Context")
@ -85,17 +76,3 @@ impl fmt::Debug for ContextRef {
.finish()
}
}
impl ToOwned for ContextRef {
type Owned = GstRc<ContextRef>;
fn to_owned(&self) -> GstRc<ContextRef> {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
}
}
}
unsafe impl Sync for ContextRef {}
unsafe impl Send for ContextRef {}

View file

@ -19,8 +19,9 @@ use std::ops::Deref;
use std::ptr;
use glib;
use glib::translate::{from_glib, from_glib_full, FromGlib, ToGlib, ToGlibPtr};
use glib::translate::{from_glib, from_glib_full, from_glib_none, FromGlib, ToGlib, ToGlibPtr};
use glib::value::ToSendValue;
use glib_ffi;
#[cfg(any(feature = "v1_10", feature = "dox"))]
use glib::translate::FromGlibPtrContainer;
@ -110,18 +111,6 @@ impl FromGlib<u32> for GroupId {
}
}
#[repr(C)]
pub struct EventRef(ffi::GstEvent);
pub type Event = GstRc<EventRef>;
unsafe impl Sync for EventRef {}
unsafe impl Send for EventRef {}
unsafe impl MiniObject for EventRef {
type GstType = ffi::GstEvent;
}
impl EventType {
pub fn is_upstream(self) -> bool {
(self.to_glib() as u32) & ffi::GST_EVENT_TYPE_UPSTREAM != 0
@ -176,6 +165,10 @@ impl PartialOrd for EventType {
}
}
gst_define_mini_object_wrapper!(Event, EventRef, ffi::GstEvent, [Debug,], || {
ffi::gst_event_get_type()
});
impl EventRef {
pub fn get_seqnum(&self) -> Seqnum {
unsafe { from_glib(ffi::gst_event_get_seqnum(self.as_mut_ptr())) }
@ -266,7 +259,7 @@ impl EventRef {
}
}
impl GstRc<EventRef> {
impl Event {
pub fn new_flush_start<'a>() -> FlushStartBuilder<'a> {
assert_initialized_main_thread!();
FlushStartBuilder::new()
@ -452,12 +445,6 @@ impl GstRc<EventRef> {
}
}
impl glib::types::StaticType for EventRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_event_get_type()) }
}
}
impl fmt::Debug for EventRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Event")
@ -471,14 +458,6 @@ impl fmt::Debug for EventRef {
}
}
impl ToOwned for EventRef {
type Owned = GstRc<EventRef>;
fn to_owned(&self) -> GstRc<EventRef> {
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
}
}
pub enum EventView<'a> {
FlushStart(FlushStart<'a>),
FlushStop(FlushStop<'a>),

View file

@ -71,6 +71,7 @@ pub use log::*;
mod error;
pub use error::*;
#[macro_use]
pub mod miniobject;
pub use miniobject::{GstRc, MiniObject};
pub mod message;

View file

@ -27,18 +27,11 @@ use glib::translate::{from_glib, from_glib_full, from_glib_none, mut_override, T
use glib::value::ToSendValue;
use glib::Cast;
use glib::IsA;
use glib_ffi;
#[repr(C)]
pub struct MessageRef(ffi::GstMessage);
pub type Message = GstRc<MessageRef>;
unsafe impl Sync for MessageRef {}
unsafe impl Send for MessageRef {}
unsafe impl MiniObject for MessageRef {
type GstType = ffi::GstMessage;
}
gst_define_mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, [Debug,], || {
ffi::gst_message_get_type()
});
impl MessageRef {
pub fn get_src(&self) -> Option<Object> {
@ -113,7 +106,7 @@ impl MessageRef {
}
}
impl GstRc<MessageRef> {
impl Message {
pub fn new_eos<'a>() -> EosBuilder<'a> {
assert_initialized_main_thread!();
EosBuilder::new()
@ -348,12 +341,6 @@ impl GstRc<MessageRef> {
}
}
impl glib::types::StaticType for MessageRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_message_get_type()) }
}
}
impl fmt::Debug for MessageRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Message")
@ -368,14 +355,6 @@ impl fmt::Debug for MessageRef {
}
}
impl ToOwned for MessageRef {
type Owned = GstRc<MessageRef>;
fn to_owned(&self) -> GstRc<MessageRef> {
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
}
}
pub enum MessageView<'a> {
Eos(Eos<'a>),
Error(Error<'a>),

View file

@ -501,15 +501,15 @@ macro_rules! gst_define_mini_object_wrapper(
impl $name {
pub unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self {
$name(from_glib_none(ptr))
$name(glib::translate::from_glib_none(ptr))
}
pub unsafe fn from_glib_full(ptr: *const $ffi_name) -> Self {
$name(from_glib_full(ptr))
$name(glib::translate::from_glib_full(ptr))
}
pub unsafe fn from_glib_borrow(ptr: *const $ffi_name) -> Self {
$name(from_glib_borrow(ptr))
$name(glib::translate::from_glib_borrow(ptr))
}
pub unsafe fn into_ptr(self) -> *mut $ffi_name {
@ -517,6 +517,18 @@ macro_rules! gst_define_mini_object_wrapper(
}
}
impl From<$crate::GstRc<$ref_name>> for $name {
fn from(rc: $crate::GstRc<$ref_name>) -> $name {
$name(rc)
}
}
impl Into<$crate::GstRc<$ref_name>> for $name {
fn into(self) -> $crate::GstRc<$ref_name> {
self.0
}
}
impl ::std::ops::Deref for $name {
type Target = $crate::GstRc<$ref_name>;
@ -595,7 +607,7 @@ macro_rules! gst_define_mini_object_wrapper(
skip_assert_initialized!();
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
let mut v_ptr: Vec<_> = v.iter().map(|s| s.0).collect();
v_ptr.push(ptr::null_mut() as *mut $ffi_name);
v_ptr.push(::std::ptr::null_mut() as *mut $ffi_name);
(v_ptr.as_ptr() as *mut *mut $ffi_name, (v, Some(v_ptr)))
}
@ -605,11 +617,11 @@ macro_rules! gst_define_mini_object_wrapper(
let v: Vec<_> = t.iter().map(|s| s.to_glib_none()).collect();
let v_ptr = unsafe {
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut $ffi_name>() * t.len() + 1)
let v_ptr = glib_ffi::g_malloc0(::std::mem::size_of::<*mut $ffi_name>() * t.len() + 1)
as *mut *mut $ffi_name;
for (i, s) in v.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.0);
::std::ptr::write(v_ptr.offset(i as isize), s.0);
}
v_ptr
@ -621,11 +633,11 @@ macro_rules! gst_define_mini_object_wrapper(
fn to_glib_full_from_slice(t: &[$name]) -> *mut *mut $ffi_name {
skip_assert_initialized!();
unsafe {
let v_ptr = glib_ffi::g_malloc0(mem::size_of::<*mut $ffi_name>() * t.len() + 1)
let v_ptr = glib_ffi::g_malloc0(::std::mem::size_of::<*mut $ffi_name>() * t.len() + 1)
as *mut *mut $ffi_name;
for (i, s) in t.iter().enumerate() {
ptr::write(v_ptr.offset(i as isize), s.to_glib_full());
::std::ptr::write(v_ptr.offset(i as isize), s.to_glib_full());
}
v_ptr
@ -708,7 +720,7 @@ macro_rules! gst_define_mini_object_wrapper(
let mut res = Vec::with_capacity(num);
for i in 0..num {
res.push(from_glib_none(ptr::read(ptr.offset(i as isize))));
res.push(from_glib_none(::std::ptr::read(ptr.offset(i as isize))));
}
res
}
@ -726,7 +738,7 @@ macro_rules! gst_define_mini_object_wrapper(
let mut res = Vec::with_capacity(num);
for i in 0..num {
res.push(from_glib_full(ptr::read(ptr.offset(i as isize))));
res.push(from_glib_full(::std::ptr::read(ptr.offset(i as isize))));
}
glib_ffi::g_free(ptr as *mut _);
res
@ -788,19 +800,19 @@ macro_rules! gst_define_mini_object_wrapper(
for $name
{
unsafe fn from_value_optional(v: &'a glib::Value) -> Option<Self> {
<gst::GstRc<$ref_name> as glib::value::FromValueOptional>::from_value_optional(v).map($name)
<$crate::GstRc<$ref_name> as glib::value::FromValueOptional>::from_value_optional(v).map($name)
}
}
impl glib::value::SetValue for $name {
unsafe fn set_value(v: &mut glib::Value, s: &Self) {
<gst::GstRc<$ref_name> as glib::value::SetValue>::set_value(v, &s.0)
<$crate::GstRc<$ref_name> as glib::value::SetValue>::set_value(v, &s.0)
}
}
impl glib::value::SetValueOptional for $name {
unsafe fn set_value_optional(v: &mut glib::Value, s: Option<&Self>) {
<gst::GstRc<$ref_name> as glib::value::SetValueOptional>::set_value_optional(v, s.map(|s| &s.0))
<$crate::GstRc<$ref_name> as glib::value::SetValueOptional>::set_value_optional(v, s.map(|s| &s.0))
}
}

View file

@ -19,20 +19,13 @@ use std::ptr;
use glib;
use glib::translate::*;
use glib_ffi;
#[repr(C)]
pub struct QueryRef(ffi::GstQuery);
gst_define_mini_object_wrapper!(Query, QueryRef, ffi::GstQuery, [Debug,], || {
ffi::gst_query_get_type()
});
unsafe impl Send for QueryRef {}
unsafe impl Sync for QueryRef {}
pub type Query = GstRc<QueryRef>;
unsafe impl MiniObject for QueryRef {
type GstType = ffi::GstQuery;
}
impl GstRc<QueryRef> {
impl Query {
pub fn new_position(fmt: ::Format) -> Position<Self> {
assert_initialized_main_thread!();
unsafe { Position::<Self>(from_glib_full(ffi::gst_query_new_position(fmt.to_glib()))) }
@ -199,12 +192,6 @@ impl QueryRef {
}
}
impl glib::types::StaticType for QueryRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_query_get_type()) }
}
}
impl fmt::Debug for QueryRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Query")

View file

@ -13,7 +13,7 @@ use ffi;
use glib;
use glib::translate::{from_glib, from_glib_full, from_glib_none, mut_override, ToGlibPtr};
use glib::StaticType;
use glib_ffi;
use miniobject::*;
use Buffer;
@ -25,14 +25,11 @@ use Segment;
use Structure;
use StructureRef;
pub type Sample = GstRc<SampleRef>;
pub struct SampleRef(ffi::GstSample);
gst_define_mini_object_wrapper!(Sample, SampleRef, ffi::GstSample, [Debug,], || {
ffi::gst_sample_get_type()
});
unsafe impl MiniObject for SampleRef {
type GstType = ffi::GstSample;
}
impl GstRc<SampleRef> {
impl Sample {
pub fn new<F: FormattedValue>(
buffer: Option<&Buffer>,
caps: Option<&Caps>,
@ -96,23 +93,6 @@ impl SampleRef {
}
}
impl StaticType for SampleRef {
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_sample_get_type()) }
}
}
impl ToOwned for SampleRef {
type Owned = GstRc<SampleRef>;
fn to_owned(&self) -> GstRc<SampleRef> {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
}
}
}
impl fmt::Debug for SampleRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Sample")
@ -124,9 +104,6 @@ impl fmt::Debug for SampleRef {
}
}
unsafe impl Sync for SampleRef {}
unsafe impl Send for SampleRef {}
#[cfg(test)]
mod tests {

View file

@ -13,9 +13,9 @@ use std::mem;
use ffi;
use glib;
use glib::translate::{from_glib, from_glib_full, ToGlib, ToGlibPtr, ToGlibPtrMut};
use glib::translate::{from_glib, from_glib_full, from_glib_none, ToGlib, ToGlibPtr, ToGlibPtrMut};
use glib::value::{FromValueOptional, SendValue, SetValue, ToSendValue, TypedValue};
use glib::StaticType;
use glib_ffi;
use miniobject::*;
@ -337,21 +337,22 @@ impl_tag!(
);
impl_tag!(PrivateData, Sample, TAG_PRIVATE_DATA, GST_TAG_PRIVATE_DATA);
pub type TagList = GstRc<TagListRef>;
pub struct TagListRef(ffi::GstTagList);
gst_define_mini_object_wrapper!(
TagList,
TagListRef,
ffi::GstTagList,
[Debug, PartialEq, Eq,],
|| ffi::gst_tag_list_get_type()
);
unsafe impl MiniObject for TagListRef {
type GstType = ffi::GstTagList;
}
impl GstRc<TagListRef> {
impl TagList {
pub fn new() -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_tag_list_new_empty()) }
}
}
impl Default for GstRc<TagListRef> {
impl Default for TagList {
fn default() -> Self {
Self::new()
}
@ -508,23 +509,6 @@ impl PartialEq for TagListRef {
impl Eq for TagListRef {}
impl ToOwned for TagListRef {
type Owned = GstRc<TagListRef>;
fn to_owned(&self) -> GstRc<TagListRef> {
unsafe { from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _) }
}
}
impl StaticType for TagListRef {
fn static_type() -> glib::Type {
unsafe { from_glib(ffi::gst_tag_list_get_type()) }
}
}
unsafe impl Sync for TagListRef {}
unsafe impl Send for TagListRef {}
pub struct TagIterator<'a, T: Tag<'a>> {
taglist: &'a TagListRef,
idx: u32,

View file

@ -16,6 +16,7 @@ use glib;
use glib::translate::{
from_glib, from_glib_full, from_glib_none, FromGlibPtrContainer, ToGlib, ToGlibPtr,
};
use glib_ffi;
use miniobject::*;
use TagList;
@ -24,14 +25,15 @@ use TocEntryType;
use TocLoopType;
use TocScope;
pub type Toc = GstRc<TocRef>;
pub struct TocRef(ffi::GstToc);
gst_define_mini_object_wrapper!(
Toc,
TocRef,
ffi::GstToc,
[Debug,],
|| ffi::gst_toc_get_type()
);
unsafe impl MiniObject for TocRef {
type GstType = ffi::GstToc;
}
impl GstRc<TocRef> {
impl Toc {
pub fn new(scope: TocScope) -> Self {
assert_initialized_main_thread!();
unsafe { from_glib_full(ffi::gst_toc_new(scope.to_glib())) }
@ -80,23 +82,6 @@ impl TocRef {
}
}
impl glib::types::StaticType for TocRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_toc_get_type()) }
}
}
impl ToOwned for TocRef {
type Owned = GstRc<TocRef>;
fn to_owned(&self) -> GstRc<TocRef> {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
}
}
}
impl fmt::Debug for TocRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("Toc")
@ -107,17 +92,11 @@ impl fmt::Debug for TocRef {
}
}
unsafe impl Sync for TocRef {}
unsafe impl Send for TocRef {}
gst_define_mini_object_wrapper!(TocEntry, TocEntryRef, ffi::GstTocEntry, [Debug,], || {
ffi::gst_toc_entry_get_type()
});
pub type TocEntry = GstRc<TocEntryRef>;
pub struct TocEntryRef(ffi::GstTocEntry);
unsafe impl MiniObject for TocEntryRef {
type GstType = ffi::GstTocEntry;
}
impl GstRc<TocEntryRef> {
impl TocEntry {
pub fn new(type_: TocEntryType, uid: &str) -> Self {
assert_initialized_main_thread!();
unsafe {
@ -228,23 +207,6 @@ impl TocEntryRef {
}
}
impl glib::types::StaticType for TocEntryRef {
fn static_type() -> glib::types::Type {
unsafe { from_glib(ffi::gst_toc_entry_get_type()) }
}
}
impl ToOwned for TocEntryRef {
type Owned = GstRc<TocEntryRef>;
fn to_owned(&self) -> GstRc<TocEntryRef> {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe {
from_glib_full(ffi::gst_mini_object_copy(self.as_ptr() as *const _) as *mut _)
}
}
}
impl fmt::Debug for TocEntryRef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("TocEntry")
@ -260,9 +222,6 @@ impl fmt::Debug for TocEntryRef {
}
}
unsafe impl Sync for TocEntryRef {}
unsafe impl Send for TocEntryRef {}
#[cfg(test)]
mod tests {
use super::*;