forked from mirrors/gstreamer-rs
video: Provide manual to_string and display for VideoChromaSite
This function was named wrong before 1.20, and its return transfer type changed from none to full. To provide Note that, when 1.20 Gir files are imported, this `version` override in gstreamer-video/Gir.toml wil come into effect and create a Display trait for us (without version constraint). At that point the manual Display impl should be removed, but the manual to_string implementation remains.
This commit is contained in:
parent
a215610167
commit
85e46f39f3
2 changed files with 22 additions and 4 deletions
|
@ -481,6 +481,11 @@ status = "generate"
|
|||
|
||||
[[object.function]]
|
||||
name = "to_string"
|
||||
rename = "to_str"
|
||||
# Manual function for < v1_20:
|
||||
manual = true
|
||||
# Always generate the trait, without version constraint:
|
||||
version = "1.8"
|
||||
[object.function.return]
|
||||
nullable = false
|
||||
|
||||
|
|
|
@ -175,6 +175,22 @@ impl fmt::Display for crate::VideoColorimetry {
|
|||
}
|
||||
}
|
||||
|
||||
impl crate::VideoChromaSite {
|
||||
pub fn to_str(self) -> glib::GString {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
unsafe {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "v1_20")] {
|
||||
from_glib_full(ffi::gst_video_chroma_site_to_string(self.to_glib()))
|
||||
} else {
|
||||
from_glib_none(ffi::gst_video_chroma_to_string(self.to_glib()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl str::FromStr for crate::VideoChromaSite {
|
||||
type Err = glib::error::BoolError;
|
||||
|
||||
|
@ -201,10 +217,7 @@ impl str::FromStr for crate::VideoChromaSite {
|
|||
|
||||
impl fmt::Display for crate::VideoChromaSite {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let s = unsafe {
|
||||
glib::GString::from_glib_full(ffi::gst_video_chroma_to_string(self.to_glib()))
|
||||
};
|
||||
f.write_str(&s)
|
||||
f.write_str(&self.to_str())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue