mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-29 04:51:09 +00:00
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,
|
line: u32,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> 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 {
|
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 {
|
unsafe {
|
||||||
let elt: &ffi::GstAudioDecoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstAudioDecoder);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstAudioDecoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstAudioDecoder);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&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")]
|
#[doc(alias = "gst_audio_encoder_get_allocator")]
|
||||||
fn allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
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 {
|
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 {
|
unsafe {
|
||||||
let elt: &ffi::GstAudioEncoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstAudioEncoder);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstAudioEncoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstAudioEncoder);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ pub trait AggregatorExtManual: 'static {
|
||||||
f: F,
|
f: F,
|
||||||
) -> SignalHandlerId;
|
) -> SignalHandlerId;
|
||||||
|
|
||||||
fn src_pad(&self) -> gst::Pad;
|
fn src_pad(&self) -> &gst::Pad;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
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 {
|
unsafe {
|
||||||
let ptr: &ffi::GstAggregator = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstAggregator);
|
||||||
|
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||||
from_glib_none(ptr.srcpad)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@ use std::mem;
|
||||||
|
|
||||||
pub trait BaseParseExtManual: 'static {
|
pub trait BaseParseExtManual: 'static {
|
||||||
#[doc(alias = "get_sink_pad")]
|
#[doc(alias = "get_sink_pad")]
|
||||||
fn sink_pad(&self) -> gst::Pad;
|
fn sink_pad(&self) -> &gst::Pad;
|
||||||
#[doc(alias = "get_src_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")]
|
#[doc(alias = "gst_base_parse_set_duration")]
|
||||||
fn set_duration<V: Into<gst::GenericFormattedValue>>(&self, duration: V, interval: u32);
|
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 {
|
impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||||
fn sink_pad(&self) -> gst::Pad {
|
fn sink_pad(&self) -> &gst::Pad {
|
||||||
unsafe {
|
unsafe {
|
||||||
let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstBaseParse);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstBaseParse);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ pub trait BaseSinkExtManual: 'static {
|
||||||
&self,
|
&self,
|
||||||
) -> Result<(bool, bool, Option<gst::ClockTime>, Option<gst::ClockTime>), glib::BoolError>;
|
) -> 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 {
|
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 {
|
unsafe {
|
||||||
let ptr: &ffi::GstBaseSink = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstBaseSink);
|
||||||
|
&*(&elt.sinkpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||||
from_glib_none(ptr.sinkpad)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub trait BaseSrcExtManual: 'static {
|
||||||
#[doc(alias = "gst_base_src_new_segment")]
|
#[doc(alias = "gst_base_src_new_segment")]
|
||||||
fn new_segment(&self, segment: &gst::Segment) -> Result<(), glib::BoolError>;
|
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 {
|
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 {
|
unsafe {
|
||||||
let ptr: &ffi::GstBaseSrc = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstBaseSrc);
|
||||||
|
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||||
from_glib_none(ptr.srcpad)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ pub trait BaseTransformExtManual: 'static {
|
||||||
#[doc(alias = "get_segment")]
|
#[doc(alias = "get_segment")]
|
||||||
fn segment(&self) -> gst::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 {
|
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 {
|
unsafe {
|
||||||
let elt: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstBaseTransform);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstBaseTransform);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&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")]
|
#[doc(alias = "gst_rtp_base_depayload_push_list")]
|
||||||
fn push_list(&self, list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError>;
|
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 {
|
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 {
|
unsafe {
|
||||||
let elt: &ffi::GstRTPBaseDepayload = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstRTPBaseDepayload);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstRTPBaseDepayload = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstRTPBaseDepayload);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&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")]
|
#[doc(alias = "gst_rtp_base_payload_push_list")]
|
||||||
fn push_list(&self, list: gst::BufferList) -> Result<gst::FlowSuccess, gst::FlowError>;
|
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 {
|
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 {
|
unsafe {
|
||||||
let elt: &ffi::GstRTPBasePayload = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstRTPBasePayload);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstRTPBasePayload = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstRTPBasePayload);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,9 +110,9 @@ pub trait VideoDecoderExtManual: 'static {
|
||||||
line: u32,
|
line: u32,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
) -> 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 {
|
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 {
|
unsafe {
|
||||||
let elt: &ffi::GstVideoDecoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstVideoDecoder);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstVideoDecoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstVideoDecoder);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&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>>,
|
output_state: VideoCodecState<'a, InNegotiation<'a>>,
|
||||||
) -> Result<(), gst::FlowError>;
|
) -> 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 {
|
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 {
|
unsafe {
|
||||||
let elt: &ffi::GstVideoEncoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstVideoEncoder);
|
||||||
from_glib_none(elt.sinkpad)
|
&*(&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 {
|
unsafe {
|
||||||
let elt: &ffi::GstVideoEncoder = &*(self.as_ptr() as *const _);
|
let elt = &*(self.as_ptr() as *const ffi::GstVideoEncoder);
|
||||||
from_glib_none(elt.srcpad)
|
&*(&elt.srcpad as *const *mut gst::ffi::GstPad as *const gst::Pad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue