From 02a43819a761c5bcac99b1a5ce07d65045fccf4e Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Fri, 22 May 2020 21:27:56 +0200 Subject: [PATCH] gstreamer-video: expose caps features --- gstreamer-video/src/caps_features.rs | 56 ++++++++++++++++++++++++++++ gstreamer-video/src/lib.rs | 9 +++++ 2 files changed, 65 insertions(+) create mode 100644 gstreamer-video/src/caps_features.rs diff --git a/gstreamer-video/src/caps_features.rs b/gstreamer-video/src/caps_features.rs new file mode 100644 index 000000000..6fa1b7092 --- /dev/null +++ b/gstreamer-video/src/caps_features.rs @@ -0,0 +1,56 @@ +// Copyright (C) 2020 Mathieu Duponchelle +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use gst::CapsFeatures; +use gst_video_sys; +use std::ffi::CStr; + +use once_cell::sync::Lazy; + +pub static CAPS_FEATURE_FORMAT_INTERLACED: Lazy<&'static str> = Lazy::new(|| unsafe { + CStr::from_ptr(gst_video_sys::GST_CAPS_FEATURE_FORMAT_INTERLACED) + .to_str() + .unwrap() +}); +pub static CAPS_FEATURES_FORMAT_INTERLACED: Lazy = + Lazy::new(|| CapsFeatures::new(&[*CAPS_FEATURE_FORMAT_INTERLACED])); + +pub static CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META: Lazy<&'static str> = + Lazy::new(|| unsafe { + CStr::from_ptr(gst_video_sys::GST_CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META) + .to_str() + .unwrap() + }); +pub static CAPS_FEATURES_META_GST_VIDEO_AFFINE_TRANSFORMATION_META: Lazy = + Lazy::new(|| CapsFeatures::new(&[*CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META])); + +pub static CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META: Lazy<&'static str> = + Lazy::new(|| unsafe { + CStr::from_ptr(gst_video_sys::GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META) + .to_str() + .unwrap() + }); +pub static CAPS_FEATURES_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META: Lazy = + Lazy::new(|| CapsFeatures::new(&[*CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META])); + +pub static CAPS_FEATURE_META_GST_VIDEO_META: Lazy<&'static str> = Lazy::new(|| unsafe { + CStr::from_ptr(gst_video_sys::GST_CAPS_FEATURE_META_GST_VIDEO_META) + .to_str() + .unwrap() +}); +pub static CAPS_FEATURES_META_GST_VIDEO_META: Lazy = + Lazy::new(|| CapsFeatures::new(&[*CAPS_FEATURE_META_GST_VIDEO_META])); + +pub static CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION: Lazy<&'static str> = + Lazy::new(|| unsafe { + CStr::from_ptr(gst_video_sys::GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION) + .to_str() + .unwrap() + }); +pub static CAPS_FEATURES_META_GST_VIDEO_OVERLAY_COMPOSITION: Lazy = + Lazy::new(|| CapsFeatures::new(&[*CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION])); diff --git a/gstreamer-video/src/lib.rs b/gstreamer-video/src/lib.rs index 953a71292..b321c355c 100644 --- a/gstreamer-video/src/lib.rs +++ b/gstreamer-video/src/lib.rs @@ -42,6 +42,15 @@ macro_rules! skip_assert_initialized { mod auto; pub use auto::*; +mod caps_features; +pub use caps_features::{ + CAPS_FEATURES_FORMAT_INTERLACED, CAPS_FEATURES_META_GST_VIDEO_AFFINE_TRANSFORMATION_META, + CAPS_FEATURES_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, CAPS_FEATURES_META_GST_VIDEO_META, + CAPS_FEATURES_META_GST_VIDEO_OVERLAY_COMPOSITION, CAPS_FEATURE_FORMAT_INTERLACED, + CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META, + CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, CAPS_FEATURE_META_GST_VIDEO_META, + CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, +}; mod video_format; pub use video_format::*; mod video_format_info;