gst/lib: cleanup format re-exports

This commit is contained in:
François Laignel 2022-10-09 18:37:45 +02:00
parent a4d901ee63
commit 8e2c621a9f
20 changed files with 59 additions and 62 deletions

View file

@ -176,9 +176,9 @@ impl AudioInfo {
} }
#[doc(alias = "gst_audio_info_convert")] #[doc(alias = "gst_audio_info_convert")]
pub fn convert<U: gst::SpecificFormattedValueFullRange>( pub fn convert<U: gst::format::SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl gst::format::FormattedValue,
) -> Option<U> { ) -> Option<U> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();
unsafe { unsafe {
@ -199,7 +199,7 @@ impl AudioInfo {
pub fn convert_generic( pub fn convert_generic(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl gst::format::FormattedValue,
dest_fmt: gst::Format, dest_fmt: gst::Format,
) -> Option<gst::GenericFormattedValue> { ) -> Option<gst::GenericFormattedValue> {
assert_initialized_main_thread!(); assert_initialized_main_thread!();

View file

@ -23,7 +23,7 @@ unsafe impl Sync for AudioClippingMeta {}
impl AudioClippingMeta { impl AudioClippingMeta {
#[doc(alias = "gst_buffer_add_audio_clipping_meta")] #[doc(alias = "gst_buffer_add_audio_clipping_meta")]
pub fn add<V: gst::FormattedValue>( pub fn add<V: gst::format::FormattedValue>(
buffer: &mut gst::BufferRef, buffer: &mut gst::BufferRef,
start: V, start: V,
end: V, end: V,

View file

@ -6,7 +6,7 @@ use glib::prelude::*;
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
use glib::signal::{connect_raw, SignalHandlerId}; use glib::signal::{connect_raw, SignalHandlerId};
use glib::translate::*; use glib::translate::*;
use gst::FormattedValue; use gst::format::FormattedValue;
#[cfg(any(feature = "v1_16", feature = "dox"))] #[cfg(any(feature = "v1_16", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
@ -53,7 +53,10 @@ pub trait AggregatorExtManual: 'static {
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
#[doc(alias = "gst_aggregator_update_segment")] #[doc(alias = "gst_aggregator_update_segment")]
fn update_segment<F: gst::FormattedValueIntrinsic>(&self, segment: &gst::FormattedSegment<F>); fn update_segment<F: gst::format::FormattedValueIntrinsic>(
&self,
segment: &gst::FormattedSegment<F>,
);
fn set_position(&self, position: impl FormattedValue); fn set_position(&self, position: impl FormattedValue);
@ -158,7 +161,10 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
} }
#[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg(any(feature = "v1_18", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
fn update_segment<F: gst::FormattedValueIntrinsic>(&self, segment: &gst::FormattedSegment<F>) { fn update_segment<F: gst::format::FormattedValueIntrinsic>(
&self,
segment: &gst::FormattedSegment<F>,
) {
unsafe { unsafe {
ffi::gst_aggregator_update_segment( ffi::gst_aggregator_update_segment(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,

View file

@ -4,6 +4,7 @@ use crate::BaseParse;
use crate::BaseParseFrame; use crate::BaseParseFrame;
use glib::prelude::*; use glib::prelude::*;
use glib::translate::*; use glib::translate::*;
use gst::format::{FormattedValue, SpecificFormattedValueFullRange};
use std::mem; use std::mem;
pub trait BaseParseExtManual: 'static { pub trait BaseParseExtManual: 'static {
@ -13,18 +14,18 @@ pub trait BaseParseExtManual: 'static {
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(&self, duration: impl gst::FormattedValue, interval: u32); fn set_duration(&self, duration: impl FormattedValue, interval: u32);
#[doc(alias = "gst_base_parse_set_frame_rate")] #[doc(alias = "gst_base_parse_set_frame_rate")]
fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32); fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32);
#[doc(alias = "gst_base_parse_convert_default")] #[doc(alias = "gst_base_parse_convert_default")]
fn convert_default<U: gst::SpecificFormattedValueFullRange>( fn convert_default<U: SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl FormattedValue,
) -> Option<U>; ) -> Option<U>;
fn convert_default_generic( fn convert_default_generic(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl FormattedValue,
dest_format: gst::Format, dest_format: gst::Format,
) -> Option<gst::GenericFormattedValue>; ) -> Option<gst::GenericFormattedValue>;
@ -51,7 +52,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
fn set_duration(&self, duration: impl gst::FormattedValue, interval: u32) { fn set_duration(&self, duration: impl FormattedValue, interval: u32) {
unsafe { unsafe {
ffi::gst_base_parse_set_duration( ffi::gst_base_parse_set_duration(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
@ -75,9 +76,9 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
} }
} }
fn convert_default<U: gst::SpecificFormattedValueFullRange>( fn convert_default<U: SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl FormattedValue,
) -> Option<U> { ) -> Option<U> {
unsafe { unsafe {
let mut dest_val = mem::MaybeUninit::uninit(); let mut dest_val = mem::MaybeUninit::uninit();
@ -98,7 +99,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
fn convert_default_generic( fn convert_default_generic(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl FormattedValue,
dest_format: gst::Format, dest_format: gst::Format,
) -> Option<gst::GenericFormattedValue> { ) -> Option<gst::GenericFormattedValue> {
unsafe { unsafe {

View file

@ -5,7 +5,6 @@ use std::mem;
use crate::prelude::*; use crate::prelude::*;
use glib::translate::*; use glib::translate::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use crate::BaseParse; use crate::BaseParse;
@ -33,7 +32,7 @@ pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
fn convert( fn convert(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl gst::format::FormattedValue,
dest_format: gst::Format, dest_format: gst::Format,
) -> Option<gst::GenericFormattedValue> { ) -> Option<gst::GenericFormattedValue> {
self.parent_convert(src_val, dest_format) self.parent_convert(src_val, dest_format)
@ -54,7 +53,7 @@ pub trait BaseParseImplExt: ObjectSubclass {
fn parent_convert( fn parent_convert(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl gst::format::FormattedValue,
dest_format: gst::Format, dest_format: gst::Format,
) -> Option<gst::GenericFormattedValue>; ) -> Option<gst::GenericFormattedValue>;
} }
@ -160,7 +159,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
fn parent_convert( fn parent_convert(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl gst::format::FormattedValue,
dest_format: gst::Format, dest_format: gst::Format,
) -> Option<gst::GenericFormattedValue> { ) -> Option<gst::GenericFormattedValue> {
unsafe { unsafe {

View file

@ -744,9 +744,9 @@ impl VideoInfo {
} }
#[doc(alias = "gst_video_info_convert")] #[doc(alias = "gst_video_info_convert")]
pub fn convert<U: gst::SpecificFormattedValueFullRange>( pub fn convert<U: gst::format::SpecificFormattedValueFullRange>(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl gst::format::FormattedValue,
) -> Option<U> { ) -> Option<U> {
skip_assert_initialized!(); skip_assert_initialized!();
unsafe { unsafe {
@ -767,7 +767,7 @@ impl VideoInfo {
pub fn convert_generic( pub fn convert_generic(
&self, &self,
src_val: impl gst::FormattedValue, src_val: impl gst::format::FormattedValue,
dest_fmt: gst::Format, dest_fmt: gst::Format,
) -> Option<gst::GenericFormattedValue> { ) -> Option<gst::GenericFormattedValue> {
skip_assert_initialized!(); skip_assert_initialized!();

View file

@ -260,7 +260,7 @@ impl BufferPoolAcquireParams {
}) })
} }
pub fn with_start_stop<T: crate::SpecificFormattedValue>( pub fn with_start_stop<T: crate::format::SpecificFormattedValue>(
start: T, start: T,
stop: T, stop: T,
flags: crate::BufferPoolAcquireFlags, flags: crate::BufferPoolAcquireFlags,

View file

@ -4,6 +4,10 @@ use crate::Element;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use crate::format::{
CompatibleFormattedValue, FormattedValue, SpecificFormattedValueFullRange,
SpecificFormattedValueIntrinsic,
};
use crate::prelude::*; use crate::prelude::*;
use crate::ClockTime; use crate::ClockTime;
use crate::ElementFlags; use crate::ElementFlags;
@ -14,10 +18,7 @@ use crate::Plugin;
use crate::QueryRef; use crate::QueryRef;
use crate::Rank; use crate::Rank;
use crate::State; use crate::State;
use crate::{ use crate::{Format, GenericFormattedValue};
CompatibleFormattedValue, Format, FormattedValue, GenericFormattedValue,
SpecificFormattedValueFullRange,
};
use glib::translate::*; use glib::translate::*;

View file

@ -1,8 +1,10 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use crate::format::{
CompatibleFormattedValue, FormattedValue, FormattedValueIntrinsic, GenericFormattedValue,
};
use crate::structure::*; use crate::structure::*;
use crate::ClockTime; use crate::ClockTime;
use crate::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue};
use std::borrow::Borrow; use std::borrow::Borrow;
use std::cmp; use std::cmp;
@ -550,12 +552,12 @@ declare_concrete_event!(@sticky Segment, T);
impl Segment<Event> { impl Segment<Event> {
#[doc(alias = "gst_event_new_segment")] #[doc(alias = "gst_event_new_segment")]
#[allow(clippy::new_ret_no_self)] #[allow(clippy::new_ret_no_self)]
pub fn new<F: crate::FormattedValueIntrinsic>(segment: &crate::FormattedSegment<F>) -> Event { pub fn new<F: FormattedValueIntrinsic>(segment: &crate::FormattedSegment<F>) -> Event {
skip_assert_initialized!(); skip_assert_initialized!();
Self::builder(segment).build() Self::builder(segment).build()
} }
pub fn builder<F: crate::FormattedValueIntrinsic>( pub fn builder<F: FormattedValueIntrinsic>(
segment: &crate::FormattedSegment<F>, segment: &crate::FormattedSegment<F>,
) -> SegmentBuilder { ) -> SegmentBuilder {
assert_initialized_main_thread!(); assert_initialized_main_thread!();

View file

@ -517,7 +517,7 @@ impl std::iter::Sum for ClockTime {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::{Signed, UnsignedIntoSigned}; use crate::format::{Signed, UnsignedIntoSigned};
use opt_ops::prelude::*; use opt_ops::prelude::*;
const CT_1: ClockTime = ClockTime::from_nseconds(1); const CT_1: ClockTime = ClockTime::from_nseconds(1);

View file

@ -14,7 +14,7 @@ use super::{FormattedValue, SpecificFormattedValue};
/// Consider the following function: /// Consider the following function:
/// ///
/// ```rust /// ```rust
/// # use gstreamer::{ClockTime, CompatibleFormattedValue, FormattedValue, GenericFormattedValue}; /// # use gstreamer::format::{ClockTime, CompatibleFormattedValue, FormattedValue, GenericFormattedValue};
/// fn with_compatible_formats<V: FormattedValue>( /// fn with_compatible_formats<V: FormattedValue>(
/// arg1: V, /// arg1: V,
/// arg2: impl CompatibleFormattedValue<V>, /// arg2: impl CompatibleFormattedValue<V>,

View file

@ -185,7 +185,7 @@ macro_rules! impl_unsigned_int_into_signed(
($typ:ty) => { ($typ:ty) => {
impl crate::format::SignedIntrinsic for $typ {} impl crate::format::SignedIntrinsic for $typ {}
impl crate::UnsignedIntoSigned for $typ { impl crate::format::UnsignedIntoSigned for $typ {
type Signed = crate::Signed<$typ>; type Signed = crate::Signed<$typ>;
fn into_positive(self) -> Self::Signed { fn into_positive(self) -> Self::Signed {
@ -197,7 +197,7 @@ macro_rules! impl_unsigned_int_into_signed(
} }
} }
impl crate::UnsignedIntoSigned for Option<$typ> { impl crate::format::UnsignedIntoSigned for Option<$typ> {
type Signed = Option<crate::Signed<$typ>>; type Signed = Option<crate::Signed<$typ>>;
fn into_positive(self) -> Self::Signed { fn into_positive(self) -> Self::Signed {

View file

@ -49,7 +49,7 @@
//! //!
//! ``` //! ```
//! # use gstreamer as gst; //! # use gstreamer as gst;
//! # use gst::FormattedValue; //! # use gst::format::FormattedValue;
//! # gst::init(); //! # gst::init();
//! # let segment = gst::FormattedSegment::<gst::ClockTime>::new().upcast(); //! # let segment = gst::FormattedSegment::<gst::ClockTime>::new().upcast();
//! // Downcasting the generic `segment` for `gst::ClockTime` use. //! // Downcasting the generic `segment` for `gst::ClockTime` use.

View file

@ -218,12 +218,7 @@ pub use crate::typefind::*;
mod typefind_factory; mod typefind_factory;
pub mod format; pub mod format;
pub use crate::format::{ pub use crate::format::{ClockTime, GenericFormattedValue, GenericSignedFormattedValue, Signed};
ClockTime, CompatibleFormattedValue, FormattedValue, FormattedValueFullRange,
FormattedValueIntrinsic, FormattedValueNoneBuilder, GenericFormattedValue, NoneSignedBuilder,
Signed, SpecificFormattedValue, SpecificFormattedValueFullRange,
SpecificFormattedValueIntrinsic, UnsignedIntoSigned,
};
mod segment; mod segment;
pub use crate::segment::*; pub use crate::segment::*;
@ -344,9 +339,7 @@ pub mod prelude {
pub use muldiv::MulDiv; pub use muldiv::MulDiv;
pub use crate::format::{ pub use crate::format::{
CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic, FormattedValue, FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned,
FormattedValueNoneBuilder, NoneSignedBuilder, SpecificFormattedValue,
SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic, UnsignedIntoSigned,
}; };
pub use crate::utils::Displayable; pub use crate::utils::Displayable;

View file

@ -1,5 +1,6 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use crate::format::{CompatibleFormattedValue, FormattedValue};
use crate::prelude::*; use crate::prelude::*;
use crate::structure::*; use crate::structure::*;
use crate::GenericFormattedValue; use crate::GenericFormattedValue;

View file

@ -1,5 +1,8 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use crate::format::{
FormattedValue, SpecificFormattedValueFullRange, SpecificFormattedValueIntrinsic,
};
use crate::Buffer; use crate::Buffer;
use crate::BufferList; use crate::BufferList;
use crate::Event; use crate::Event;
@ -14,10 +17,7 @@ use crate::PadProbeType;
use crate::Query; use crate::Query;
use crate::QueryRef; use crate::QueryRef;
use crate::StaticPadTemplate; use crate::StaticPadTemplate;
use crate::{ use crate::{Format, GenericFormattedValue};
Format, FormattedValue, GenericFormattedValue, SpecificFormattedValueFullRange,
SpecificFormattedValueIntrinsic,
};
use std::mem; use std::mem;
use std::num::NonZeroU64; use std::num::NonZeroU64;

View file

@ -1,7 +1,7 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use crate::format::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue};
use crate::structure::*; use crate::structure::*;
use crate::{CompatibleFormattedValue, FormattedValue, GenericFormattedValue};
use std::borrow::{Borrow, BorrowMut}; use std::borrow::{Borrow, BorrowMut};
use std::ffi::CStr; use std::ffi::CStr;

View file

@ -5,6 +5,7 @@ use std::ptr;
use glib::translate::{from_glib_full, from_glib_none, mut_override, IntoGlibPtr, ToGlibPtr}; use glib::translate::{from_glib_full, from_glib_none, mut_override, IntoGlibPtr, ToGlibPtr};
use crate::format::FormattedValueIntrinsic;
use crate::Buffer; use crate::Buffer;
use crate::BufferList; use crate::BufferList;
use crate::BufferListRef; use crate::BufferListRef;
@ -12,7 +13,6 @@ use crate::BufferRef;
use crate::Caps; use crate::Caps;
use crate::CapsRef; use crate::CapsRef;
use crate::FormattedSegment; use crate::FormattedSegment;
use crate::FormattedValueIntrinsic;
use crate::Segment; use crate::Segment;
use crate::Structure; use crate::Structure;
use crate::StructureRef; use crate::StructureRef;

View file

@ -1,13 +1,13 @@
// Take a look at the license at the top of the repository in the LICENSE file. // Take a look at the license at the top of the repository in the LICENSE file.
use crate::format::{
CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic,
FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned,
};
use crate::Format; use crate::Format;
use crate::GenericFormattedValue; use crate::GenericFormattedValue;
use crate::SeekFlags; use crate::SeekFlags;
use crate::SeekType; use crate::SeekType;
use crate::{
CompatibleFormattedValue, FormattedValue, FormattedValueFullRange, FormattedValueIntrinsic,
FormattedValueNoneBuilder, NoneSignedBuilder, UnsignedIntoSigned,
};
use glib::translate::*; use glib::translate::*;
use glib::StaticType; use glib::StaticType;
use std::fmt; use std::fmt;

View file

@ -4,14 +4,8 @@ use serde::de;
use serde::de::{Deserialize, Deserializer}; use serde::de::{Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer}; use serde::ser::{Serialize, Serializer};
use crate::Format; use crate::format::{FormattedValue, FormattedValueIntrinsic, SpecificFormattedValueIntrinsic};
use crate::FormattedSegment; use crate::{Format, FormattedSegment, GenericFormattedValue, Segment, SegmentFlags};
use crate::FormattedValue;
use crate::FormattedValueIntrinsic;
use crate::GenericFormattedValue;
use crate::Segment;
use crate::SegmentFlags;
use crate::SpecificFormattedValueIntrinsic;
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde::Serialize, serde::Deserialize)]
struct FormattedSegmentSerde { struct FormattedSegmentSerde {