From 06916b23c74dd0034919c457ee00bfef51c3cc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 24 Oct 2021 18:26:33 +0300 Subject: [PATCH] pbutils/encoding_profile: Make the profile builder `new()` functions private and use the `builder()` functions on the main types Also don't re-export the builder types at the crate root. Fewer types to juggle in application code. --- gstreamer-pbutils/src/encoding_profile.rs | 16 ++++++++-------- gstreamer-pbutils/src/lib.rs | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/gstreamer-pbutils/src/encoding_profile.rs b/gstreamer-pbutils/src/encoding_profile.rs index aa8cade2e..b3db642e1 100644 --- a/gstreamer-pbutils/src/encoding_profile.rs +++ b/gstreamer-pbutils/src/encoding_profile.rs @@ -410,7 +410,7 @@ pub struct EncodingAudioProfileBuilder<'a> { declare_encoding_profile_builder_common!(EncodingAudioProfileBuilder); impl<'a> EncodingAudioProfileBuilder<'a> { - pub fn new() -> Self { + fn new() -> Self { EncodingAudioProfileBuilder { base: EncodingProfileBuilderCommonData::new(), restriction: None, @@ -451,7 +451,7 @@ pub struct EncodingVideoProfileBuilder<'a> { declare_encoding_profile_builder_common!(EncodingVideoProfileBuilder); impl<'a> EncodingVideoProfileBuilder<'a> { - pub fn new() -> Self { + fn new() -> Self { EncodingVideoProfileBuilder { base: EncodingProfileBuilderCommonData::new(), restriction: None, @@ -507,7 +507,7 @@ pub struct EncodingContainerProfileBuilder<'a> { declare_encoding_profile_builder_common!(EncodingContainerProfileBuilder); impl<'a> EncodingContainerProfileBuilder<'a> { - pub fn new() -> Self { + fn new() -> Self { EncodingContainerProfileBuilder { base: EncodingProfileBuilderCommonData::new(), profiles: Vec::new(), @@ -576,7 +576,7 @@ mod tests { let restriction = gst::Caps::new_simple("audio/x-raw", &[("format", &"S32LE")]); - let audio_profile = EncodingAudioProfileBuilder::new() + let audio_profile = EncodingAudioProfile::builder() .name(AUDIO_PROFILE_NAME) .description(AUDIO_PROFILE_DESCRIPTION) .format(&caps) @@ -615,7 +615,7 @@ mod tests { let restriction = gst::Caps::new_simple("video/x-raw", &[("format", &"RGBA")]); - let video_profile = EncodingVideoProfileBuilder::new() + let video_profile = EncodingVideoProfile::builder() .name(VIDEO_PROFILE_NAME) .description(VIDEO_PROFILE_DESCRIPTION) .format(&caps) @@ -661,20 +661,20 @@ mod tests { let video_caps = gst::Caps::new_simple("video/x-raw", &[]); let audio_caps = gst::Caps::new_simple("audio/x-raw", &[]); - let video_profile = EncodingVideoProfileBuilder::new() + let video_profile = EncodingVideoProfile::builder() .name(VIDEO_PROFILE_NAME) .description(VIDEO_PROFILE_DESCRIPTION) .format(&video_caps) .build() .unwrap(); - let audio_profile = EncodingAudioProfileBuilder::new() + let audio_profile = EncodingAudioProfile::builder() .name(AUDIO_PROFILE_NAME) .description(AUDIO_PROFILE_DESCRIPTION) .format(&audio_caps) .build() .unwrap(); - let profile = EncodingContainerProfileBuilder::new() + let profile = EncodingContainerProfile::builder() .name(CONTAINER_PROFILE_NAME) .description(CONTAINER_PROFILE_DESCRIPTION) .format(&container_caps) diff --git a/gstreamer-pbutils/src/lib.rs b/gstreamer-pbutils/src/lib.rs index 2bcbb7e15..97d703ea8 100644 --- a/gstreamer-pbutils/src/lib.rs +++ b/gstreamer-pbutils/src/lib.rs @@ -44,8 +44,7 @@ pub mod discoverer_stream_info; mod discoverer_video_info; pub use crate::discoverer_video_info::*; -mod encoding_profile; -pub use crate::encoding_profile::*; +pub mod encoding_profile; pub mod functions; pub use crate::functions::*;