forked from mirrors/gstreamer-rs
audio/video: Update to v1.20 functions
This commit is contained in:
parent
132477f51f
commit
a215610167
3 changed files with 23 additions and 12 deletions
|
@ -15,6 +15,7 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
cfg-if = "1.0"
|
||||||
bitflags = "1.0"
|
bitflags = "1.0"
|
||||||
ffi = { package = "gstreamer-audio-sys", path = "sys", features = ["v1_8"] }
|
ffi = { package = "gstreamer-audio-sys", path = "sys", features = ["v1_8"] }
|
||||||
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
||||||
|
|
|
@ -175,7 +175,13 @@ impl AudioFormatInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_audio_format_fill_silence(self.0, dest.as_mut_ptr() as *mut _, dest.len())
|
cfg_if::cfg_if! {
|
||||||
|
if #[cfg(any(feature = "v1_20", all(not(doctest), doc)))] {
|
||||||
|
ffi::gst_audio_format_info_fill_silence(self.0, dest.as_mut_ptr() as *mut _, dest.len())
|
||||||
|
} else {
|
||||||
|
ffi::gst_audio_format_fill_silence(self.0, dest.as_mut_ptr() as *mut _, dest.len())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,6 @@ 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::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
@ -183,16 +179,22 @@ impl str::FromStr for crate::VideoChromaSite {
|
||||||
type Err = glib::error::BoolError;
|
type Err = glib::error::BoolError;
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
assert_initialized_main_thread!();
|
skip_assert_initialized!();
|
||||||
|
|
||||||
unsafe {
|
cfg_if::cfg_if! {
|
||||||
let chroma_site: Self =
|
if #[cfg(any(feature = "v1_20", all(not(doctest), doc)))] {
|
||||||
from_glib(ffi::gst_video_chroma_from_string(s.to_glib_none().0));
|
let chroma_site = Self::from_string(s);
|
||||||
if chroma_site.is_empty() {
|
|
||||||
Err(glib::glib_bool_error!("Invalid chroma site"))
|
|
||||||
} else {
|
} else {
|
||||||
Ok(chroma_site)
|
assert_initialized_main_thread!();
|
||||||
|
let chroma_site: Self =
|
||||||
|
unsafe { from_glib(ffi::gst_video_chroma_from_string(s.to_glib_none().0)) };
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if chroma_site.is_empty() {
|
||||||
|
Err(glib::glib_bool_error!("Invalid chroma site"))
|
||||||
|
} else {
|
||||||
|
Ok(chroma_site)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -935,6 +937,8 @@ impl glib::translate::FromGlibPtrFull<*mut ffi::GstVideoInfo> for VideoInfo {
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_12")))]
|
||||||
impl crate::VideoFieldOrder {
|
impl crate::VideoFieldOrder {
|
||||||
pub fn to_str<'a>(self) -> &'a str {
|
pub fn to_str<'a>(self) -> &'a str {
|
||||||
|
use std::ffi::CStr;
|
||||||
|
|
||||||
if self == Self::Unknown {
|
if self == Self::Unknown {
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue