mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-22 08:07:07 +00:00
message/query/event: Implement views in a more consistent way
Co-authored-by: Jan Alexander Steffens (heftig) <jan.steffens@ltnglobal.com>
This commit is contained in:
parent
65c833bc80
commit
5e2249d368
14 changed files with 762 additions and 836 deletions
|
@ -87,7 +87,7 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl {
|
|||
fn propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_propose_allocation(element, query)
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ pub trait AudioDecoderImpl: AudioDecoderImplExt + ElementImpl {
|
|||
fn decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_decide_allocation(element, query)
|
||||
}
|
||||
|
@ -151,13 +151,13 @@ pub trait AudioDecoderImplExt: ObjectSubclass {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
}
|
||||
|
||||
|
@ -468,7 +468,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -492,7 +492,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -821,7 +821,7 @@ unsafe extern "C" fn audio_decoder_propose_allocation<T: AudioDecoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
@ -845,7 +845,7 @@ unsafe extern "C" fn audio_decoder_decide_allocation<T: AudioDecoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl {
|
|||
fn propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_propose_allocation(element, query)
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ pub trait AudioEncoderImpl: AudioEncoderImplExt + ElementImpl {
|
|||
fn decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_decide_allocation(element, query)
|
||||
}
|
||||
|
@ -137,13 +137,13 @@ pub trait AudioEncoderImplExt: ObjectSubclass {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
}
|
||||
|
||||
|
@ -418,7 +418,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -442,7 +442,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -741,7 +741,7 @@ unsafe extern "C" fn audio_encoder_propose_allocation<T: AudioEncoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
@ -765,7 +765,7 @@ unsafe extern "C" fn audio_encoder_decide_allocation<T: AudioEncoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -153,8 +153,8 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
|||
&self,
|
||||
element: &Self::Type,
|
||||
pad: &AggregatorPad,
|
||||
decide_query: Option<gst::query::Allocation<&gst::QueryRef>>,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
decide_query: Option<&gst::query::Allocation>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_propose_allocation(element, pad, decide_query, query)
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
|||
fn decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_decide_allocation(element, query)
|
||||
}
|
||||
|
@ -289,14 +289,14 @@ pub trait AggregatorImplExt: ObjectSubclass {
|
|||
&self,
|
||||
element: &Self::Type,
|
||||
pad: &AggregatorPad,
|
||||
decide_query: Option<gst::query::Allocation<&gst::QueryRef>>,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
decide_query: Option<&gst::query::Allocation>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
|
@ -692,8 +692,8 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
&self,
|
||||
element: &Self::Type,
|
||||
pad: &AggregatorPad,
|
||||
decide_query: Option<gst::query::Allocation<&gst::QueryRef>>,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
decide_query: Option<&gst::query::Allocation>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -722,7 +722,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -1178,7 +1178,7 @@ unsafe extern "C" fn aggregator_propose_allocation<T: AggregatorImpl>(
|
|||
}
|
||||
};
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
@ -1207,7 +1207,7 @@ unsafe extern "C" fn aggregator_decide_allocation<T: AggregatorImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
|||
fn propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_propose_allocation(element, query)
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ pub trait BaseSinkImplExt: ObjectSubclass {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -671,7 +671,7 @@ unsafe extern "C" fn base_sink_propose_allocation<T: BaseSinkImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ pub trait BaseSrcImpl: BaseSrcImplExt + ElementImpl {
|
|||
fn decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_decide_allocation(element, query)
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ pub trait BaseSrcImplExt: ObjectSubclass {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
}
|
||||
|
||||
|
@ -587,7 +587,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -1020,7 +1020,7 @@ unsafe extern "C" fn base_src_decide_allocation<T: BaseSrcImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
|||
fn propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
decide_query: Option<gst::query::Allocation<&gst::QueryRef>>,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
decide_query: Option<&gst::query::Allocation>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_propose_allocation(element, decide_query, query)
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
|||
fn decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_decide_allocation(element, query)
|
||||
}
|
||||
|
@ -277,14 +277,14 @@ pub trait BaseTransformImplExt: ObjectSubclass {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
decide_query: Option<gst::query::Allocation<&gst::QueryRef>>,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
decide_query: Option<&gst::query::Allocation>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_copy_metadata(
|
||||
|
@ -717,8 +717,8 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
decide_query: Option<gst::query::Allocation<&gst::QueryRef>>,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
decide_query: Option<&gst::query::Allocation>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -746,7 +746,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -1329,7 +1329,7 @@ unsafe extern "C" fn base_transform_propose_allocation<T: BaseTransformImpl>(
|
|||
}
|
||||
};
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
@ -1353,7 +1353,7 @@ unsafe extern "C" fn base_transform_decide_allocation<T: BaseTransformImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::ptr;
|
|||
#[doc(alias = "gst_gl_handle_context_query")]
|
||||
pub fn gl_handle_context_query(
|
||||
element: &impl IsA<gst::Element>,
|
||||
query: gst::query::Context<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Context,
|
||||
display: Option<&impl IsA<GLDisplay>>,
|
||||
context: Option<&impl IsA<GLContext>>,
|
||||
other_context: Option<&impl IsA<GLContext>>,
|
||||
|
|
|
@ -91,7 +91,7 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl {
|
|||
fn propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_propose_allocation(element, query)
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ pub trait VideoDecoderImpl: VideoDecoderImplExt + ElementImpl {
|
|||
fn decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_decide_allocation(element, query)
|
||||
}
|
||||
|
@ -166,13 +166,13 @@ pub trait VideoDecoderImplExt: ObjectSubclass {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
|
@ -494,7 +494,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -518,7 +518,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -869,7 +869,7 @@ unsafe extern "C" fn video_decoder_propose_allocation<T: VideoDecoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
@ -893,7 +893,7 @@ unsafe extern "C" fn video_decoder_decide_allocation<T: VideoDecoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl {
|
|||
fn propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_propose_allocation(element, query)
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ pub trait VideoEncoderImpl: VideoEncoderImplExt + ElementImpl {
|
|||
fn decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
self.parent_decide_allocation(element, query)
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ pub trait VideoEncoderImplExt: ObjectSubclass {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
|
||||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError>;
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
|
|||
fn parent_propose_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -434,7 +434,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
|
|||
fn parent_decide_allocation(
|
||||
&self,
|
||||
element: &Self::Type,
|
||||
query: gst::query::Allocation<&mut gst::QueryRef>,
|
||||
query: &mut gst::query::Allocation,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
unsafe {
|
||||
let data = Self::type_data();
|
||||
|
@ -721,7 +721,7 @@ unsafe extern "C" fn video_encoder_propose_allocation<T: VideoEncoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
@ -745,7 +745,7 @@ unsafe extern "C" fn video_encoder_decide_allocation<T: VideoEncoderImpl>(
|
|||
let imp = instance.imp();
|
||||
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||
let query = match gst::QueryRef::from_mut_ptr(query).view_mut() {
|
||||
gst::QueryView::Allocation(allocation) => allocation,
|
||||
gst::QueryViewMut::Allocation(allocation) => allocation,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ use crate::structure::*;
|
|||
use crate::ClockTime;
|
||||
use crate::GenericFormattedValue;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::cmp;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
|
@ -12,9 +13,7 @@ use std::num::NonZeroU32;
|
|||
use std::ops::Deref;
|
||||
use std::ptr;
|
||||
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, try_from_glib, IntoGlib, ToGlibPtr,
|
||||
};
|
||||
use glib::translate::*;
|
||||
use glib::value::ToSendValue;
|
||||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
|
@ -221,55 +220,49 @@ impl EventRef {
|
|||
self.structure().map_or(false, |s| s.has_name(name))
|
||||
}
|
||||
|
||||
pub fn view(&self) -> EventView<&EventRef> {
|
||||
let type_ = unsafe { (*self.as_ptr()).type_ };
|
||||
pub fn view(&self) -> EventView {
|
||||
unsafe {
|
||||
let type_ = (*self.as_ptr()).type_;
|
||||
|
||||
match type_ {
|
||||
ffi::GST_EVENT_FLUSH_START => EventView::FlushStart(FlushStart(self)),
|
||||
ffi::GST_EVENT_FLUSH_STOP => EventView::FlushStop(FlushStop(self)),
|
||||
ffi::GST_EVENT_STREAM_START => EventView::StreamStart(StreamStart(self)),
|
||||
ffi::GST_EVENT_CAPS => EventView::Caps(Caps(self)),
|
||||
ffi::GST_EVENT_SEGMENT => EventView::Segment(Segment(self)),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_EVENT_STREAM_COLLECTION => EventView::StreamCollection(StreamCollection(self)),
|
||||
ffi::GST_EVENT_TAG => EventView::Tag(Tag(self)),
|
||||
ffi::GST_EVENT_BUFFERSIZE => EventView::Buffersize(Buffersize(self)),
|
||||
ffi::GST_EVENT_SINK_MESSAGE => EventView::SinkMessage(SinkMessage(self)),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_EVENT_STREAM_GROUP_DONE => EventView::StreamGroupDone(StreamGroupDone(self)),
|
||||
ffi::GST_EVENT_EOS => EventView::Eos(Eos(self)),
|
||||
ffi::GST_EVENT_TOC => EventView::Toc(Toc(self)),
|
||||
ffi::GST_EVENT_PROTECTION => EventView::Protection(Protection(self)),
|
||||
ffi::GST_EVENT_SEGMENT_DONE => EventView::SegmentDone(SegmentDone(self)),
|
||||
ffi::GST_EVENT_GAP => EventView::Gap(Gap(self)),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
ffi::GST_EVENT_INSTANT_RATE_CHANGE => {
|
||||
EventView::InstantRateChange(InstantRateChange(self))
|
||||
match type_ {
|
||||
ffi::GST_EVENT_FLUSH_START => FlushStart::view(self),
|
||||
ffi::GST_EVENT_FLUSH_STOP => FlushStop::view(self),
|
||||
ffi::GST_EVENT_STREAM_START => StreamStart::view(self),
|
||||
ffi::GST_EVENT_CAPS => Caps::view(self),
|
||||
ffi::GST_EVENT_SEGMENT => Segment::view(self),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_EVENT_STREAM_COLLECTION => StreamCollection::view(self),
|
||||
ffi::GST_EVENT_TAG => Tag::view(self),
|
||||
ffi::GST_EVENT_BUFFERSIZE => Buffersize::view(self),
|
||||
ffi::GST_EVENT_SINK_MESSAGE => SinkMessage::view(self),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_EVENT_STREAM_GROUP_DONE => StreamGroupDone::view(self),
|
||||
ffi::GST_EVENT_EOS => Eos::view(self),
|
||||
ffi::GST_EVENT_TOC => Toc::view(self),
|
||||
ffi::GST_EVENT_PROTECTION => Protection::view(self),
|
||||
ffi::GST_EVENT_SEGMENT_DONE => SegmentDone::view(self),
|
||||
ffi::GST_EVENT_GAP => Gap::view(self),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
ffi::GST_EVENT_INSTANT_RATE_CHANGE => InstantRateChange::view(self),
|
||||
ffi::GST_EVENT_QOS => Qos::view(self),
|
||||
ffi::GST_EVENT_SEEK => Seek::view(self),
|
||||
ffi::GST_EVENT_NAVIGATION => Navigation::view(self),
|
||||
ffi::GST_EVENT_LATENCY => Latency::view(self),
|
||||
ffi::GST_EVENT_STEP => Step::view(self),
|
||||
ffi::GST_EVENT_RECONFIGURE => Reconfigure::view(self),
|
||||
ffi::GST_EVENT_TOC_SELECT => TocSelect::view(self),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_EVENT_SELECT_STREAMS => SelectStreams::view(self),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
ffi::GST_EVENT_INSTANT_RATE_SYNC_TIME => InstantRateSyncTime::view(self),
|
||||
ffi::GST_EVENT_CUSTOM_UPSTREAM => CustomUpstream::view(self),
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM => CustomDownstream::view(self),
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB => CustomDownstreamOob::view(self),
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY => CustomDownstreamSticky::view(self),
|
||||
ffi::GST_EVENT_CUSTOM_BOTH => CustomBoth::view(self),
|
||||
ffi::GST_EVENT_CUSTOM_BOTH_OOB => CustomBothOob::view(self),
|
||||
_ => Other::view(self),
|
||||
}
|
||||
ffi::GST_EVENT_QOS => EventView::Qos(Qos(self)),
|
||||
ffi::GST_EVENT_SEEK => EventView::Seek(Seek(self)),
|
||||
ffi::GST_EVENT_NAVIGATION => EventView::Navigation(Navigation(self)),
|
||||
ffi::GST_EVENT_LATENCY => EventView::Latency(Latency(self)),
|
||||
ffi::GST_EVENT_STEP => EventView::Step(Step(self)),
|
||||
ffi::GST_EVENT_RECONFIGURE => EventView::Reconfigure(Reconfigure(self)),
|
||||
ffi::GST_EVENT_TOC_SELECT => EventView::TocSelect(TocSelect(self)),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_EVENT_SELECT_STREAMS => EventView::SelectStreams(SelectStreams(self)),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
ffi::GST_EVENT_INSTANT_RATE_SYNC_TIME => {
|
||||
EventView::InstantRateSyncTime(InstantRateSyncTime(self))
|
||||
}
|
||||
ffi::GST_EVENT_CUSTOM_UPSTREAM => EventView::CustomUpstream(CustomUpstream(self)),
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM => EventView::CustomDownstream(CustomDownstream(self)),
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_OOB => {
|
||||
EventView::CustomDownstreamOob(CustomDownstreamOob(self))
|
||||
}
|
||||
ffi::GST_EVENT_CUSTOM_DOWNSTREAM_STICKY => {
|
||||
EventView::CustomDownstreamSticky(CustomDownstreamSticky(self))
|
||||
}
|
||||
ffi::GST_EVENT_CUSTOM_BOTH => EventView::CustomBoth(CustomBoth(self)),
|
||||
ffi::GST_EVENT_CUSTOM_BOTH_OOB => EventView::CustomBothOob(CustomBothOob(self)),
|
||||
_ => EventView::Other(Other(self)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -291,116 +284,122 @@ impl fmt::Debug for EventRef {
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe trait AsPtr {
|
||||
unsafe fn as_ptr(&self) -> *mut ffi::GstEvent;
|
||||
}
|
||||
|
||||
unsafe impl AsPtr for Event {
|
||||
unsafe fn as_ptr(&self) -> *mut ffi::GstEvent {
|
||||
EventRef::as_ptr(self) as *mut ffi::GstEvent
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<'a> AsPtr for &'a EventRef {
|
||||
unsafe fn as_ptr(&self) -> *mut ffi::GstEvent {
|
||||
EventRef::as_ptr(self) as *mut ffi::GstEvent
|
||||
}
|
||||
}
|
||||
|
||||
pub trait StickyEventType {
|
||||
pub trait StickyEventType: ToOwned {
|
||||
const TYPE: EventType;
|
||||
|
||||
unsafe fn from_event(event: Event) -> Self;
|
||||
unsafe fn from_event(event: Event) -> Self::Owned;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum EventView<T> {
|
||||
FlushStart(FlushStart<T>),
|
||||
FlushStop(FlushStop<T>),
|
||||
StreamStart(StreamStart<T>),
|
||||
Caps(Caps<T>),
|
||||
Segment(Segment<T>),
|
||||
pub enum EventView<'a> {
|
||||
FlushStart(&'a FlushStart),
|
||||
FlushStop(&'a FlushStop),
|
||||
StreamStart(&'a StreamStart),
|
||||
Caps(&'a Caps),
|
||||
Segment(&'a Segment),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
StreamCollection(StreamCollection<T>),
|
||||
Tag(Tag<T>),
|
||||
Buffersize(Buffersize<T>),
|
||||
SinkMessage(SinkMessage<T>),
|
||||
StreamCollection(&'a StreamCollection),
|
||||
Tag(&'a Tag),
|
||||
Buffersize(&'a Buffersize),
|
||||
SinkMessage(&'a SinkMessage),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
StreamGroupDone(StreamGroupDone<T>),
|
||||
Eos(Eos<T>),
|
||||
Toc(Toc<T>),
|
||||
Protection(Protection<T>),
|
||||
SegmentDone(SegmentDone<T>),
|
||||
Gap(Gap<T>),
|
||||
StreamGroupDone(&'a StreamGroupDone),
|
||||
Eos(&'a Eos),
|
||||
Toc(&'a Toc),
|
||||
Protection(&'a Protection),
|
||||
SegmentDone(&'a SegmentDone),
|
||||
Gap(&'a Gap),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
InstantRateChange(InstantRateChange<T>),
|
||||
Qos(Qos<T>),
|
||||
Seek(Seek<T>),
|
||||
Navigation(Navigation<T>),
|
||||
Latency(Latency<T>),
|
||||
Step(Step<T>),
|
||||
Reconfigure(Reconfigure<T>),
|
||||
TocSelect(TocSelect<T>),
|
||||
InstantRateChange(&'a InstantRateChange),
|
||||
Qos(&'a Qos),
|
||||
Seek(&'a Seek),
|
||||
Navigation(&'a Navigation),
|
||||
Latency(&'a Latency),
|
||||
Step(&'a Step),
|
||||
Reconfigure(&'a Reconfigure),
|
||||
TocSelect(&'a TocSelect),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
SelectStreams(SelectStreams<T>),
|
||||
SelectStreams(&'a SelectStreams),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
InstantRateSyncTime(InstantRateSyncTime<T>),
|
||||
CustomUpstream(CustomUpstream<T>),
|
||||
CustomDownstream(CustomDownstream<T>),
|
||||
CustomDownstreamOob(CustomDownstreamOob<T>),
|
||||
CustomDownstreamSticky(CustomDownstreamSticky<T>),
|
||||
CustomBoth(CustomBoth<T>),
|
||||
CustomBothOob(CustomBothOob<T>),
|
||||
Other(Other<T>),
|
||||
InstantRateSyncTime(&'a InstantRateSyncTime),
|
||||
CustomUpstream(&'a CustomUpstream),
|
||||
CustomDownstream(&'a CustomDownstream),
|
||||
CustomDownstreamOob(&'a CustomDownstreamOob),
|
||||
CustomDownstreamSticky(&'a CustomDownstreamSticky),
|
||||
CustomBoth(&'a CustomBoth),
|
||||
CustomBothOob(&'a CustomBothOob),
|
||||
Other(&'a Other),
|
||||
}
|
||||
|
||||
macro_rules! declare_concrete_event {
|
||||
(@sticky $name:ident, $param:ident) => {
|
||||
declare_concrete_event!($name, $param);
|
||||
|
||||
impl StickyEventType for $name<Event> {
|
||||
impl StickyEventType for $name {
|
||||
const TYPE: EventType = EventType::$name;
|
||||
|
||||
unsafe fn from_event(event: Event) -> Self {
|
||||
Self(event)
|
||||
unsafe fn from_event(event: Event) -> Self::Owned {
|
||||
$name::<Event>(event)
|
||||
}
|
||||
}
|
||||
};
|
||||
($name:ident, $param:ident) => {
|
||||
#[derive(Debug)]
|
||||
pub struct $name<$param>($param);
|
||||
#[repr(transparent)]
|
||||
pub struct $name<$param = EventRef>($param);
|
||||
|
||||
impl<'a> $name<&'a EventRef> {
|
||||
impl $name {
|
||||
pub fn event(&self) -> &EventRef {
|
||||
self.0
|
||||
unsafe { &*(self as *const Self as *const EventRef) }
|
||||
}
|
||||
|
||||
unsafe fn view(event: &EventRef) -> EventView<'_> {
|
||||
let event = &*(event as *const EventRef as *const Self);
|
||||
EventView::$name(event)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for $name<&'a EventRef> {
|
||||
impl Deref for $name {
|
||||
type Target = EventRef;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.0
|
||||
self.event()
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for $name<Event> {
|
||||
type Target = EventRef;
|
||||
impl ToOwned for $name {
|
||||
type Owned = $name<Event>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.0
|
||||
fn to_owned(&self) -> Self::Owned {
|
||||
$name::<Event>(self.copy())
|
||||
}
|
||||
}
|
||||
|
||||
impl $name<Event> {
|
||||
pub fn get_mut(&mut self) -> Option<&mut EventRef> {
|
||||
self.0.get_mut()
|
||||
pub fn get_mut(&mut self) -> Option<&mut $name> {
|
||||
self.0
|
||||
.get_mut()
|
||||
.map(|event| unsafe { &mut *(event as *mut EventRef as *mut $name) })
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for $name<Event> {
|
||||
type Target = $name;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
unsafe { &*(self.0.as_ptr() as *const Self::Target) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Borrow<$name> for $name<Event> {
|
||||
fn borrow(&self) -> &$name {
|
||||
&*self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,14 +442,14 @@ impl FlushStop<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> FlushStop<T> {
|
||||
impl FlushStop {
|
||||
#[doc(alias = "get_reset_time")]
|
||||
#[doc(alias = "gst_event_parse_flush_stop")]
|
||||
pub fn resets_time(&self) -> bool {
|
||||
unsafe {
|
||||
let mut reset_time = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_flush_stop(self.0.as_ptr(), reset_time.as_mut_ptr());
|
||||
ffi::gst_event_parse_flush_stop(self.as_mut_ptr(), reset_time.as_mut_ptr());
|
||||
|
||||
from_glib(reset_time.assume_init())
|
||||
}
|
||||
|
@ -470,40 +469,27 @@ impl StreamStart<Event> {
|
|||
assert_initialized_main_thread!();
|
||||
StreamStartBuilder::new(stream_id)
|
||||
}
|
||||
}
|
||||
|
||||
impl StreamStart {
|
||||
#[doc(alias = "get_stream_id")]
|
||||
#[doc(alias = "gst_event_parse_stream_start")]
|
||||
pub fn stream_id(&self) -> &str {
|
||||
unsafe {
|
||||
let mut stream_id = ptr::null();
|
||||
|
||||
ffi::gst_event_parse_stream_start(AsPtr::as_ptr(&self.0), &mut stream_id);
|
||||
ffi::gst_event_parse_stream_start(self.as_mut_ptr(), &mut stream_id);
|
||||
CStr::from_ptr(stream_id).to_str().unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> StreamStart<&'a EventRef> {
|
||||
#[doc(alias = "get_stream_id")]
|
||||
#[doc(alias = "gst_event_parse_stream_start")]
|
||||
pub fn stream_id(&self) -> &'a str {
|
||||
unsafe {
|
||||
let mut stream_id = ptr::null();
|
||||
|
||||
ffi::gst_event_parse_stream_start(AsPtr::as_ptr(&self.0), &mut stream_id);
|
||||
CStr::from_ptr(stream_id).to_str().unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> StreamStart<T> {
|
||||
#[doc(alias = "get_stream_flags")]
|
||||
#[doc(alias = "gst_event_parse_stream_flags")]
|
||||
pub fn stream_flags(&self) -> crate::StreamFlags {
|
||||
unsafe {
|
||||
let mut stream_flags = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_stream_flags(self.0.as_ptr(), stream_flags.as_mut_ptr());
|
||||
ffi::gst_event_parse_stream_flags(self.as_mut_ptr(), stream_flags.as_mut_ptr());
|
||||
|
||||
from_glib(stream_flags.assume_init())
|
||||
}
|
||||
|
@ -515,7 +501,7 @@ impl<T: AsPtr> StreamStart<T> {
|
|||
unsafe {
|
||||
let mut group_id = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_group_id(self.0.as_ptr(), group_id.as_mut_ptr());
|
||||
ffi::gst_event_parse_group_id(self.as_mut_ptr(), group_id.as_mut_ptr());
|
||||
|
||||
let group_id = group_id.assume_init();
|
||||
if group_id == 0 {
|
||||
|
@ -533,7 +519,7 @@ impl<T: AsPtr> StreamStart<T> {
|
|||
pub fn stream(&self) -> Option<crate::Stream> {
|
||||
unsafe {
|
||||
let mut stream = ptr::null_mut();
|
||||
ffi::gst_event_parse_stream(self.0.as_ptr(), &mut stream);
|
||||
ffi::gst_event_parse_stream(self.as_mut_ptr(), &mut stream);
|
||||
from_glib_full(stream)
|
||||
}
|
||||
}
|
||||
|
@ -552,33 +538,16 @@ impl Caps<Event> {
|
|||
assert_initialized_main_thread!();
|
||||
CapsBuilder::new(caps)
|
||||
}
|
||||
}
|
||||
|
||||
impl Caps {
|
||||
#[doc(alias = "get_caps")]
|
||||
#[doc(alias = "gst_event_parse_caps")]
|
||||
pub fn caps(&self) -> &crate::CapsRef {
|
||||
unsafe {
|
||||
let mut caps = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_caps(AsPtr::as_ptr(&self.0), &mut caps);
|
||||
crate::CapsRef::from_ptr(caps)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "get_caps_owned")]
|
||||
#[doc(alias = "gst_event_parse_caps")]
|
||||
pub fn caps_owned(&self) -> crate::Caps {
|
||||
unsafe { from_glib_none(self.caps().as_ptr()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Caps<&'a EventRef> {
|
||||
#[doc(alias = "get_caps")]
|
||||
#[doc(alias = "gst_event_parse_caps")]
|
||||
pub fn caps(&self) -> &'a crate::CapsRef {
|
||||
unsafe {
|
||||
let mut caps = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_caps(AsPtr::as_ptr(&self.0), &mut caps);
|
||||
ffi::gst_event_parse_caps(self.as_mut_ptr(), &mut caps);
|
||||
crate::CapsRef::from_ptr(caps)
|
||||
}
|
||||
}
|
||||
|
@ -605,27 +574,16 @@ impl Segment<Event> {
|
|||
assert_initialized_main_thread!();
|
||||
SegmentBuilder::new(segment.as_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl Segment {
|
||||
#[doc(alias = "get_segment")]
|
||||
#[doc(alias = "gst_event_parse_segment")]
|
||||
pub fn segment(&self) -> &crate::Segment {
|
||||
unsafe {
|
||||
let mut segment = ptr::null();
|
||||
|
||||
ffi::gst_event_parse_segment(AsPtr::as_ptr(&self.0), &mut segment);
|
||||
&*(segment as *mut ffi::GstSegment as *mut crate::Segment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Segment<&'a EventRef> {
|
||||
#[doc(alias = "get_segment")]
|
||||
#[doc(alias = "gst_event_parse_segment")]
|
||||
pub fn segment(&self) -> &'a crate::Segment {
|
||||
unsafe {
|
||||
let mut segment = ptr::null();
|
||||
|
||||
ffi::gst_event_parse_segment(AsPtr::as_ptr(&self.0), &mut segment);
|
||||
ffi::gst_event_parse_segment(self.as_mut_ptr(), &mut segment);
|
||||
&*(segment as *mut ffi::GstSegment as *mut crate::Segment)
|
||||
}
|
||||
}
|
||||
|
@ -656,7 +614,7 @@ impl StreamCollection<Event> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
impl<T: AsPtr> StreamCollection<T> {
|
||||
impl StreamCollection {
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
#[doc(alias = "get_stream_collection")]
|
||||
|
@ -665,7 +623,7 @@ impl<T: AsPtr> StreamCollection<T> {
|
|||
unsafe {
|
||||
let mut stream_collection = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_stream_collection(self.0.as_ptr(), &mut stream_collection);
|
||||
ffi::gst_event_parse_stream_collection(self.as_mut_ptr(), &mut stream_collection);
|
||||
from_glib_full(stream_collection)
|
||||
}
|
||||
}
|
||||
|
@ -684,33 +642,16 @@ impl Tag<Event> {
|
|||
assert_initialized_main_thread!();
|
||||
TagBuilder::new(tags)
|
||||
}
|
||||
}
|
||||
|
||||
impl Tag {
|
||||
#[doc(alias = "get_tag")]
|
||||
#[doc(alias = "gst_event_parse_tag")]
|
||||
pub fn tag(&self) -> &crate::TagListRef {
|
||||
unsafe {
|
||||
let mut tags = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_tag(AsPtr::as_ptr(&self.0), &mut tags);
|
||||
crate::TagListRef::from_ptr(tags)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "get_tag_owned")]
|
||||
#[doc(alias = "gst_event_parse_tag")]
|
||||
pub fn tag_owned(&self) -> crate::TagList {
|
||||
unsafe { from_glib_none(self.tag().as_ptr()) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Tag<&'a EventRef> {
|
||||
#[doc(alias = "get_tag")]
|
||||
#[doc(alias = "gst_event_parse_tag")]
|
||||
pub fn tag(&self) -> &'a crate::TagListRef {
|
||||
unsafe {
|
||||
let mut tags = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_tag(AsPtr::as_ptr(&self.0), &mut tags);
|
||||
ffi::gst_event_parse_tag(self.as_mut_ptr(), &mut tags);
|
||||
crate::TagListRef::from_ptr(tags)
|
||||
}
|
||||
}
|
||||
|
@ -745,7 +686,7 @@ impl Buffersize<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Buffersize<T> {
|
||||
impl Buffersize {
|
||||
#[doc(alias = "gst_event_parse_buffer_size")]
|
||||
pub fn get(&self) -> (GenericFormattedValue, GenericFormattedValue, bool) {
|
||||
unsafe {
|
||||
|
@ -755,7 +696,7 @@ impl<T: AsPtr> Buffersize<T> {
|
|||
let mut async_ = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_buffer_size(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
fmt.as_mut_ptr(),
|
||||
minsize.as_mut_ptr(),
|
||||
maxsize.as_mut_ptr(),
|
||||
|
@ -785,14 +726,14 @@ impl SinkMessage<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> SinkMessage<T> {
|
||||
impl SinkMessage {
|
||||
#[doc(alias = "get_message")]
|
||||
#[doc(alias = "gst_event_parse_sink_message")]
|
||||
pub fn message(&self) -> crate::Message {
|
||||
unsafe {
|
||||
let mut msg = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_sink_message(self.0.as_ptr(), &mut msg);
|
||||
ffi::gst_event_parse_sink_message(self.as_mut_ptr(), &mut msg);
|
||||
from_glib_full(msg)
|
||||
}
|
||||
}
|
||||
|
@ -823,7 +764,7 @@ impl StreamGroupDone<Event> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
impl<T: AsPtr> StreamGroupDone<T> {
|
||||
impl StreamGroupDone {
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
#[doc(alias = "get_group_id")]
|
||||
|
@ -832,7 +773,7 @@ impl<T: AsPtr> StreamGroupDone<T> {
|
|||
unsafe {
|
||||
let mut group_id = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_stream_group_done(self.0.as_ptr(), group_id.as_mut_ptr());
|
||||
ffi::gst_event_parse_stream_group_done(self.as_mut_ptr(), group_id.as_mut_ptr());
|
||||
|
||||
let group_id = group_id.assume_init();
|
||||
assert_ne!(group_id, 0);
|
||||
|
@ -873,7 +814,7 @@ impl Toc<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Toc<T> {
|
||||
impl Toc {
|
||||
#[doc(alias = "get_toc")]
|
||||
#[doc(alias = "gst_event_parse_toc")]
|
||||
pub fn toc(&self) -> (&crate::TocRef, bool) {
|
||||
|
@ -881,7 +822,7 @@ impl<T: AsPtr> Toc<T> {
|
|||
let mut toc = ptr::null_mut();
|
||||
let mut updated = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_toc(self.0.as_ptr(), &mut toc, updated.as_mut_ptr());
|
||||
ffi::gst_event_parse_toc(self.as_mut_ptr(), &mut toc, updated.as_mut_ptr());
|
||||
(
|
||||
crate::TocRef::from_ptr(toc),
|
||||
from_glib(updated.assume_init()),
|
||||
|
@ -914,7 +855,7 @@ impl Protection<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Protection<T> {
|
||||
impl Protection {
|
||||
#[doc(alias = "gst_event_parse_protection")]
|
||||
pub fn get(&self) -> (&str, &crate::BufferRef, Option<&str>) {
|
||||
unsafe {
|
||||
|
@ -923,7 +864,7 @@ impl<T: AsPtr> Protection<T> {
|
|||
let mut origin = ptr::null();
|
||||
|
||||
ffi::gst_event_parse_protection(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
&mut system_id,
|
||||
&mut buffer,
|
||||
&mut origin,
|
||||
|
@ -966,7 +907,7 @@ impl SegmentDone<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> SegmentDone<T> {
|
||||
impl SegmentDone {
|
||||
#[doc(alias = "gst_event_parse_segment_done")]
|
||||
pub fn get(&self) -> GenericFormattedValue {
|
||||
unsafe {
|
||||
|
@ -974,7 +915,7 @@ impl<T: AsPtr> SegmentDone<T> {
|
|||
let mut position = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_segment_done(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
fmt.as_mut_ptr(),
|
||||
position.as_mut_ptr(),
|
||||
);
|
||||
|
@ -999,7 +940,7 @@ impl Gap<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Gap<T> {
|
||||
impl Gap {
|
||||
#[doc(alias = "gst_event_parse_gap")]
|
||||
pub fn get(&self) -> (ClockTime, Option<ClockTime>) {
|
||||
unsafe {
|
||||
|
@ -1007,7 +948,7 @@ impl<T: AsPtr> Gap<T> {
|
|||
let mut duration = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_gap(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
timestamp.as_mut_ptr(),
|
||||
duration.as_mut_ptr(),
|
||||
);
|
||||
|
@ -1025,7 +966,7 @@ impl<T: AsPtr> Gap<T> {
|
|||
pub fn gap_flags(&self) -> crate::GapFlags {
|
||||
unsafe {
|
||||
let mut flags = mem::MaybeUninit::uninit();
|
||||
ffi::gst_event_parse_gap_flags(self.0.as_ptr(), flags.as_mut_ptr());
|
||||
ffi::gst_event_parse_gap_flags(self.as_mut_ptr(), flags.as_mut_ptr());
|
||||
from_glib(flags.assume_init())
|
||||
}
|
||||
}
|
||||
|
@ -1055,7 +996,7 @@ impl InstantRateChange<Event> {
|
|||
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
impl<T: AsPtr> InstantRateChange<T> {
|
||||
impl InstantRateChange {
|
||||
#[doc(alias = "gst_event_parse_instant_rate_change")]
|
||||
pub fn get(&self) -> (f64, crate::SegmentFlags) {
|
||||
unsafe {
|
||||
|
@ -1063,7 +1004,7 @@ impl<T: AsPtr> InstantRateChange<T> {
|
|||
let mut new_flags = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_instant_rate_change(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
multiplier.as_mut_ptr(),
|
||||
new_flags.as_mut_ptr(),
|
||||
);
|
||||
|
@ -1095,7 +1036,7 @@ impl Qos<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Qos<T> {
|
||||
impl Qos {
|
||||
#[doc(alias = "gst_event_parse_qos")]
|
||||
pub fn get(&self) -> (crate::QOSType, f64, i64, Option<ClockTime>) {
|
||||
unsafe {
|
||||
|
@ -1105,7 +1046,7 @@ impl<T: AsPtr> Qos<T> {
|
|||
let mut timestamp = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_qos(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
type_.as_mut_ptr(),
|
||||
proportion.as_mut_ptr(),
|
||||
diff.as_mut_ptr(),
|
||||
|
@ -1155,7 +1096,7 @@ impl Seek<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Seek<T> {
|
||||
impl Seek {
|
||||
#[doc(alias = "gst_event_parse_seek")]
|
||||
pub fn get(
|
||||
&self,
|
||||
|
@ -1177,7 +1118,7 @@ impl<T: AsPtr> Seek<T> {
|
|||
let mut stop = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_seek(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
rate.as_mut_ptr(),
|
||||
fmt.as_mut_ptr(),
|
||||
flags.as_mut_ptr(),
|
||||
|
@ -1207,7 +1148,7 @@ impl<T: AsPtr> Seek<T> {
|
|||
let mut trickmode_interval = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_seek_trickmode_interval(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
trickmode_interval.as_mut_ptr(),
|
||||
);
|
||||
|
||||
|
@ -1246,14 +1187,14 @@ impl Latency<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Latency<T> {
|
||||
impl Latency {
|
||||
#[doc(alias = "get_latency")]
|
||||
#[doc(alias = "gst_event_parse_latency")]
|
||||
pub fn latency(&self) -> ClockTime {
|
||||
unsafe {
|
||||
let mut latency = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_latency(self.0.as_ptr(), latency.as_mut_ptr());
|
||||
ffi::gst_event_parse_latency(self.as_mut_ptr(), latency.as_mut_ptr());
|
||||
|
||||
try_from_glib(latency.assume_init()).expect("undefined latency")
|
||||
}
|
||||
|
@ -1285,7 +1226,7 @@ impl Step<Event> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T: AsPtr> Step<T> {
|
||||
impl Step {
|
||||
#[doc(alias = "gst_event_parse_step")]
|
||||
pub fn get(&self) -> (GenericFormattedValue, f64, bool, bool) {
|
||||
unsafe {
|
||||
|
@ -1296,7 +1237,7 @@ impl<T: AsPtr> Step<T> {
|
|||
let mut intermediate = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_step(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
fmt.as_mut_ptr(),
|
||||
amount.as_mut_ptr(),
|
||||
rate.as_mut_ptr(),
|
||||
|
@ -1345,26 +1286,15 @@ impl TocSelect<Event> {
|
|||
assert_initialized_main_thread!();
|
||||
TocSelectBuilder::new(uid)
|
||||
}
|
||||
}
|
||||
|
||||
impl TocSelect {
|
||||
#[doc(alias = "get_uid")]
|
||||
pub fn uid(&self) -> &str {
|
||||
unsafe {
|
||||
let mut uid = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_toc_select(AsPtr::as_ptr(&self.0), &mut uid);
|
||||
|
||||
CStr::from_ptr(uid).to_str().unwrap()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> TocSelect<&'a EventRef> {
|
||||
#[doc(alias = "get_uid")]
|
||||
pub fn uid(&self) -> &'a str {
|
||||
unsafe {
|
||||
let mut uid = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_toc_select(AsPtr::as_ptr(&self.0), &mut uid);
|
||||
ffi::gst_event_parse_toc_select(self.as_mut_ptr(), &mut uid);
|
||||
|
||||
CStr::from_ptr(uid).to_str().unwrap()
|
||||
}
|
||||
|
@ -1396,7 +1326,7 @@ impl SelectStreams<Event> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
impl<T: AsPtr> SelectStreams<T> {
|
||||
impl SelectStreams {
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
#[doc(alias = "get_streams")]
|
||||
|
@ -1405,7 +1335,7 @@ impl<T: AsPtr> SelectStreams<T> {
|
|||
unsafe {
|
||||
let mut streams = ptr::null_mut();
|
||||
|
||||
ffi::gst_event_parse_select_streams(self.0.as_ptr(), &mut streams);
|
||||
ffi::gst_event_parse_select_streams(self.as_mut_ptr(), &mut streams);
|
||||
|
||||
FromGlibPtrContainer::from_glib_full(streams)
|
||||
}
|
||||
|
@ -1445,7 +1375,7 @@ impl InstantRateSyncTime<Event> {
|
|||
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
impl<T: AsPtr> InstantRateSyncTime<T> {
|
||||
impl InstantRateSyncTime {
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
#[doc(alias = "parse_instant_rate_sync_time")]
|
||||
|
@ -1457,7 +1387,7 @@ impl<T: AsPtr> InstantRateSyncTime<T> {
|
|||
let mut upstream_running_time = mem::MaybeUninit::uninit();
|
||||
|
||||
ffi::gst_event_parse_instant_rate_sync_time(
|
||||
self.0.as_ptr(),
|
||||
self.as_mut_ptr(),
|
||||
rate_multiplier.as_mut_ptr(),
|
||||
running_time.as_mut_ptr(),
|
||||
upstream_running_time.as_mut_ptr(),
|
||||
|
@ -2547,4 +2477,19 @@ mod tests {
|
|||
let structure = flush_start_evt.structure().unwrap();
|
||||
assert_eq!(structure.get("test"), Ok(42u32));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_view_lifetimes() {
|
||||
crate::init().unwrap();
|
||||
|
||||
let caps = crate::Caps::builder("some/x-caps").build();
|
||||
let event = crate::event::Caps::new(&caps);
|
||||
|
||||
let caps2 = match event.view() {
|
||||
EventView::Caps(caps) => caps.caps(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
assert_eq!(&*caps, caps2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ pub use crate::bufferlist::{BufferList, BufferListRef};
|
|||
mod bufferlist_serde;
|
||||
|
||||
pub mod query;
|
||||
pub use crate::query::{Query, QueryRef, QueryView};
|
||||
pub use crate::query::{Query, QueryRef, QueryView, QueryViewMut};
|
||||
pub mod event;
|
||||
pub use crate::event::{Event, EventRef, EventView, GroupId, Seqnum};
|
||||
pub mod context;
|
||||
|
|
|
@ -9,6 +9,7 @@ use crate::Object;
|
|||
use crate::Seqnum;
|
||||
use crate::TagList;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
|
@ -16,9 +17,7 @@ use std::num::NonZeroU32;
|
|||
use std::ops::Deref;
|
||||
use std::ptr;
|
||||
|
||||
use glib::translate::{
|
||||
from_glib, from_glib_full, from_glib_none, mut_override, try_from_glib, IntoGlib, ToGlibPtr,
|
||||
};
|
||||
use glib::translate::*;
|
||||
|
||||
mini_object_wrapper!(Message, MessageRef, ffi::GstMessage, || {
|
||||
ffi::gst_message_get_type()
|
||||
|
@ -74,63 +73,58 @@ impl MessageRef {
|
|||
}
|
||||
|
||||
pub fn view(&self) -> MessageView {
|
||||
let type_ = unsafe { (*self.as_ptr()).type_ };
|
||||
unsafe {
|
||||
let type_ = (*self.as_ptr()).type_;
|
||||
|
||||
match type_ {
|
||||
ffi::GST_MESSAGE_EOS => MessageView::Eos(Eos(self)),
|
||||
ffi::GST_MESSAGE_ERROR => MessageView::Error(Error(self)),
|
||||
ffi::GST_MESSAGE_WARNING => MessageView::Warning(Warning(self)),
|
||||
ffi::GST_MESSAGE_INFO => MessageView::Info(Info(self)),
|
||||
ffi::GST_MESSAGE_TAG => MessageView::Tag(Tag(self)),
|
||||
ffi::GST_MESSAGE_BUFFERING => MessageView::Buffering(Buffering(self)),
|
||||
ffi::GST_MESSAGE_STATE_CHANGED => MessageView::StateChanged(StateChanged(self)),
|
||||
ffi::GST_MESSAGE_STATE_DIRTY => MessageView::StateDirty(StateDirty(self)),
|
||||
ffi::GST_MESSAGE_STEP_DONE => MessageView::StepDone(StepDone(self)),
|
||||
ffi::GST_MESSAGE_CLOCK_PROVIDE => MessageView::ClockProvide(ClockProvide(self)),
|
||||
ffi::GST_MESSAGE_CLOCK_LOST => MessageView::ClockLost(ClockLost(self)),
|
||||
ffi::GST_MESSAGE_NEW_CLOCK => MessageView::NewClock(NewClock(self)),
|
||||
ffi::GST_MESSAGE_STRUCTURE_CHANGE => {
|
||||
MessageView::StructureChange(StructureChange(self))
|
||||
match type_ {
|
||||
ffi::GST_MESSAGE_EOS => Eos::view(self),
|
||||
ffi::GST_MESSAGE_ERROR => Error::view(self),
|
||||
ffi::GST_MESSAGE_WARNING => Warning::view(self),
|
||||
ffi::GST_MESSAGE_INFO => Info::view(self),
|
||||
ffi::GST_MESSAGE_TAG => Tag::view(self),
|
||||
ffi::GST_MESSAGE_BUFFERING => Buffering::view(self),
|
||||
ffi::GST_MESSAGE_STATE_CHANGED => StateChanged::view(self),
|
||||
ffi::GST_MESSAGE_STATE_DIRTY => StateDirty::view(self),
|
||||
ffi::GST_MESSAGE_STEP_DONE => StepDone::view(self),
|
||||
ffi::GST_MESSAGE_CLOCK_PROVIDE => ClockProvide::view(self),
|
||||
ffi::GST_MESSAGE_CLOCK_LOST => ClockLost::view(self),
|
||||
ffi::GST_MESSAGE_NEW_CLOCK => NewClock::view(self),
|
||||
ffi::GST_MESSAGE_STRUCTURE_CHANGE => StructureChange::view(self),
|
||||
ffi::GST_MESSAGE_STREAM_STATUS => StreamStatus::view(self),
|
||||
ffi::GST_MESSAGE_APPLICATION => Application::view(self),
|
||||
ffi::GST_MESSAGE_ELEMENT => Element::view(self),
|
||||
ffi::GST_MESSAGE_SEGMENT_START => SegmentStart::view(self),
|
||||
ffi::GST_MESSAGE_SEGMENT_DONE => SegmentDone::view(self),
|
||||
ffi::GST_MESSAGE_DURATION_CHANGED => DurationChanged::view(self),
|
||||
ffi::GST_MESSAGE_LATENCY => Latency::view(self),
|
||||
ffi::GST_MESSAGE_ASYNC_START => AsyncStart::view(self),
|
||||
ffi::GST_MESSAGE_ASYNC_DONE => AsyncDone::view(self),
|
||||
ffi::GST_MESSAGE_REQUEST_STATE => RequestState::view(self),
|
||||
ffi::GST_MESSAGE_STEP_START => StepStart::view(self),
|
||||
ffi::GST_MESSAGE_QOS => Qos::view(self),
|
||||
ffi::GST_MESSAGE_PROGRESS => Progress::view(self),
|
||||
ffi::GST_MESSAGE_TOC => Toc::view(self),
|
||||
ffi::GST_MESSAGE_RESET_TIME => ResetTime::view(self),
|
||||
ffi::GST_MESSAGE_STREAM_START => StreamStart::view(self),
|
||||
ffi::GST_MESSAGE_NEED_CONTEXT => NeedContext::view(self),
|
||||
ffi::GST_MESSAGE_HAVE_CONTEXT => HaveContext::view(self),
|
||||
ffi::GST_MESSAGE_DEVICE_ADDED => DeviceAdded::view(self),
|
||||
ffi::GST_MESSAGE_DEVICE_REMOVED => DeviceRemoved::view(self),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
ffi::GST_MESSAGE_REDIRECT => Redirect::view(self),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_PROPERTY_NOTIFY => PropertyNotify::view(self),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_STREAM_COLLECTION => StreamCollection::view(self),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_STREAMS_SELECTED => StreamsSelected::view(self),
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_DEVICE_CHANGED => DeviceChanged::view(self),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_INSTANT_RATE_REQUEST => InstantRateRequest::view(self),
|
||||
_ => MessageView::Other,
|
||||
}
|
||||
ffi::GST_MESSAGE_STREAM_STATUS => MessageView::StreamStatus(StreamStatus(self)),
|
||||
ffi::GST_MESSAGE_APPLICATION => MessageView::Application(Application(self)),
|
||||
ffi::GST_MESSAGE_ELEMENT => MessageView::Element(Element(self)),
|
||||
ffi::GST_MESSAGE_SEGMENT_START => MessageView::SegmentStart(SegmentStart(self)),
|
||||
ffi::GST_MESSAGE_SEGMENT_DONE => MessageView::SegmentDone(SegmentDone(self)),
|
||||
ffi::GST_MESSAGE_DURATION_CHANGED => {
|
||||
MessageView::DurationChanged(DurationChanged(self))
|
||||
}
|
||||
ffi::GST_MESSAGE_LATENCY => MessageView::Latency(Latency(self)),
|
||||
ffi::GST_MESSAGE_ASYNC_START => MessageView::AsyncStart(AsyncStart(self)),
|
||||
ffi::GST_MESSAGE_ASYNC_DONE => MessageView::AsyncDone(AsyncDone(self)),
|
||||
ffi::GST_MESSAGE_REQUEST_STATE => MessageView::RequestState(RequestState(self)),
|
||||
ffi::GST_MESSAGE_STEP_START => MessageView::StepStart(StepStart(self)),
|
||||
ffi::GST_MESSAGE_QOS => MessageView::Qos(Qos(self)),
|
||||
ffi::GST_MESSAGE_PROGRESS => MessageView::Progress(Progress(self)),
|
||||
ffi::GST_MESSAGE_TOC => MessageView::Toc(Toc(self)),
|
||||
ffi::GST_MESSAGE_RESET_TIME => MessageView::ResetTime(ResetTime(self)),
|
||||
ffi::GST_MESSAGE_STREAM_START => MessageView::StreamStart(StreamStart(self)),
|
||||
ffi::GST_MESSAGE_NEED_CONTEXT => MessageView::NeedContext(NeedContext(self)),
|
||||
ffi::GST_MESSAGE_HAVE_CONTEXT => MessageView::HaveContext(HaveContext(self)),
|
||||
ffi::GST_MESSAGE_DEVICE_ADDED => MessageView::DeviceAdded(DeviceAdded(self)),
|
||||
ffi::GST_MESSAGE_DEVICE_REMOVED => MessageView::DeviceRemoved(DeviceRemoved(self)),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_PROPERTY_NOTIFY => MessageView::PropertyNotify(PropertyNotify(self)),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_STREAM_COLLECTION => {
|
||||
MessageView::StreamCollection(StreamCollection(self))
|
||||
}
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_STREAMS_SELECTED => {
|
||||
MessageView::StreamsSelected(StreamsSelected(self))
|
||||
}
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_DEVICE_CHANGED => MessageView::DeviceChanged(DeviceChanged(self)),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
ffi::GST_MESSAGE_INSTANT_RATE_REQUEST => {
|
||||
MessageView::InstantRateRequest(InstantRateRequest(self))
|
||||
}
|
||||
_ => MessageView::Other,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,77 +177,128 @@ impl fmt::Debug for MessageRef {
|
|||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum MessageView<'a> {
|
||||
Eos(Eos<'a>),
|
||||
Error(Error<'a>),
|
||||
Warning(Warning<'a>),
|
||||
Info(Info<'a>),
|
||||
Tag(Tag<'a>),
|
||||
Buffering(Buffering<'a>),
|
||||
StateChanged(StateChanged<'a>),
|
||||
StateDirty(StateDirty<'a>),
|
||||
StepDone(StepDone<'a>),
|
||||
ClockProvide(ClockProvide<'a>),
|
||||
ClockLost(ClockLost<'a>),
|
||||
NewClock(NewClock<'a>),
|
||||
StructureChange(StructureChange<'a>),
|
||||
StreamStatus(StreamStatus<'a>),
|
||||
Application(Application<'a>),
|
||||
Element(Element<'a>),
|
||||
SegmentStart(SegmentStart<'a>),
|
||||
SegmentDone(SegmentDone<'a>),
|
||||
DurationChanged(DurationChanged<'a>),
|
||||
Latency(Latency<'a>),
|
||||
AsyncStart(AsyncStart<'a>),
|
||||
AsyncDone(AsyncDone<'a>),
|
||||
RequestState(RequestState<'a>),
|
||||
StepStart(StepStart<'a>),
|
||||
Qos(Qos<'a>),
|
||||
Progress(Progress<'a>),
|
||||
Toc(Toc<'a>),
|
||||
ResetTime(ResetTime<'a>),
|
||||
StreamStart(StreamStart<'a>),
|
||||
NeedContext(NeedContext<'a>),
|
||||
HaveContext(HaveContext<'a>),
|
||||
DeviceAdded(DeviceAdded<'a>),
|
||||
DeviceRemoved(DeviceRemoved<'a>),
|
||||
Eos(&'a Eos),
|
||||
Error(&'a Error),
|
||||
Warning(&'a Warning),
|
||||
Info(&'a Info),
|
||||
Tag(&'a Tag),
|
||||
Buffering(&'a Buffering),
|
||||
StateChanged(&'a StateChanged),
|
||||
StateDirty(&'a StateDirty),
|
||||
StepDone(&'a StepDone),
|
||||
ClockProvide(&'a ClockProvide),
|
||||
ClockLost(&'a ClockLost),
|
||||
NewClock(&'a NewClock),
|
||||
StructureChange(&'a StructureChange),
|
||||
StreamStatus(&'a StreamStatus),
|
||||
Application(&'a Application),
|
||||
Element(&'a Element),
|
||||
SegmentStart(&'a SegmentStart),
|
||||
SegmentDone(&'a SegmentDone),
|
||||
DurationChanged(&'a DurationChanged),
|
||||
Latency(&'a Latency),
|
||||
AsyncStart(&'a AsyncStart),
|
||||
AsyncDone(&'a AsyncDone),
|
||||
RequestState(&'a RequestState),
|
||||
StepStart(&'a StepStart),
|
||||
Qos(&'a Qos),
|
||||
Progress(&'a Progress),
|
||||
Toc(&'a Toc),
|
||||
ResetTime(&'a ResetTime),
|
||||
StreamStart(&'a StreamStart),
|
||||
NeedContext(&'a NeedContext),
|
||||
HaveContext(&'a HaveContext),
|
||||
DeviceAdded(&'a DeviceAdded),
|
||||
DeviceRemoved(&'a DeviceRemoved),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
PropertyNotify(PropertyNotify<'a>),
|
||||
PropertyNotify(&'a PropertyNotify),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
StreamCollection(StreamCollection<'a>),
|
||||
StreamCollection(&'a StreamCollection),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
StreamsSelected(StreamsSelected<'a>),
|
||||
StreamsSelected(&'a StreamsSelected),
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
Redirect(Redirect<'a>),
|
||||
Redirect(&'a Redirect),
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||
DeviceChanged(DeviceChanged<'a>),
|
||||
DeviceChanged(&'a DeviceChanged),
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
InstantRateRequest(InstantRateRequest<'a>),
|
||||
InstantRateRequest(&'a InstantRateRequest),
|
||||
Other,
|
||||
}
|
||||
|
||||
macro_rules! declare_concrete_message(
|
||||
($name:ident) => {
|
||||
($name:ident, $param:ident) => {
|
||||
#[derive(Debug)]
|
||||
pub struct $name<'a>(&'a MessageRef);
|
||||
#[repr(transparent)]
|
||||
pub struct $name<$param = MessageRef>($param);
|
||||
|
||||
impl<'a> Deref for $name<'a> {
|
||||
impl $name {
|
||||
pub fn message(&self) -> &MessageRef {
|
||||
unsafe { &*(self as *const Self as *const MessageRef) }
|
||||
}
|
||||
|
||||
unsafe fn view(message: &MessageRef) -> MessageView<'_> {
|
||||
let message = &*(message as *const MessageRef as *const Self);
|
||||
MessageView::$name(message)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for $name {
|
||||
type Target = MessageRef;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.0
|
||||
unsafe {
|
||||
&*(self as *const Self as *const Self::Target)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToOwned for $name {
|
||||
type Owned = $name<Message>;
|
||||
|
||||
fn to_owned(&self) -> Self::Owned {
|
||||
$name::<Message>(self.copy())
|
||||
}
|
||||
}
|
||||
|
||||
impl $name<Message> {
|
||||
pub fn get_mut(&mut self) -> Option<&mut $name> {
|
||||
self.0.get_mut().map(|message| unsafe {
|
||||
&mut *(message as *mut MessageRef as *mut $name)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for $name<Message> {
|
||||
type Target = $name;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
unsafe { &*(self.0.as_ptr() as *const Self::Target) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Borrow<$name> for $name<Message> {
|
||||
fn borrow(&self) -> &$name {
|
||||
&*self
|
||||
}
|
||||
}
|
||||
|
||||
impl From<$name<Message>> for Message {
|
||||
fn from(concrete: $name<Message>) -> Self {
|
||||
skip_assert_initialized!();
|
||||
concrete.0
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
declare_concrete_message!(Eos);
|
||||
impl<'a> Eos<'a> {
|
||||
declare_concrete_message!(Eos, T);
|
||||
impl Eos {
|
||||
#[doc(alias = "gst_message_new_eos")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> Message {
|
||||
|
@ -261,14 +306,14 @@ impl<'a> Eos<'a> {
|
|||
Self::builder().build()
|
||||
}
|
||||
|
||||
pub fn builder() -> EosBuilder<'a> {
|
||||
pub fn builder<'a>() -> EosBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
EosBuilder::new()
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Error);
|
||||
impl<'a> Error<'a> {
|
||||
declare_concrete_message!(Error, T);
|
||||
impl Error {
|
||||
#[doc(alias = "gst_message_new_error")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new<T: MessageErrorDomain>(error: T, message: &str) -> Message {
|
||||
|
@ -324,8 +369,8 @@ impl<'a> Error<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Warning);
|
||||
impl<'a> Warning<'a> {
|
||||
declare_concrete_message!(Warning, T);
|
||||
impl Warning {
|
||||
#[doc(alias = "gst_message_new_warning")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new<T: MessageErrorDomain>(error: T, message: &str) -> Message {
|
||||
|
@ -381,8 +426,8 @@ impl<'a> Warning<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Info);
|
||||
impl<'a> Info<'a> {
|
||||
declare_concrete_message!(Info, T);
|
||||
impl Info {
|
||||
#[doc(alias = "gst_message_new_info")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new<T: MessageErrorDomain>(error: T, message: &str) -> Message {
|
||||
|
@ -438,8 +483,8 @@ impl<'a> Info<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Tag);
|
||||
impl<'a> Tag<'a> {
|
||||
declare_concrete_message!(Tag, T);
|
||||
impl Tag {
|
||||
#[doc(alias = "gst_message_new_tag")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(tags: &TagList) -> Message {
|
||||
|
@ -463,8 +508,8 @@ impl<'a> Tag<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Buffering);
|
||||
impl<'a> Buffering<'a> {
|
||||
declare_concrete_message!(Buffering, T);
|
||||
impl Buffering {
|
||||
#[doc(alias = "gst_message_new_buffering")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(percent: i32) -> Message {
|
||||
|
@ -472,7 +517,7 @@ impl<'a> Buffering<'a> {
|
|||
Self::builder(percent).build()
|
||||
}
|
||||
|
||||
pub fn builder(percent: i32) -> BufferingBuilder<'a> {
|
||||
pub fn builder<'a>(percent: i32) -> BufferingBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
BufferingBuilder::new(percent)
|
||||
}
|
||||
|
@ -514,8 +559,8 @@ impl<'a> Buffering<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(StateChanged);
|
||||
impl<'a> StateChanged<'a> {
|
||||
declare_concrete_message!(StateChanged, T);
|
||||
impl StateChanged {
|
||||
#[doc(alias = "gst_message_new_state_changed")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(old: crate::State, new: crate::State, pending: crate::State) -> Message {
|
||||
|
@ -523,7 +568,7 @@ impl<'a> StateChanged<'a> {
|
|||
Self::builder(old, new, pending).build()
|
||||
}
|
||||
|
||||
pub fn builder(
|
||||
pub fn builder<'a>(
|
||||
old: crate::State,
|
||||
new: crate::State,
|
||||
pending: crate::State,
|
||||
|
@ -584,8 +629,8 @@ impl<'a> StateChanged<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(StateDirty);
|
||||
impl<'a> StateDirty<'a> {
|
||||
declare_concrete_message!(StateDirty, T);
|
||||
impl StateDirty {
|
||||
#[doc(alias = "gst_message_new_state_dirty")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> Message {
|
||||
|
@ -593,14 +638,14 @@ impl<'a> StateDirty<'a> {
|
|||
Self::builder().build()
|
||||
}
|
||||
|
||||
pub fn builder() -> StateDirtyBuilder<'a> {
|
||||
pub fn builder<'a>() -> StateDirtyBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
StateDirtyBuilder::new()
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(StepDone);
|
||||
impl<'a> StepDone<'a> {
|
||||
declare_concrete_message!(StepDone, T);
|
||||
impl StepDone {
|
||||
#[doc(alias = "gst_message_new_step_done")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new<V: Into<GenericFormattedValue>>(
|
||||
|
@ -623,7 +668,7 @@ impl<'a> StepDone<'a> {
|
|||
.build()
|
||||
}
|
||||
|
||||
pub fn builder<V: Into<GenericFormattedValue>>(
|
||||
pub fn builder<'a, V: Into<GenericFormattedValue>>(
|
||||
amount: V,
|
||||
rate: f64,
|
||||
flush: bool,
|
||||
|
@ -691,8 +736,8 @@ impl<'a> StepDone<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(ClockProvide);
|
||||
impl<'a> ClockProvide<'a> {
|
||||
declare_concrete_message!(ClockProvide, T);
|
||||
impl ClockProvide {
|
||||
#[doc(alias = "gst_message_new_clock_provide")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(clock: &crate::Clock, ready: bool) -> Message {
|
||||
|
@ -734,8 +779,8 @@ impl<'a> ClockProvide<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(ClockLost);
|
||||
impl<'a> ClockLost<'a> {
|
||||
declare_concrete_message!(ClockLost, T);
|
||||
impl ClockLost {
|
||||
#[doc(alias = "gst_message_new_clock_lost")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(clock: &crate::Clock) -> Message {
|
||||
|
@ -761,8 +806,8 @@ impl<'a> ClockLost<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(NewClock);
|
||||
impl<'a> NewClock<'a> {
|
||||
declare_concrete_message!(NewClock, T);
|
||||
impl NewClock {
|
||||
#[doc(alias = "gst_message_new_new_clock")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(clock: &crate::Clock) -> Message {
|
||||
|
@ -788,8 +833,8 @@ impl<'a> NewClock<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(StructureChange);
|
||||
impl<'a> StructureChange<'a> {
|
||||
declare_concrete_message!(StructureChange, T);
|
||||
impl StructureChange {
|
||||
#[doc(alias = "gst_message_new_structure_change")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(type_: crate::StructureChangeType, owner: &crate::Element, busy: bool) -> Message {
|
||||
|
@ -829,8 +874,8 @@ impl<'a> StructureChange<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(StreamStatus);
|
||||
impl<'a> StreamStatus<'a> {
|
||||
declare_concrete_message!(StreamStatus, T);
|
||||
impl StreamStatus {
|
||||
#[doc(alias = "gst_message_new_stream_status")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(type_: crate::StreamStatusType, owner: &crate::Element) -> Message {
|
||||
|
@ -866,8 +911,8 @@ impl<'a> StreamStatus<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Application);
|
||||
impl<'a> Application<'a> {
|
||||
declare_concrete_message!(Application, T);
|
||||
impl Application {
|
||||
#[doc(alias = "gst_message_new_application")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(structure: crate::Structure) -> Message {
|
||||
|
@ -875,14 +920,14 @@ impl<'a> Application<'a> {
|
|||
Self::builder(structure).build()
|
||||
}
|
||||
|
||||
pub fn builder(structure: crate::Structure) -> ApplicationBuilder<'a> {
|
||||
pub fn builder<'a>(structure: crate::Structure) -> ApplicationBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
ApplicationBuilder::new(structure)
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Element);
|
||||
impl<'a> Element<'a> {
|
||||
declare_concrete_message!(Element, T);
|
||||
impl Element {
|
||||
#[doc(alias = "gst_message_new_element")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(structure: crate::Structure) -> Message {
|
||||
|
@ -890,14 +935,14 @@ impl<'a> Element<'a> {
|
|||
Self::builder(structure).build()
|
||||
}
|
||||
|
||||
pub fn builder(structure: crate::Structure) -> ElementBuilder<'a> {
|
||||
pub fn builder<'a>(structure: crate::Structure) -> ElementBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
ElementBuilder::new(structure)
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(SegmentStart);
|
||||
impl<'a> SegmentStart<'a> {
|
||||
declare_concrete_message!(SegmentStart, T);
|
||||
impl SegmentStart {
|
||||
#[doc(alias = "gst_message_new_segment_start")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new<V: Into<GenericFormattedValue>>(position: V) -> Message {
|
||||
|
@ -905,7 +950,7 @@ impl<'a> SegmentStart<'a> {
|
|||
Self::builder(position).build()
|
||||
}
|
||||
|
||||
pub fn builder<V: Into<GenericFormattedValue>>(position: V) -> SegmentStartBuilder<'a> {
|
||||
pub fn builder<'a, V: Into<GenericFormattedValue>>(position: V) -> SegmentStartBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
let position = position.into();
|
||||
SegmentStartBuilder::new(position)
|
||||
|
@ -928,8 +973,8 @@ impl<'a> SegmentStart<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(SegmentDone);
|
||||
impl<'a> SegmentDone<'a> {
|
||||
declare_concrete_message!(SegmentDone, T);
|
||||
impl SegmentDone {
|
||||
#[doc(alias = "gst_message_new_segment_done")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new<V: Into<GenericFormattedValue>>(position: V) -> Message {
|
||||
|
@ -937,7 +982,7 @@ impl<'a> SegmentDone<'a> {
|
|||
Self::builder(position).build()
|
||||
}
|
||||
|
||||
pub fn builder<V: Into<GenericFormattedValue>>(position: V) -> SegmentDoneBuilder<'a> {
|
||||
pub fn builder<'a, V: Into<GenericFormattedValue>>(position: V) -> SegmentDoneBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
let position = position.into();
|
||||
SegmentDoneBuilder::new(position)
|
||||
|
@ -960,8 +1005,8 @@ impl<'a> SegmentDone<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(DurationChanged);
|
||||
impl<'a> DurationChanged<'a> {
|
||||
declare_concrete_message!(DurationChanged, T);
|
||||
impl DurationChanged {
|
||||
#[doc(alias = "gst_message_new_duration_changed")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> Message {
|
||||
|
@ -969,14 +1014,14 @@ impl<'a> DurationChanged<'a> {
|
|||
Self::builder().build()
|
||||
}
|
||||
|
||||
pub fn builder() -> DurationChangedBuilder<'a> {
|
||||
pub fn builder<'a>() -> DurationChangedBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
DurationChangedBuilder::new()
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Latency);
|
||||
impl<'a> Latency<'a> {
|
||||
declare_concrete_message!(Latency, T);
|
||||
impl Latency {
|
||||
#[doc(alias = "gst_message_new_latency")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> Message {
|
||||
|
@ -984,14 +1029,14 @@ impl<'a> Latency<'a> {
|
|||
Self::builder().build()
|
||||
}
|
||||
|
||||
pub fn builder() -> LatencyBuilder<'a> {
|
||||
pub fn builder<'a>() -> LatencyBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
LatencyBuilder::new()
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(AsyncStart);
|
||||
impl<'a> AsyncStart<'a> {
|
||||
declare_concrete_message!(AsyncStart, T);
|
||||
impl AsyncStart {
|
||||
#[doc(alias = "gst_message_new_async_start")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> Message {
|
||||
|
@ -999,14 +1044,14 @@ impl<'a> AsyncStart<'a> {
|
|||
Self::builder().build()
|
||||
}
|
||||
|
||||
pub fn builder() -> AsyncStartBuilder<'a> {
|
||||
pub fn builder<'a>() -> AsyncStartBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
AsyncStartBuilder::new()
|
||||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(AsyncDone);
|
||||
impl<'a> AsyncDone<'a> {
|
||||
declare_concrete_message!(AsyncDone, T);
|
||||
impl AsyncDone {
|
||||
#[doc(alias = "gst_message_new_async_done")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(running_time: impl Into<Option<crate::ClockTime>>) -> Message {
|
||||
|
@ -1014,7 +1059,7 @@ impl<'a> AsyncDone<'a> {
|
|||
Self::builder().running_time(running_time).build()
|
||||
}
|
||||
|
||||
pub fn builder() -> AsyncDoneBuilder<'a> {
|
||||
pub fn builder<'a>() -> AsyncDoneBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
AsyncDoneBuilder::new()
|
||||
}
|
||||
|
@ -1032,8 +1077,8 @@ impl<'a> AsyncDone<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(RequestState);
|
||||
impl<'a> RequestState<'a> {
|
||||
declare_concrete_message!(RequestState, T);
|
||||
impl RequestState {
|
||||
#[doc(alias = "gst_message_new_request_state")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(state: crate::State) -> Message {
|
||||
|
@ -1041,7 +1086,7 @@ impl<'a> RequestState<'a> {
|
|||
Self::builder(state).build()
|
||||
}
|
||||
|
||||
pub fn builder(state: crate::State) -> RequestStateBuilder<'a> {
|
||||
pub fn builder<'a>(state: crate::State) -> RequestStateBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
RequestStateBuilder::new(state)
|
||||
}
|
||||
|
@ -1059,8 +1104,8 @@ impl<'a> RequestState<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(StepStart);
|
||||
impl<'a> StepStart<'a> {
|
||||
declare_concrete_message!(StepStart, T);
|
||||
impl StepStart {
|
||||
#[doc(alias = "gst_message_new_step_start")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new<V: Into<GenericFormattedValue>>(
|
||||
|
@ -1074,7 +1119,7 @@ impl<'a> StepStart<'a> {
|
|||
Self::builder(active, amount.into(), rate, flush, intermediate).build()
|
||||
}
|
||||
|
||||
pub fn builder<V: Into<GenericFormattedValue>>(
|
||||
pub fn builder<'a, V: Into<GenericFormattedValue>>(
|
||||
active: bool,
|
||||
amount: V,
|
||||
rate: f64,
|
||||
|
@ -1119,8 +1164,8 @@ impl<'a> StepStart<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Qos);
|
||||
impl<'a> Qos<'a> {
|
||||
declare_concrete_message!(Qos, T);
|
||||
impl Qos {
|
||||
#[doc(alias = "gst_message_new_qos")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(
|
||||
|
@ -1139,7 +1184,7 @@ impl<'a> Qos<'a> {
|
|||
.build()
|
||||
}
|
||||
|
||||
pub fn builder(live: bool) -> QosBuilder<'a> {
|
||||
pub fn builder<'a>(live: bool) -> QosBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
QosBuilder::new(live)
|
||||
}
|
||||
|
@ -1232,16 +1277,16 @@ impl<'a> Qos<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Progress);
|
||||
impl<'a> Progress<'a> {
|
||||
declare_concrete_message!(Progress, T);
|
||||
impl Progress {
|
||||
#[doc(alias = "gst_message_new_progress")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(type_: crate::ProgressType, code: &'a str, text: &'a str) -> Message {
|
||||
pub fn new(type_: crate::ProgressType, code: &str, text: &str) -> Message {
|
||||
skip_assert_initialized!();
|
||||
Self::builder(type_, code, text).build()
|
||||
}
|
||||
|
||||
pub fn builder(
|
||||
pub fn builder<'a>(
|
||||
type_: crate::ProgressType,
|
||||
code: &'a str,
|
||||
text: &'a str,
|
||||
|
@ -1251,7 +1296,7 @@ impl<'a> Progress<'a> {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_message_parse_progress")]
|
||||
pub fn get(&self) -> (crate::ProgressType, &'a str, &'a str) {
|
||||
pub fn get(&self) -> (crate::ProgressType, &str, &str) {
|
||||
unsafe {
|
||||
let mut type_ = mem::MaybeUninit::uninit();
|
||||
let mut code = ptr::null_mut();
|
||||
|
@ -1272,8 +1317,8 @@ impl<'a> Progress<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(Toc);
|
||||
impl<'a> Toc<'a> {
|
||||
declare_concrete_message!(Toc, T);
|
||||
impl Toc {
|
||||
// FIXME could use false for updated as default
|
||||
// Even better: use an enum for updated so that it is more explicit than true / false
|
||||
#[doc(alias = "gst_message_new_toc")]
|
||||
|
@ -1300,8 +1345,8 @@ impl<'a> Toc<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(ResetTime);
|
||||
impl<'a> ResetTime<'a> {
|
||||
declare_concrete_message!(ResetTime, T);
|
||||
impl ResetTime {
|
||||
#[doc(alias = "gst_message_new_reset_time")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(running_time: crate::ClockTime) -> Message {
|
||||
|
@ -1309,7 +1354,7 @@ impl<'a> ResetTime<'a> {
|
|||
Self::builder(running_time).build()
|
||||
}
|
||||
|
||||
pub fn builder(running_time: crate::ClockTime) -> ResetTimeBuilder<'a> {
|
||||
pub fn builder<'a>(running_time: crate::ClockTime) -> ResetTimeBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
ResetTimeBuilder::new(running_time)
|
||||
}
|
||||
|
@ -1327,8 +1372,8 @@ impl<'a> ResetTime<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(StreamStart);
|
||||
impl<'a> StreamStart<'a> {
|
||||
declare_concrete_message!(StreamStart, T);
|
||||
impl StreamStart {
|
||||
#[doc(alias = "gst_message_new_stream_start")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new() -> Message {
|
||||
|
@ -1336,7 +1381,7 @@ impl<'a> StreamStart<'a> {
|
|||
Self::builder().build()
|
||||
}
|
||||
|
||||
pub fn builder() -> StreamStartBuilder<'a> {
|
||||
pub fn builder<'a>() -> StreamStartBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
StreamStartBuilder::new()
|
||||
}
|
||||
|
@ -1364,8 +1409,8 @@ impl<'a> StreamStart<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(NeedContext);
|
||||
impl<'a> NeedContext<'a> {
|
||||
declare_concrete_message!(NeedContext, T);
|
||||
impl NeedContext {
|
||||
#[doc(alias = "gst_message_new_need_context")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(context_type: &str) -> Message {
|
||||
|
@ -1391,8 +1436,8 @@ impl<'a> NeedContext<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(HaveContext);
|
||||
impl<'a> HaveContext<'a> {
|
||||
declare_concrete_message!(HaveContext, T);
|
||||
impl HaveContext {
|
||||
#[doc(alias = "gst_message_new_have_context")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(context: crate::Context) -> Message {
|
||||
|
@ -1400,7 +1445,7 @@ impl<'a> HaveContext<'a> {
|
|||
Self::builder(context).build()
|
||||
}
|
||||
|
||||
pub fn builder(context: crate::Context) -> HaveContextBuilder<'a> {
|
||||
pub fn builder<'a>(context: crate::Context) -> HaveContextBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
HaveContextBuilder::new(context)
|
||||
}
|
||||
|
@ -1416,8 +1461,8 @@ impl<'a> HaveContext<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(DeviceAdded);
|
||||
impl<'a> DeviceAdded<'a> {
|
||||
declare_concrete_message!(DeviceAdded, T);
|
||||
impl DeviceAdded {
|
||||
#[doc(alias = "gst_message_new_device_added")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(device: &crate::Device) -> Message {
|
||||
|
@ -1443,8 +1488,8 @@ impl<'a> DeviceAdded<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
declare_concrete_message!(DeviceRemoved);
|
||||
impl<'a> DeviceRemoved<'a> {
|
||||
declare_concrete_message!(DeviceRemoved, T);
|
||||
impl DeviceRemoved {
|
||||
#[doc(alias = "gst_message_new_device_removed")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(device: &crate::Device) -> Message {
|
||||
|
@ -1472,10 +1517,10 @@ impl<'a> DeviceRemoved<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
declare_concrete_message!(PropertyNotify);
|
||||
declare_concrete_message!(PropertyNotify, T);
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
impl<'a> PropertyNotify<'a> {
|
||||
impl PropertyNotify {
|
||||
#[doc(alias = "gst_message_new_property_notify")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(property_name: &str) -> Message {
|
||||
|
@ -1489,7 +1534,7 @@ impl<'a> PropertyNotify<'a> {
|
|||
}
|
||||
|
||||
#[doc(alias = "gst_message_parse_property_notify")]
|
||||
pub fn get(&self) -> (Object, &str, Option<&'a glib::Value>) {
|
||||
pub fn get(&self) -> (Object, &str, Option<&glib::Value>) {
|
||||
unsafe {
|
||||
let mut object = ptr::null_mut();
|
||||
let mut property_name = ptr::null();
|
||||
|
@ -1517,10 +1562,10 @@ impl<'a> PropertyNotify<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
declare_concrete_message!(StreamCollection);
|
||||
declare_concrete_message!(StreamCollection, T);
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
impl<'a> StreamCollection<'a> {
|
||||
impl StreamCollection {
|
||||
#[doc(alias = "gst_message_new_stream_collection")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(collection: &crate::StreamCollection) -> Message {
|
||||
|
@ -1548,10 +1593,10 @@ impl<'a> StreamCollection<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
declare_concrete_message!(StreamsSelected);
|
||||
declare_concrete_message!(StreamsSelected, T);
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
impl<'a> StreamsSelected<'a> {
|
||||
impl StreamsSelected {
|
||||
#[doc(alias = "gst_message_new_streams_selected")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(collection: &crate::StreamCollection) -> Message {
|
||||
|
@ -1597,10 +1642,10 @@ impl<'a> StreamsSelected<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
declare_concrete_message!(Redirect);
|
||||
declare_concrete_message!(Redirect, T);
|
||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||
impl<'a> Redirect<'a> {
|
||||
impl Redirect {
|
||||
#[doc(alias = "gst_message_new_redirect")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(location: &str) -> Message {
|
||||
|
@ -1653,18 +1698,18 @@ impl<'a> Redirect<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||
declare_concrete_message!(DeviceChanged);
|
||||
declare_concrete_message!(DeviceChanged, T);
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||
impl<'a> DeviceChanged<'a> {
|
||||
impl DeviceChanged {
|
||||
#[doc(alias = "gst_message_new_device_changed")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(device: &'a crate::Device, changed_device: &'a crate::Device) -> Message {
|
||||
pub fn new(device: &crate::Device, changed_device: &crate::Device) -> Message {
|
||||
skip_assert_initialized!();
|
||||
Self::builder(device, changed_device).build()
|
||||
}
|
||||
|
||||
pub fn builder(
|
||||
pub fn builder<'a>(
|
||||
device: &'a crate::Device,
|
||||
changed_device: &'a crate::Device,
|
||||
) -> DeviceChangedBuilder<'a> {
|
||||
|
@ -1692,10 +1737,10 @@ impl<'a> DeviceChanged<'a> {
|
|||
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
declare_concrete_message!(InstantRateRequest);
|
||||
declare_concrete_message!(InstantRateRequest, T);
|
||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||
impl<'a> InstantRateRequest<'a> {
|
||||
impl InstantRateRequest {
|
||||
#[doc(alias = "gst_message_new_instant_rate_request")]
|
||||
#[allow(clippy::new_ret_no_self)]
|
||||
pub fn new(rate_multiplier: f64) -> Message {
|
||||
|
@ -1703,7 +1748,7 @@ impl<'a> InstantRateRequest<'a> {
|
|||
Self::builder(rate_multiplier).build()
|
||||
}
|
||||
|
||||
pub fn builder(rate_multiplier: f64) -> InstantRateRequestBuilder<'a> {
|
||||
pub fn builder<'a>(rate_multiplier: f64) -> InstantRateRequestBuilder<'a> {
|
||||
assert_initialized_main_thread!();
|
||||
InstantRateRequestBuilder::new(rate_multiplier)
|
||||
}
|
||||
|
|
|
@ -324,7 +324,7 @@ pub trait PadExtManual: 'static {
|
|||
|
||||
#[doc(alias = "gst_pad_get_sticky_event")]
|
||||
#[doc(alias = "get_sticky_event")]
|
||||
fn sticky_event<T: crate::event::StickyEventType>(&self, idx: u32) -> Option<T>;
|
||||
fn sticky_event<T: crate::event::StickyEventType>(&self, idx: u32) -> Option<T::Owned>;
|
||||
|
||||
fn set_pad_flags(&self, flags: PadFlags);
|
||||
|
||||
|
@ -1059,7 +1059,7 @@ impl<O: IsA<Pad>> PadExtManual for O {
|
|||
}
|
||||
}
|
||||
|
||||
fn sticky_event<T: crate::event::StickyEventType>(&self, idx: u32) -> Option<T> {
|
||||
fn sticky_event<T: crate::event::StickyEventType>(&self, idx: u32) -> Option<T::Owned> {
|
||||
unsafe {
|
||||
let ptr = ffi::gst_pad_get_sticky_event(
|
||||
self.as_ref().to_glib_none().0,
|
||||
|
@ -2169,6 +2169,32 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sticky_events() {
|
||||
crate::init().unwrap();
|
||||
|
||||
let pad = crate::Pad::builder(Some("sink"), crate::PadDirection::Sink).build();
|
||||
pad.set_active(true).unwrap();
|
||||
|
||||
// Send some sticky events
|
||||
assert!(pad.send_event(crate::event::StreamStart::new("test")));
|
||||
|
||||
let caps = crate::Caps::builder("some/x-caps").build();
|
||||
assert!(pad.send_event(crate::event::Caps::new(&caps)));
|
||||
|
||||
let segment = crate::FormattedSegment::<crate::ClockTime>::new();
|
||||
assert!(pad.send_event(crate::event::Segment::new(segment.as_ref())));
|
||||
|
||||
let stream_start = pad.sticky_event::<crate::event::StreamStart>(0).unwrap();
|
||||
assert_eq!(stream_start.stream_id(), "test");
|
||||
|
||||
let caps2 = pad.sticky_event::<crate::event::Caps>(0).unwrap();
|
||||
assert_eq!(&*caps, caps2.caps());
|
||||
|
||||
let segment = pad.sticky_event::<crate::event::Segment>(0).unwrap();
|
||||
assert_eq!(segment.segment().format(), crate::Format::Time);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sticky_events_foreach() {
|
||||
crate::init().unwrap();
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue