mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-28 20:41:31 +00:00
audio,video: Use autogenerated Display impl
This commit is contained in:
parent
c215acb7f9
commit
9ff39bae6f
4 changed files with 4 additions and 39 deletions
|
@ -24,7 +24,7 @@ fn example_main() {
|
||||||
// from the resulting pipeline.
|
// from the resulting pipeline.
|
||||||
let pipeline = gst::parse_launch(&format!(
|
let pipeline = gst::parse_launch(&format!(
|
||||||
"audiotestsrc name=src ! audio/x-raw,format={},channels=1 ! fakesink",
|
"audiotestsrc name=src ! audio/x-raw,format={},channels=1 ! fakesink",
|
||||||
gst_audio::AUDIO_FORMAT_S16.to_str()
|
gst_audio::AUDIO_FORMAT_S16
|
||||||
))
|
))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let pipeline = pipeline.dynamic_cast::<gst::Pipeline>().unwrap();
|
let pipeline = pipeline.dynamic_cast::<gst::Pipeline>().unwrap();
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::fmt;
|
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use glib::translate::{from_glib, FromGlib, ToGlib, ToGlibPtr};
|
use glib::translate::{from_glib, FromGlib, ToGlib, ToGlibPtr};
|
||||||
|
@ -154,12 +153,6 @@ impl str::FromStr for crate::AudioFormat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for crate::AudioFormat {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
f.write_str((*self).to_str())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PartialOrd for crate::AudioFormat {
|
impl PartialOrd for crate::AudioFormat {
|
||||||
fn partial_cmp(&self, other: &crate::AudioFormat) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &crate::AudioFormat) -> Option<std::cmp::Ordering> {
|
||||||
crate::AudioFormatInfo::from_format(*self)
|
crate::AudioFormatInfo::from_format(*self)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use std::fmt;
|
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
use glib::translate::{from_glib, FromGlib, ToGlib, ToGlibPtr};
|
use glib::translate::{from_glib, FromGlib, ToGlib, ToGlibPtr};
|
||||||
|
@ -350,12 +349,6 @@ impl str::FromStr for crate::VideoFormat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for crate::VideoFormat {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
f.write_str((*self).to_str())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PartialOrd for crate::VideoFormat {
|
impl PartialOrd for crate::VideoFormat {
|
||||||
fn partial_cmp(&self, other: &crate::VideoFormat) -> Option<std::cmp::Ordering> {
|
fn partial_cmp(&self, other: &crate::VideoFormat) -> Option<std::cmp::Ordering> {
|
||||||
crate::VideoFormatInfo::from_format(*self)
|
crate::VideoFormatInfo::from_format(*self)
|
||||||
|
|
|
@ -12,7 +12,10 @@ use glib::translate::{
|
||||||
};
|
};
|
||||||
use gst::prelude::*;
|
use gst::prelude::*;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -956,24 +959,6 @@ impl str::FromStr for crate::VideoFieldOrder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
|
|
||||||
impl fmt::Display for crate::VideoFieldOrder {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
f.write_str((*self).to_str())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl crate::VideoInterlaceMode {
|
|
||||||
pub fn to_str<'a>(self) -> &'a str {
|
|
||||||
unsafe {
|
|
||||||
CStr::from_ptr(ffi::gst_video_interlace_mode_to_string(self.to_glib()))
|
|
||||||
.to_str()
|
|
||||||
.unwrap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl str::FromStr for crate::VideoInterlaceMode {
|
impl str::FromStr for crate::VideoInterlaceMode {
|
||||||
type Err = glib::error::BoolError;
|
type Err = glib::error::BoolError;
|
||||||
|
|
||||||
|
@ -988,12 +973,6 @@ impl str::FromStr for crate::VideoInterlaceMode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for crate::VideoInterlaceMode {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
f.write_str((*self).to_str())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Reference in a new issue