forked from mirrors/gstreamer-rs
Use borrowed miniobject/structure types in more places
When the function does not keep around an additional reference of the value this is correct and more flexible for callers. https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/420 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1152>
This commit is contained in:
parent
5a0152b469
commit
fa5491e6b3
20 changed files with 239 additions and 176 deletions
|
@ -59,14 +59,14 @@ pub fn type_find_helper_for_data_with_extension(
|
|||
#[doc(alias = "gst_type_find_helper_for_buffer")]
|
||||
pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
buf: &gst::Buffer,
|
||||
buf: &gst::BufferRef,
|
||||
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let ret = ffi::gst_type_find_helper_for_buffer(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
buf.to_glib_none().0,
|
||||
mut_override(buf.as_ptr()),
|
||||
prob.as_mut_ptr(),
|
||||
);
|
||||
if ret.is_null() {
|
||||
|
@ -82,7 +82,7 @@ pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
|||
#[doc(alias = "gst_type_find_helper_for_buffer_with_extension")]
|
||||
pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
||||
obj: Option<&P>,
|
||||
buf: &gst::Buffer,
|
||||
buf: &gst::BufferRef,
|
||||
extension: Option<&str>,
|
||||
) -> Result<(gst::Caps, gst::TypeFindProbability), glib::error::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
@ -90,7 +90,7 @@ pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
|||
let mut prob = mem::MaybeUninit::uninit();
|
||||
let ret = ffi::gst_type_find_helper_for_buffer_with_extension(
|
||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||
buf.to_glib_none().0,
|
||||
mut_override(buf.as_ptr()),
|
||||
extension.to_glib_none().0,
|
||||
prob.as_mut_ptr(),
|
||||
);
|
||||
|
|
|
@ -146,11 +146,6 @@ status = "generate"
|
|||
[object.function.return]
|
||||
nullable_return_is_error = "Unsupported caps"
|
||||
|
||||
[[object.function]]
|
||||
name = "codec_utils_opus_create_caps_from_header"
|
||||
[object.function.return]
|
||||
nullable_return_is_error = "Failed to create caps from Opus headers"
|
||||
|
||||
[[object.function]]
|
||||
name = "codec_utils_opus_create_caps"
|
||||
# Manual checks
|
||||
|
@ -171,6 +166,16 @@ status = "generate"
|
|||
# Manual checks
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
name = "codec_utils_opus_create_caps_from_header"
|
||||
# Use &CapsRef
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
pattern = "(codec_utils_caps_get_mime_codec|pb_utils_get_caps_description_flags|pb_utils_get_file_extension_from_caps)"
|
||||
# Use &CapsRef
|
||||
manual = true
|
||||
|
||||
# Plugin installer API needs some manual impls
|
||||
[[object.function]]
|
||||
pattern = "install_plugins.*"
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
// DO NOT EDIT
|
||||
|
||||
use crate::EncodingTarget;
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
use crate::PbUtilsCapsDescriptionFlags;
|
||||
use glib::translate::*;
|
||||
use std::mem;
|
||||
|
||||
|
@ -74,19 +71,6 @@ pub fn codec_utils_caps_from_mime_codec(codecs_field: &str) -> Option<gst::Caps>
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_codec_utils_caps_get_mime_codec")]
|
||||
pub fn codec_utils_caps_get_mime_codec(caps: &gst::Caps) -> Result<glib::GString, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_codec_utils_caps_get_mime_codec(
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
.ok_or_else(|| glib::bool_error!("Unsupported caps"))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_codec_utils_h264_get_level")]
|
||||
pub fn codec_utils_h264_get_level(sps: &[u8]) -> Result<glib::GString, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
@ -200,21 +184,6 @@ pub fn codec_utils_mpeg4video_get_profile(
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_codec_utils_opus_create_caps_from_header")]
|
||||
pub fn codec_utils_opus_create_caps_from_header(
|
||||
header: &gst::Buffer,
|
||||
comments: Option<&gst::Buffer>,
|
||||
) -> Result<gst::Caps, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_codec_utils_opus_create_caps_from_header(
|
||||
header.to_glib_none().0,
|
||||
comments.to_glib_none().0,
|
||||
))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create caps from Opus headers"))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_encoding_list_all_targets")]
|
||||
pub fn encoding_list_all_targets(categoryname: Option<&str>) -> Vec<EncodingTarget> {
|
||||
assert_initialized_main_thread!();
|
||||
|
@ -231,18 +200,6 @@ pub fn encoding_list_available_categories() -> Vec<glib::GString> {
|
|||
unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_available_categories()) }
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_pb_utils_get_caps_description_flags")]
|
||||
pub fn pb_utils_get_caps_description_flags(caps: &gst::Caps) -> PbUtilsCapsDescriptionFlags {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib(ffi::gst_pb_utils_get_caps_description_flags(
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_pb_utils_get_element_description")]
|
||||
pub fn pb_utils_get_element_description(factory_name: &str) -> glib::GString {
|
||||
assert_initialized_main_thread!();
|
||||
|
@ -253,18 +210,6 @@ pub fn pb_utils_get_element_description(factory_name: &str) -> glib::GString {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_pb_utils_get_file_extension_from_caps")]
|
||||
pub fn pb_utils_get_file_extension_from_caps(caps: &gst::Caps) -> Option<glib::GString> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_pb_utils_get_file_extension_from_caps(
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_pb_utils_get_sink_description")]
|
||||
pub fn pb_utils_get_sink_description(protocol: &str) -> glib::GString {
|
||||
assert_initialized_main_thread!();
|
||||
|
|
|
@ -253,6 +253,23 @@ pub fn codec_utils_opus_create_caps(
|
|||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_codec_utils_opus_create_caps_from_header")]
|
||||
pub fn codec_utils_opus_create_caps_from_header(
|
||||
header: &gst::BufferRef,
|
||||
comments: Option<&gst::BufferRef>,
|
||||
) -> Result<gst::Caps, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_codec_utils_opus_create_caps_from_header(
|
||||
mut_override(header.as_ptr()),
|
||||
comments
|
||||
.map(|b| mut_override(b.as_ptr()))
|
||||
.unwrap_or(ptr::null_mut()),
|
||||
))
|
||||
.ok_or_else(|| glib::bool_error!("Failed to create caps from Opus headers"))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_codec_utils_opus_create_header")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn codec_utils_opus_create_header(
|
||||
|
@ -297,7 +314,7 @@ pub fn codec_utils_opus_create_header(
|
|||
|
||||
#[doc(alias = "gst_codec_utils_opus_parse_caps")]
|
||||
pub fn codec_utils_opus_parse_caps(
|
||||
caps: &gst::Caps,
|
||||
caps: &gst::CapsRef,
|
||||
channel_mapping: Option<&mut [u8; 256]>,
|
||||
) -> Result<(u32, u8, u8, u8, u8), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
@ -340,7 +357,7 @@ pub fn codec_utils_opus_parse_caps(
|
|||
#[doc(alias = "gst_codec_utils_opus_parse_header")]
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn codec_utils_opus_parse_header(
|
||||
header: &gst::Buffer,
|
||||
header: &gst::BufferRef,
|
||||
channel_mapping: Option<&mut [u8; 256]>,
|
||||
) -> Result<(u32, u8, u8, u8, u8, u16, i16), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
|
@ -385,3 +402,40 @@ pub fn codec_utils_opus_parse_header(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_codec_utils_caps_get_mime_codec")]
|
||||
pub fn codec_utils_caps_get_mime_codec(
|
||||
caps: &gst::CapsRef,
|
||||
) -> Result<glib::GString, glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
Option::<_>::from_glib_full(ffi::gst_codec_utils_caps_get_mime_codec(mut_override(
|
||||
caps.as_ptr(),
|
||||
)))
|
||||
.ok_or_else(|| glib::bool_error!("Unsupported caps"))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_pb_utils_get_caps_description_flags")]
|
||||
pub fn pb_utils_get_caps_description_flags(
|
||||
caps: &gst::CapsRef,
|
||||
) -> crate::PbUtilsCapsDescriptionFlags {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib(ffi::gst_pb_utils_get_caps_description_flags(caps.as_ptr())) }
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_pb_utils_get_file_extension_from_caps")]
|
||||
pub fn pb_utils_get_file_extension_from_caps(caps: &gst::CapsRef) -> Option<glib::GString> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_pb_utils_get_file_extension_from_caps(
|
||||
caps.as_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,6 +123,11 @@ final_type = true
|
|||
[object.function.return]
|
||||
bool_return_is_error = "Failed to set visualization"
|
||||
|
||||
[[object.function]]
|
||||
name = "get_video_snapshot"
|
||||
# &StructureRef
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstPlay.PlayAudioInfo"
|
||||
status = "generate"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
use crate::PlayAudioInfo;
|
||||
use crate::PlayColorBalanceType;
|
||||
use crate::PlayMediaInfo;
|
||||
use crate::PlaySnapshotFormat;
|
||||
use crate::PlaySubtitleInfo;
|
||||
use crate::PlayVideoInfo;
|
||||
use crate::PlayVideoRenderer;
|
||||
|
@ -157,22 +156,6 @@ impl Play {
|
|||
unsafe { from_glib_full(ffi::gst_play_get_uri(self.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_play_get_video_snapshot")]
|
||||
#[doc(alias = "get_video_snapshot")]
|
||||
pub fn video_snapshot(
|
||||
&self,
|
||||
format: PlaySnapshotFormat,
|
||||
config: Option<&gst::Structure>,
|
||||
) -> Option<gst::Sample> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_play_get_video_snapshot(
|
||||
self.to_glib_none().0,
|
||||
format.into_glib(),
|
||||
config.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_play_get_volume")]
|
||||
#[doc(alias = "get_volume")]
|
||||
pub fn volume(&self) -> f64 {
|
||||
|
|
|
@ -19,4 +19,20 @@ impl Play {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_play_get_video_snapshot")]
|
||||
#[doc(alias = "get_video_snapshot")]
|
||||
pub fn video_snapshot(
|
||||
&self,
|
||||
format: crate::PlaySnapshotFormat,
|
||||
config: Option<&gst::StructureRef>,
|
||||
) -> Option<gst::Sample> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_play_get_video_snapshot(
|
||||
self.to_glib_none().0,
|
||||
format.into_glib(),
|
||||
mut_override(config.map(|c| c.as_ptr()).unwrap_or(std::ptr::null())),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,6 +176,11 @@ final_type = true
|
|||
name = "subtitle-video-offset"
|
||||
version = "1.16"
|
||||
|
||||
[[object.function]]
|
||||
name = "get_video_snapshot"
|
||||
# Use &StructureRef
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstPlayer.PlayerAudioInfo"
|
||||
status = "generate"
|
||||
|
|
|
@ -7,7 +7,6 @@ use crate::PlayerAudioInfo;
|
|||
use crate::PlayerColorBalanceType;
|
||||
use crate::PlayerMediaInfo;
|
||||
use crate::PlayerSignalDispatcher;
|
||||
use crate::PlayerSnapshotFormat;
|
||||
use crate::PlayerState;
|
||||
use crate::PlayerSubtitleInfo;
|
||||
use crate::PlayerVideoInfo;
|
||||
|
@ -167,22 +166,6 @@ impl Player {
|
|||
unsafe { from_glib_full(ffi::gst_player_get_uri(self.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_player_get_video_snapshot")]
|
||||
#[doc(alias = "get_video_snapshot")]
|
||||
pub fn video_snapshot(
|
||||
&self,
|
||||
format: PlayerSnapshotFormat,
|
||||
config: Option<&gst::Structure>,
|
||||
) -> Option<gst::Sample> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_player_get_video_snapshot(
|
||||
self.to_glib_none().0,
|
||||
format.into_glib(),
|
||||
config.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_player_get_volume")]
|
||||
#[doc(alias = "get_volume")]
|
||||
pub fn volume(&self) -> f64 {
|
||||
|
|
|
@ -78,6 +78,22 @@ impl Player {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_player_get_video_snapshot")]
|
||||
#[doc(alias = "get_video_snapshot")]
|
||||
pub fn video_snapshot(
|
||||
&self,
|
||||
format: crate::PlayerSnapshotFormat,
|
||||
config: Option<&gst::StructureRef>,
|
||||
) -> Option<gst::Sample> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::gst_player_get_video_snapshot(
|
||||
self.to_glib_none().0,
|
||||
format.into_glib(),
|
||||
mut_override(config.map(|c| c.as_ptr()).unwrap_or(std::ptr::null())),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" fn duration_changed_trampoline<
|
||||
|
|
|
@ -610,15 +610,12 @@ impl SDPMediaRef {
|
|||
|
||||
#[doc(alias = "gst_sdp_media_set_media_from_caps")]
|
||||
pub fn set_media_from_caps(
|
||||
caps: &gst::Caps,
|
||||
caps: &gst::CapsRef,
|
||||
media: &mut SDPMedia,
|
||||
) -> Result<(), glib::BoolError> {
|
||||
assert_initialized_main_thread!();
|
||||
let result = unsafe {
|
||||
ffi::gst_sdp_media_set_media_from_caps(
|
||||
caps.to_glib_none().0,
|
||||
media.to_glib_none_mut().0,
|
||||
)
|
||||
ffi::gst_sdp_media_set_media_from_caps(caps.as_ptr(), media.to_glib_none_mut().0)
|
||||
};
|
||||
match result {
|
||||
ffi::GST_SDP_OK => Ok(()),
|
||||
|
|
|
@ -29,7 +29,6 @@ generate = [
|
|||
"GstVideo.VideoAggregatorParallelConvertPad",
|
||||
"GstVideo.VideoAlphaMode",
|
||||
"GstVideo.VideoBufferPool",
|
||||
"GstVideo.VideoCaptionType",
|
||||
"GstVideo.VideoChromaMode",
|
||||
"GstVideo.VideoDecoderRequestSyncPointFlags",
|
||||
"GstVideo.VideoDitherMethod",
|
||||
|
@ -364,6 +363,14 @@ status = "generate"
|
|||
name = "last"
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVideo.VideoCaptionType"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
name = "from_caps"
|
||||
# Use &CapsRef
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVideo.VideoChromaSite"
|
||||
status = "generate"
|
||||
|
@ -717,6 +724,11 @@ status = "generate"
|
|||
[object.function.return]
|
||||
bool_return_is_error = "Failed to set vertical flipping"
|
||||
|
||||
[[object.function]]
|
||||
name = "from_tag"
|
||||
# Use &TagListRef and move to the enum
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "GstVideo.VideoOverlay"
|
||||
status = "generate"
|
||||
|
|
|
@ -803,12 +803,6 @@ pub enum VideoCaptionType {
|
|||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||
impl VideoCaptionType {
|
||||
#[doc(alias = "gst_video_caption_type_from_caps")]
|
||||
pub fn from_caps(caps: &gst::Caps) -> VideoCaptionType {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib(ffi::gst_video_caption_type_from_caps(caps.to_glib_none().0)) }
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_video_caption_type_to_caps")]
|
||||
pub fn to_caps(self) -> gst::Caps {
|
||||
assert_initialized_main_thread!();
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
use crate::VideoOrientationMethod;
|
||||
use glib::object::IsA;
|
||||
use glib::translate::*;
|
||||
use std::mem;
|
||||
|
@ -21,25 +18,6 @@ glib::wrapper! {
|
|||
|
||||
impl VideoOrientation {
|
||||
pub const NONE: Option<&'static VideoOrientation> = None;
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_video_orientation_from_tag")]
|
||||
pub fn from_tag(taglist: &gst::TagList) -> Option<VideoOrientationMethod> {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe {
|
||||
let mut method = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_video_orientation_from_tag(
|
||||
taglist.to_glib_none().0,
|
||||
method.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(from_glib(method.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for VideoOrientation {}
|
||||
|
|
48
gstreamer-video/src/enums.rs
Normal file
48
gstreamer-video/src/enums.rs
Normal file
|
@ -0,0 +1,48 @@
|
|||
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||
use glib::translate::*;
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||
use crate::VideoCaptionType;
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
use crate::VideoOrientationMethod;
|
||||
|
||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||
impl VideoCaptionType {
|
||||
#[doc(alias = "gst_video_caption_type_from_caps")]
|
||||
pub fn from_caps(caps: &gst::CapsRef) -> VideoCaptionType {
|
||||
assert_initialized_main_thread!();
|
||||
unsafe { from_glib(ffi::gst_video_caption_type_from_caps(caps.as_ptr())) }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
impl VideoOrientationMethod {
|
||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||
#[doc(alias = "gst_video_orientation_from_tag")]
|
||||
pub fn from_tag(taglist: &gst::TagListRef) -> Option<VideoOrientationMethod> {
|
||||
assert_initialized_main_thread!();
|
||||
|
||||
unsafe {
|
||||
use std::mem;
|
||||
|
||||
let mut method = mem::MaybeUninit::uninit();
|
||||
let ret = from_glib(ffi::gst_video_orientation_from_tag(
|
||||
mut_override(taglist.as_ptr()),
|
||||
method.as_mut_ptr(),
|
||||
));
|
||||
if ret {
|
||||
Some(from_glib(method.assume_init()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,6 +36,8 @@ macro_rules! skip_assert_initialized {
|
|||
mod auto;
|
||||
pub use crate::auto::*;
|
||||
|
||||
mod enums;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
mod flag_serde;
|
||||
|
||||
|
|
|
@ -1313,6 +1313,26 @@ final_type = true
|
|||
# Use str as return type
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
name = "can_sink_all_caps"
|
||||
# Use &CapsRef
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
name = "can_src_all_caps"
|
||||
# Use &CapsRef
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
name = "can_sink_any_caps"
|
||||
# Use &CapsRef
|
||||
manual = true
|
||||
|
||||
[[object.function]]
|
||||
name = "can_src_any_caps"
|
||||
# Use &CapsRef
|
||||
manual = true
|
||||
|
||||
[[object]]
|
||||
name = "Gst.ElementFactoryListType"
|
||||
status = "manual"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||
// DO NOT EDIT
|
||||
|
||||
use crate::Caps;
|
||||
use crate::Object;
|
||||
use crate::PluginFeature;
|
||||
use crate::URIType;
|
||||
|
@ -19,46 +18,6 @@ glib::wrapper! {
|
|||
}
|
||||
|
||||
impl ElementFactory {
|
||||
#[doc(alias = "gst_element_factory_can_sink_all_caps")]
|
||||
pub fn can_sink_all_caps(&self, caps: &Caps) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_sink_all_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_can_sink_any_caps")]
|
||||
pub fn can_sink_any_caps(&self, caps: &Caps) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_sink_any_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_can_src_all_caps")]
|
||||
pub fn can_src_all_caps(&self, caps: &Caps) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_src_all_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_can_src_any_caps")]
|
||||
pub fn can_src_any_caps(&self, caps: &Caps) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_src_any_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.to_glib_none().0,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_get_element_type")]
|
||||
#[doc(alias = "get_element_type")]
|
||||
pub fn element_type(&self) -> glib::types::Type {
|
||||
|
|
|
@ -8,6 +8,7 @@ use crate::ELEMENT_METADATA_KLASS;
|
|||
use crate::ELEMENT_METADATA_LONGNAME;
|
||||
use std::ffi::CStr;
|
||||
|
||||
use crate::CapsRef;
|
||||
use crate::Element;
|
||||
use crate::ElementFactory;
|
||||
use crate::Rank;
|
||||
|
@ -180,6 +181,46 @@ impl ElementFactory {
|
|||
pub fn icon_name(&self) -> Option<&str> {
|
||||
self.metadata(&ELEMENT_METADATA_ICON_NAME)
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_can_sink_all_caps")]
|
||||
pub fn can_sink_all_caps(&self, caps: &CapsRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_sink_all_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.as_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_can_sink_any_caps")]
|
||||
pub fn can_sink_any_caps(&self, caps: &CapsRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_sink_any_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.as_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_can_src_all_caps")]
|
||||
pub fn can_src_all_caps(&self, caps: &CapsRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_src_all_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.as_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[doc(alias = "gst_element_factory_can_src_any_caps")]
|
||||
pub fn can_src_any_caps(&self, caps: &CapsRef) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::gst_element_factory_can_src_any_caps(
|
||||
self.to_glib_none().0,
|
||||
caps.as_ptr(),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rustdoc-stripper-ignore-next
|
||||
|
|
|
@ -3,7 +3,7 @@ use gst::prelude::*;
|
|||
#[path = "../tutorials-common.rs"]
|
||||
mod tutorials_common;
|
||||
|
||||
fn print_caps(caps: &gst::Caps, prefix: &str) {
|
||||
fn print_caps(caps: &gst::CapsRef, prefix: &str) {
|
||||
if caps.is_any() {
|
||||
println!("{}ANY", prefix);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue