mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-23 00:26:31 +00:00
video: video-info: fix Display implementations
We were calling the blanket implementation of ToString, which is using Display, rather than our own, resulting in an infinite recursion. Also a couple of to_string() implementation were using the wrong glib conversion as they actually return a 'const gchar *'.
This commit is contained in:
parent
e81b5717e9
commit
cd16337874
1 changed files with 15 additions and 5 deletions
|
@ -188,7 +188,7 @@ impl fmt::Debug for ::VideoColorimetry {
|
|||
|
||||
impl fmt::Display for ::VideoColorimetry {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
f.write_str(&self.to_string())
|
||||
f.write_str(&::VideoColorimetry::to_string(self))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -787,7 +787,7 @@ impl glib::translate::FromGlibPtrFull<*mut gst_video_sys::GstVideoInfo> for Vide
|
|||
impl ::VideoFieldOrder {
|
||||
pub fn to_string(self) -> String {
|
||||
unsafe {
|
||||
from_glib_full(gst_video_sys::gst_video_field_order_to_string(
|
||||
from_glib_none(gst_video_sys::gst_video_field_order_to_string(
|
||||
self.to_glib(),
|
||||
))
|
||||
}
|
||||
|
@ -817,14 +817,14 @@ impl str::FromStr for ::VideoFieldOrder {
|
|||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||
impl fmt::Display for ::VideoFieldOrder {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
f.write_str(&self.to_string())
|
||||
f.write_str(&::VideoFieldOrder::to_string(*self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ::VideoInterlaceMode {
|
||||
pub fn to_string(self) -> String {
|
||||
unsafe {
|
||||
from_glib_full(gst_video_sys::gst_video_interlace_mode_to_string(
|
||||
from_glib_none(gst_video_sys::gst_video_interlace_mode_to_string(
|
||||
self.to_glib(),
|
||||
))
|
||||
}
|
||||
|
@ -852,7 +852,7 @@ impl str::FromStr for ::VideoInterlaceMode {
|
|||
|
||||
impl fmt::Display for ::VideoInterlaceMode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
f.write_str(&self.to_string())
|
||||
f.write_str(&::VideoInterlaceMode::to_string(*self))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -951,4 +951,14 @@ mod tests {
|
|||
assert_eq!(info.stride(), [1928, 1928]);
|
||||
assert_eq!(info.offset(), [0, 2082240]);
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_12", feature = "dox"))]
|
||||
#[test]
|
||||
fn test_display() {
|
||||
gst::init().unwrap();
|
||||
|
||||
format!("{}", ::VideoColorimetry::from_string("sRGB").unwrap());
|
||||
format!("{}", ::VideoFieldOrder::TopFieldFirst);
|
||||
format!("{}", ::VideoInterlaceMode::Progressive);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue