forked from mirrors/gstreamer-rs
Return base class pads by reference instead of strong reference
Avoids unnecessary reference counting and the caller can get a strong reference easily by calling clone().
This commit is contained in:
parent
80b0b378fc
commit
a16c3888e5
11 changed files with 76 additions and 79 deletions
|
@ -58,9 +58,9 @@ pub trait AudioDecoderExtManual: 'static {
|
|||
line: u32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
|
||||
|
@ -178,17 +178,17 @@ impl<O: IsA<AudioDecoder>> AudioDecoderExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstAudioDecoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstAudioDecoder);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstAudioDecoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstAudioDecoder);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ pub trait AudioEncoderExtManual: 'static {
|
|||
#[doc(alias = "gst_audio_encoder_get_allocator")]
|
||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
|
||||
|
@ -84,17 +84,17 @@ impl<O: IsA<AudioEncoder>> AudioEncoderExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstAudioEncoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstAudioEncoder);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstAudioEncoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstAudioEncoder);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ pub trait AggregatorExtManual: 'static {
|
|||
f: F,
|
||||
) -> SignalHandlerId;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||
|
@ -270,11 +270,10 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let ptr: &ffi::GstAggregator = &*(self.as_ptr() as *const _);
|
||||
|
||||
from_glib_none(ptr.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstAggregator);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ use std::mem;
|
|||
|
||||
pub trait BaseParseExtManual: 'static {
|
||||
#[doc(alias = "get_sink_pad")]
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
#[doc(alias = "get_src_pad")]
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
|
||||
#[doc(alias = "gst_base_parse_set_duration")]
|
||||
fn set_duration<V: Into<gst::GenericFormattedValue>>(&self, duration: V, interval: u32);
|
||||
|
@ -38,17 +38,17 @@ pub trait BaseParseExtManual: 'static {
|
|||
}
|
||||
|
||||
impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstBaseParse);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstBaseParse);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ pub trait BaseSinkExtManual: 'static {
|
|||
&self,
|
||||
) -> Result<(bool, bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError>;
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||
|
@ -58,11 +58,10 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let ptr: &ffi::GstBaseSink = &*(self.as_ptr() as *const _);
|
||||
|
||||
from_glib_none(ptr.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstBaseSink);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ pub trait BaseSrcExtManual: 'static {
|
|||
#[doc(alias = "gst_base_src_new_segment")]
|
||||
fn new_segment(&self, segment: &gst::Segment) -> Result<(), glib::BoolError>;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||
|
@ -95,11 +95,10 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let ptr: &ffi::GstBaseSrc = &*(self.as_ptr() as *const _);
|
||||
|
||||
from_glib_none(ptr.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstBaseSrc);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ pub trait BaseTransformExtManual: 'static {
|
|||
#[doc(alias = "get_segment")]
|
||||
fn segment(&self) -> gst::Segment;
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
|
||||
|
@ -41,17 +41,17 @@ impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstBaseTransform);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstBaseTransform);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ pub trait RTPBaseDepayloadExtManual: 'static {
|
|||
#[doc(alias = "gst_rtp_base_depayload_push_list")]
|
||||
fn push_list(&self, list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExtManual for O {
|
||||
|
@ -33,17 +33,17 @@ impl<O: IsA<RTPBaseDepayload>> RTPBaseDepayloadExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstRTPBaseDepayload = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstRTPBaseDepayload);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstRTPBaseDepayload = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstRTPBaseDepayload);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ pub trait RTPBasePayloadExtManual: 'static {
|
|||
#[doc(alias = "gst_rtp_base_payload_push_list")]
|
||||
fn push_list(&self, list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<RTPBasePayload>> RTPBasePayloadExtManual for O {
|
||||
|
@ -56,17 +56,17 @@ impl<O: IsA<RTPBasePayload>> RTPBasePayloadExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstRTPBasePayload = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstRTPBasePayload);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstRTPBasePayload = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstRTPBasePayload);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,9 +110,9 @@ pub trait VideoDecoderExtManual: 'static {
|
|||
line: u32,
|
||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
||||
|
@ -410,17 +410,17 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstVideoDecoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstVideoDecoder);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstVideoDecoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstVideoDecoder);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ pub trait VideoEncoderExtManual: 'static {
|
|||
output_state: VideoCodecState<'a, InNegotiation<'a>>,
|
||||
) -> Result<(), gst::FlowError>;
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad;
|
||||
fn sink_pad(&self) -> &gst::Pad;
|
||||
|
||||
fn src_pad(&self) -> gst::Pad;
|
||||
fn src_pad(&self) -> &gst::Pad;
|
||||
}
|
||||
|
||||
impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
||||
|
@ -253,17 +253,17 @@ impl<O: IsA<VideoEncoder>> VideoEncoderExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sink_pad(&self) -> gst::Pad {
|
||||
fn sink_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstVideoEncoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.sinkpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstVideoEncoder);
|
||||
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
|
||||
fn src_pad(&self) -> gst::Pad {
|
||||
fn src_pad(&self) -> &gst::Pad {
|
||||
unsafe {
|
||||
let elt: &ffi::GstVideoEncoder = &*(self.as_ptr() as *const _);
|
||||
from_glib_none(elt.srcpad)
|
||||
let elt = &*(self.as_ptr() as *const ffi::GstVideoEncoder);
|
||||
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue