mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 01:21:05 +00:00
examples: Fix build
This commit is contained in:
parent
8dd288f2b9
commit
1b288add4c
4 changed files with 23 additions and 28 deletions
|
@ -19,7 +19,6 @@ ges = { package = "gstreamer-editing-services", path = "../gstreamer-editing-ser
|
|||
gst-sdp = { package = "gstreamer-sdp", path = "../gstreamer-sdp", optional = true }
|
||||
gst-rtsp = { package = "gstreamer-rtsp", path = "../gstreamer-rtsp", optional = true }
|
||||
gst-rtsp-server = { package = "gstreamer-rtsp-server", path = "../gstreamer-rtsp-server", optional = true }
|
||||
gst-rtsp-server-sys = { package = "gstreamer-rtsp-server-sys", path = "../gstreamer-rtsp-server/sys", features = ["v1_8"], optional = true }
|
||||
gtk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||
gdk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||
gio = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||
|
@ -28,7 +27,6 @@ derive_more = "0.99.5"
|
|||
futures = "0.3"
|
||||
byte-slice-cast = "1"
|
||||
cairo-rs = { git = "https://github.com/gtk-rs/gtk-rs", features=["use_glib"], optional = true }
|
||||
cairo-sys-rs = { git = "https://github.com/gtk-rs/gtk-rs", features=["use_glib"], optional = true }
|
||||
pango = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||
pangocairo = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||
glutin = { version = "0.21", optional = true }
|
||||
|
@ -46,11 +44,11 @@ gtkvideooverlay = ["gtk", "gdk", "gio"]
|
|||
gtkvideooverlay-x11 = ["gtkvideooverlay"]
|
||||
gtkvideooverlay-quartz = ["gtkvideooverlay"]
|
||||
rtsp-server = ["gst-rtsp-server", "gst-rtsp", "gst-sdp"]
|
||||
rtsp-server-record = ["gst-rtsp-server-sys", "gst-rtsp-server", "gst-rtsp", "gio"]
|
||||
rtsp-server-record = ["gst-rtsp-server", "gst-rtsp", "gio"]
|
||||
v1_10 = ["gst/v1_10"]
|
||||
v1_14 = ["gst/v1_14"]
|
||||
pango-cairo = ["pango", "pangocairo", "cairo-rs"]
|
||||
overlay-composition = ["pango", "pangocairo", "cairo-rs", "cairo-sys-rs" ]
|
||||
overlay-composition = ["pango", "pangocairo", "cairo-rs"]
|
||||
gl = ["gst-gl", "gl_generator", "glutin"]
|
||||
gl-egl = ["gst-gl/egl"]
|
||||
gl-x11 = ["gst-gl/x11"]
|
||||
|
|
|
@ -10,7 +10,6 @@ use gst::prelude::*;
|
|||
mod examples_common;
|
||||
|
||||
mod custom_meta {
|
||||
use gst::gst_sys;
|
||||
use gst::prelude::*;
|
||||
use std::fmt;
|
||||
use std::ptr;
|
||||
|
@ -31,7 +30,7 @@ mod custom_meta {
|
|||
) -> gst::MetaRefMut<Self, gst::meta::Standalone> {
|
||||
unsafe {
|
||||
// First add it: this will store an empty label via custom_meta_init().
|
||||
let meta = gst_sys::gst_buffer_add_meta(
|
||||
let meta = gst::ffi::gst_buffer_add_meta(
|
||||
buffer.as_mut_ptr(),
|
||||
imp::custom_meta_get_info(),
|
||||
ptr::null_mut(),
|
||||
|
@ -72,9 +71,7 @@ mod custom_meta {
|
|||
|
||||
// Actual unsafe implementation of the meta.
|
||||
mod imp {
|
||||
use glib::glib_sys;
|
||||
use glib::translate::*;
|
||||
use gst::gst_sys;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
@ -82,14 +79,14 @@ mod custom_meta {
|
|||
// This is the C type that is actually stored as meta inside the buffers.
|
||||
#[repr(C)]
|
||||
pub struct CustomMeta {
|
||||
parent: gst_sys::GstMeta,
|
||||
parent: gst::ffi::GstMeta,
|
||||
pub(super) label: String,
|
||||
}
|
||||
|
||||
// Function to register the meta API and get a type back.
|
||||
pub(super) fn custom_meta_api_get_type() -> glib::Type {
|
||||
static TYPE: Lazy<glib::Type> = Lazy::new(|| unsafe {
|
||||
let t = from_glib(gst_sys::gst_meta_api_type_register(
|
||||
let t = from_glib(gst::ffi::gst_meta_api_type_register(
|
||||
b"MyCustomMetaAPI\0".as_ptr() as *const _,
|
||||
// We provide no tags here as our meta is just a label and does
|
||||
// not refer to any specific aspect of the buffer
|
||||
|
@ -107,10 +104,10 @@ mod custom_meta {
|
|||
// Initialization function for our meta. This needs to ensure all fields are correctly
|
||||
// initialized. They will contain random memory before.
|
||||
unsafe extern "C" fn custom_meta_init(
|
||||
meta: *mut gst_sys::GstMeta,
|
||||
_params: glib_sys::gpointer,
|
||||
_buffer: *mut gst_sys::GstBuffer,
|
||||
) -> glib_sys::gboolean {
|
||||
meta: *mut gst::ffi::GstMeta,
|
||||
_params: glib::ffi::gpointer,
|
||||
_buffer: *mut gst::ffi::GstBuffer,
|
||||
) -> glib::ffi::gboolean {
|
||||
let meta = &mut *(meta as *mut CustomMeta);
|
||||
|
||||
// Need to initialize all our fields correctly here
|
||||
|
@ -121,8 +118,8 @@ mod custom_meta {
|
|||
|
||||
// Free function for our meta. This needs to free/drop all memory we allocated.
|
||||
unsafe extern "C" fn custom_meta_free(
|
||||
meta: *mut gst_sys::GstMeta,
|
||||
_buffer: *mut gst_sys::GstBuffer,
|
||||
meta: *mut gst::ffi::GstMeta,
|
||||
_buffer: *mut gst::ffi::GstBuffer,
|
||||
) {
|
||||
let meta = &mut *(meta as *mut CustomMeta);
|
||||
|
||||
|
@ -134,12 +131,12 @@ mod custom_meta {
|
|||
// in a way that is compatible with the transformation type. In this case we just always
|
||||
// copy it over.
|
||||
unsafe extern "C" fn custom_meta_transform(
|
||||
dest: *mut gst_sys::GstBuffer,
|
||||
meta: *mut gst_sys::GstMeta,
|
||||
_buffer: *mut gst_sys::GstBuffer,
|
||||
_type_: glib_sys::GQuark,
|
||||
_data: glib_sys::gpointer,
|
||||
) -> glib_sys::gboolean {
|
||||
dest: *mut gst::ffi::GstBuffer,
|
||||
meta: *mut gst::ffi::GstMeta,
|
||||
_buffer: *mut gst::ffi::GstBuffer,
|
||||
_type_: glib::ffi::GQuark,
|
||||
_data: glib::ffi::gpointer,
|
||||
) -> glib::ffi::gboolean {
|
||||
let meta = &mut *(meta as *mut CustomMeta);
|
||||
|
||||
// We simply copy over our meta here. Other metas might have to look at the type
|
||||
|
@ -150,21 +147,21 @@ mod custom_meta {
|
|||
}
|
||||
|
||||
// Register the meta itself with its functions.
|
||||
pub(super) fn custom_meta_get_info() -> *const gst_sys::GstMetaInfo {
|
||||
struct MetaInfo(ptr::NonNull<gst_sys::GstMetaInfo>);
|
||||
pub(super) fn custom_meta_get_info() -> *const gst::ffi::GstMetaInfo {
|
||||
struct MetaInfo(ptr::NonNull<gst::ffi::GstMetaInfo>);
|
||||
unsafe impl Send for MetaInfo {}
|
||||
unsafe impl Sync for MetaInfo {}
|
||||
|
||||
static META_INFO: Lazy<MetaInfo> = Lazy::new(|| unsafe {
|
||||
MetaInfo(
|
||||
ptr::NonNull::new(gst_sys::gst_meta_register(
|
||||
ptr::NonNull::new(gst::ffi::gst_meta_register(
|
||||
custom_meta_api_get_type().to_glib(),
|
||||
b"MyCustomMeta\0".as_ptr() as *const _,
|
||||
mem::size_of::<CustomMeta>(),
|
||||
Some(custom_meta_init),
|
||||
Some(custom_meta_free),
|
||||
Some(custom_meta_transform),
|
||||
) as *mut gst_sys::GstMetaInfo)
|
||||
) as *mut gst::ffi::GstMetaInfo)
|
||||
.expect("Failed to register meta API"),
|
||||
)
|
||||
});
|
||||
|
|
|
@ -242,7 +242,7 @@ fn create_pipeline() -> Result<gst::Pipeline, Error> {
|
|||
drop(cr);
|
||||
unsafe {
|
||||
assert_eq!(
|
||||
cairo_sys::cairo_surface_get_reference_count(surface.to_raw_none()),
|
||||
cairo::ffi::cairo_surface_get_reference_count(surface.to_raw_none()),
|
||||
1
|
||||
);
|
||||
let buffer = glib::translate::from_glib_none(buffer_ptr);
|
||||
|
|
|
@ -84,7 +84,7 @@ fn main_loop() -> Result<(), Error> {
|
|||
// This declares that the user "user" (once authenticated) has a role that
|
||||
// allows them to access and construct media factories.
|
||||
unsafe {
|
||||
gst_rtsp_server_sys::gst_rtsp_media_factory_add_role(
|
||||
gst_rtsp_server::ffi::gst_rtsp_media_factory_add_role(
|
||||
factory.to_glib_none().0,
|
||||
"user".to_glib_none().0,
|
||||
gst_rtsp_server::RTSP_PERM_MEDIA_FACTORY_ACCESS
|
||||
|
|
Loading…
Reference in a new issue