Ignore various endianness-dependent constants/enum values in the sys bindings

They can't be used verbatim and need special handling depending on the
target platform's endianness.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1270>
This commit is contained in:
Sebastian Dröge 2023-05-29 14:23:07 +03:00
parent 5f16254059
commit 130805fc50
9 changed files with 54 additions and 36 deletions

View file

@ -37,6 +37,52 @@ status = "generate"
name = "reorder_channels" name = "reorder_channels"
version = "1.0" version = "1.0"
[[object]]
name = "GstAudio.AudioFormat"
status = "generate"
[[object.member]]
name = "f32"
alias = true
[[object.member]]
name = "f64"
alias = true
[[object.member]]
name = "s16"
alias = true
[[object.member]]
name = "s18"
alias = true
[[object.member]]
name = "s20"
alias = true
[[object.member]]
name = "s24"
alias = true
[[object.member]]
name = "s24_32"
alias = true
[[object.member]]
name = "s32"
alias = true
[[object.member]]
name = "u16"
alias = true
[[object.member]]
name = "u18"
alias = true
[[object.member]]
name = "u20"
alias = true
[[object.member]]
name = "u24"
alias = true
[[object.member]]
name = "u24_32"
alias = true
[[object.member]]
name = "u32"
alias = true
[[object]] [[object]]
name = "GstAudio.*" name = "GstAudio.*"
status = "generate" status = "generate"

View file

@ -118,20 +118,6 @@ pub const GST_AUDIO_FORMAT_F32LE: GstAudioFormat = 28;
pub const GST_AUDIO_FORMAT_F32BE: GstAudioFormat = 29; pub const GST_AUDIO_FORMAT_F32BE: GstAudioFormat = 29;
pub const GST_AUDIO_FORMAT_F64LE: GstAudioFormat = 30; pub const GST_AUDIO_FORMAT_F64LE: GstAudioFormat = 30;
pub const GST_AUDIO_FORMAT_F64BE: GstAudioFormat = 31; pub const GST_AUDIO_FORMAT_F64BE: GstAudioFormat = 31;
pub const GST_AUDIO_FORMAT_S16: GstAudioFormat = 4;
pub const GST_AUDIO_FORMAT_U16: GstAudioFormat = 6;
pub const GST_AUDIO_FORMAT_S24_32: GstAudioFormat = 8;
pub const GST_AUDIO_FORMAT_U24_32: GstAudioFormat = 10;
pub const GST_AUDIO_FORMAT_S32: GstAudioFormat = 12;
pub const GST_AUDIO_FORMAT_U32: GstAudioFormat = 14;
pub const GST_AUDIO_FORMAT_S24: GstAudioFormat = 16;
pub const GST_AUDIO_FORMAT_U24: GstAudioFormat = 18;
pub const GST_AUDIO_FORMAT_S20: GstAudioFormat = 20;
pub const GST_AUDIO_FORMAT_U20: GstAudioFormat = 22;
pub const GST_AUDIO_FORMAT_S18: GstAudioFormat = 24;
pub const GST_AUDIO_FORMAT_U18: GstAudioFormat = 26;
pub const GST_AUDIO_FORMAT_F32: GstAudioFormat = 28;
pub const GST_AUDIO_FORMAT_F64: GstAudioFormat = 30;
pub type GstAudioLayout = c_int; pub type GstAudioLayout = c_int;
pub const GST_AUDIO_LAYOUT_INTERLEAVED: GstAudioLayout = 0; pub const GST_AUDIO_LAYOUT_INTERLEAVED: GstAudioLayout = 0;

View file

@ -180,8 +180,14 @@ status = "generate"
name = "GL_COLOR_CONVERT_FORMATS" name = "GL_COLOR_CONVERT_FORMATS"
ignore = true ignore = true
[[object.constant]] [[object.constant]]
name = "GL_COLOR_CONVERT_EXT_FORMATS"
ignore = true
[[object.constant]]
name = "GL_MEMORY_VIDEO_FORMATS_STR" name = "GL_MEMORY_VIDEO_FORMATS_STR"
ignore = true ignore = true
[[object.constant]]
name = "GL_MEMORY_VIDEO_EXT_FORMATS"
ignore = true
# the below need manual bindings # the below need manual bindings
[[object.function]] [[object.function]]

View file

@ -43,9 +43,6 @@ pub static GL_BASE_MEMORY_ALLOCATOR_NAME: &GStr =
#[doc(alias = "GST_GL_BUFFER_ALLOCATOR_NAME")] #[doc(alias = "GST_GL_BUFFER_ALLOCATOR_NAME")]
pub static GL_BUFFER_ALLOCATOR_NAME: &GStr = pub static GL_BUFFER_ALLOCATOR_NAME: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_BUFFER_ALLOCATOR_NAME) }; unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_BUFFER_ALLOCATOR_NAME) };
#[doc(alias = "GST_GL_COLOR_CONVERT_EXT_FORMATS")]
pub static GL_COLOR_CONVERT_EXT_FORMATS: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_COLOR_CONVERT_EXT_FORMATS) };
#[doc(alias = "GST_GL_COLOR_CONVERT_VIDEO_CAPS")] #[doc(alias = "GST_GL_COLOR_CONVERT_VIDEO_CAPS")]
pub static GL_COLOR_CONVERT_VIDEO_CAPS: &GStr = pub static GL_COLOR_CONVERT_VIDEO_CAPS: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_COLOR_CONVERT_VIDEO_CAPS) }; unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_COLOR_CONVERT_VIDEO_CAPS) };
@ -78,9 +75,6 @@ pub static GL_MEMORY_ALLOCATOR_NAME: &GStr =
#[doc(alias = "GST_GL_MEMORY_PBO_ALLOCATOR_NAME")] #[doc(alias = "GST_GL_MEMORY_PBO_ALLOCATOR_NAME")]
pub static GL_MEMORY_PBO_ALLOCATOR_NAME: &GStr = pub static GL_MEMORY_PBO_ALLOCATOR_NAME: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_MEMORY_PBO_ALLOCATOR_NAME) }; unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_MEMORY_PBO_ALLOCATOR_NAME) };
#[doc(alias = "GST_GL_MEMORY_VIDEO_EXT_FORMATS")]
pub static GL_MEMORY_VIDEO_EXT_FORMATS: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_MEMORY_VIDEO_EXT_FORMATS) };
#[doc(alias = "GST_GL_RENDERBUFFER_ALLOCATOR_NAME")] #[doc(alias = "GST_GL_RENDERBUFFER_ALLOCATOR_NAME")]
pub static GL_RENDERBUFFER_ALLOCATOR_NAME: &GStr = pub static GL_RENDERBUFFER_ALLOCATOR_NAME: &GStr =
unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_RENDERBUFFER_ALLOCATOR_NAME) }; unsafe { GStr::from_utf8_with_nul_unchecked(ffi::GST_GL_RENDERBUFFER_ALLOCATOR_NAME) };

View file

@ -99,7 +99,6 @@ pub use self::constants::GL_API_OPENGL3_NAME;
pub use self::constants::GL_API_OPENGL_NAME; pub use self::constants::GL_API_OPENGL_NAME;
pub use self::constants::GL_BASE_MEMORY_ALLOCATOR_NAME; pub use self::constants::GL_BASE_MEMORY_ALLOCATOR_NAME;
pub use self::constants::GL_BUFFER_ALLOCATOR_NAME; pub use self::constants::GL_BUFFER_ALLOCATOR_NAME;
pub use self::constants::GL_COLOR_CONVERT_EXT_FORMATS;
pub use self::constants::GL_COLOR_CONVERT_VIDEO_CAPS; pub use self::constants::GL_COLOR_CONVERT_VIDEO_CAPS;
#[cfg(feature = "v1_20")] #[cfg(feature = "v1_20")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))] #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
@ -112,7 +111,6 @@ pub use self::constants::GL_CONTEXT_TYPE_WGL;
pub use self::constants::GL_DISPLAY_CONTEXT_TYPE; pub use self::constants::GL_DISPLAY_CONTEXT_TYPE;
pub use self::constants::GL_MEMORY_ALLOCATOR_NAME; pub use self::constants::GL_MEMORY_ALLOCATOR_NAME;
pub use self::constants::GL_MEMORY_PBO_ALLOCATOR_NAME; pub use self::constants::GL_MEMORY_PBO_ALLOCATOR_NAME;
pub use self::constants::GL_MEMORY_VIDEO_EXT_FORMATS;
pub use self::constants::GL_RENDERBUFFER_ALLOCATOR_NAME; pub use self::constants::GL_RENDERBUFFER_ALLOCATOR_NAME;
pub use self::constants::GL_TEXTURE_TARGET_2D_STR; pub use self::constants::GL_TEXTURE_TARGET_2D_STR;
pub use self::constants::GL_TEXTURE_TARGET_EXTERNAL_OES_STR; pub use self::constants::GL_TEXTURE_TARGET_EXTERNAL_OES_STR;

View file

@ -17,7 +17,9 @@ extra_versions = [
ignore = [ ignore = [
"GstGL.GL_COLOR_CONVERT_VIDEO_CAPS", "GstGL.GL_COLOR_CONVERT_VIDEO_CAPS",
"GstGL.GL_COLOR_CONVERT_FORMATS", "GstGL.GL_COLOR_CONVERT_FORMATS",
"GstGL.GL_COLOR_CONVERT_EXT_FORMATS",
"GstGL.GL_MEMORY_VIDEO_FORMATS_STR", "GstGL.GL_MEMORY_VIDEO_FORMATS_STR",
"GstGL.GL_MEMORY_VIDEO_EXT_FORMATS",
] ]
external_libraries = [ external_libraries = [

View file

@ -139,8 +139,6 @@ pub const GST_GL_API_OPENGL3_NAME: &[u8] = b"opengl3\0";
pub const GST_GL_API_OPENGL_NAME: &[u8] = b"opengl\0"; pub const GST_GL_API_OPENGL_NAME: &[u8] = b"opengl\0";
pub const GST_GL_BASE_MEMORY_ALLOCATOR_NAME: &[u8] = b"GLBaseMemory\0"; pub const GST_GL_BASE_MEMORY_ALLOCATOR_NAME: &[u8] = b"GLBaseMemory\0";
pub const GST_GL_BUFFER_ALLOCATOR_NAME: &[u8] = b"GLBuffer\0"; pub const GST_GL_BUFFER_ALLOCATOR_NAME: &[u8] = b"GLBuffer\0";
pub const GST_GL_COLOR_CONVERT_EXT_FORMATS: &[u8] =
b", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE\0";
pub const GST_GL_CONFIG_STRUCTURE_NAME: &[u8] = b"gst-gl-context-config\0"; pub const GST_GL_CONFIG_STRUCTURE_NAME: &[u8] = b"gst-gl-context-config\0";
pub const GST_GL_CONTEXT_TYPE_CGL: &[u8] = b"gst.gl.context.CGL\0"; pub const GST_GL_CONTEXT_TYPE_CGL: &[u8] = b"gst.gl.context.CGL\0";
pub const GST_GL_CONTEXT_TYPE_EAGL: &[u8] = b"gst.gl.context.EAGL\0"; pub const GST_GL_CONTEXT_TYPE_EAGL: &[u8] = b"gst.gl.context.EAGL\0";
@ -150,8 +148,6 @@ pub const GST_GL_CONTEXT_TYPE_WGL: &[u8] = b"gst.gl.context.WGL\0";
pub const GST_GL_DISPLAY_CONTEXT_TYPE: &[u8] = b"gst.gl.GLDisplay\0"; pub const GST_GL_DISPLAY_CONTEXT_TYPE: &[u8] = b"gst.gl.GLDisplay\0";
pub const GST_GL_MEMORY_ALLOCATOR_NAME: &[u8] = b"GLMemory\0"; pub const GST_GL_MEMORY_ALLOCATOR_NAME: &[u8] = b"GLMemory\0";
pub const GST_GL_MEMORY_PBO_ALLOCATOR_NAME: &[u8] = b"GLMemoryPBO\0"; pub const GST_GL_MEMORY_PBO_ALLOCATOR_NAME: &[u8] = b"GLMemoryPBO\0";
pub const GST_GL_MEMORY_VIDEO_EXT_FORMATS: &[u8] =
b", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE\0";
pub const GST_GL_RENDERBUFFER_ALLOCATOR_NAME: &[u8] = b"GLRenderbuffer\0"; pub const GST_GL_RENDERBUFFER_ALLOCATOR_NAME: &[u8] = b"GLRenderbuffer\0";
pub const GST_GL_TEXTURE_TARGET_2D_STR: &[u8] = b"2D\0"; pub const GST_GL_TEXTURE_TARGET_2D_STR: &[u8] = b"2D\0";
pub const GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR: &[u8] = b"external-oes\0"; pub const GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR: &[u8] = b"external-oes\0";

View file

@ -796,10 +796,6 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
), ),
("(guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD", "2097152"), ("(guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD", "2097152"),
("GST_GL_BUFFER_ALLOCATOR_NAME", "GLBuffer"), ("GST_GL_BUFFER_ALLOCATOR_NAME", "GLBuffer"),
(
"GST_GL_COLOR_CONVERT_EXT_FORMATS",
", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE",
),
("(gint) GST_GL_CONFIG_CAVEAT_NONE", "0"), ("(gint) GST_GL_CONFIG_CAVEAT_NONE", "0"),
("(gint) GST_GL_CONFIG_CAVEAT_NON_CONFORMANT", "2"), ("(gint) GST_GL_CONFIG_CAVEAT_NON_CONFORMANT", "2"),
("(gint) GST_GL_CONFIG_CAVEAT_SLOW", "1"), ("(gint) GST_GL_CONFIG_CAVEAT_SLOW", "1"),
@ -840,10 +836,6 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_GL_LUMINANCE_ALPHA", "6410"), ("(gint) GST_GL_LUMINANCE_ALPHA", "6410"),
("GST_GL_MEMORY_ALLOCATOR_NAME", "GLMemory"), ("GST_GL_MEMORY_ALLOCATOR_NAME", "GLMemory"),
("GST_GL_MEMORY_PBO_ALLOCATOR_NAME", "GLMemoryPBO"), ("GST_GL_MEMORY_PBO_ALLOCATOR_NAME", "GLMemoryPBO"),
(
"GST_GL_MEMORY_VIDEO_EXT_FORMATS",
", BGR10A2_LE, RGB10A2_LE, P010_10LE, P012_LE, P016_LE, Y212_LE, Y412_LE",
),
("(guint) GST_GL_PLATFORM_ANY", "4294967295"), ("(guint) GST_GL_PLATFORM_ANY", "4294967295"),
("(guint) GST_GL_PLATFORM_CGL", "8"), ("(guint) GST_GL_PLATFORM_CGL", "8"),
("(guint) GST_GL_PLATFORM_EAGL", "16"), ("(guint) GST_GL_PLATFORM_EAGL", "16"),

View file

@ -84,7 +84,6 @@ int main() {
PRINT_CONSTANT((guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD); PRINT_CONSTANT((guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
PRINT_CONSTANT((guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD); PRINT_CONSTANT((guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
PRINT_CONSTANT(GST_GL_BUFFER_ALLOCATOR_NAME); PRINT_CONSTANT(GST_GL_BUFFER_ALLOCATOR_NAME);
PRINT_CONSTANT(GST_GL_COLOR_CONVERT_EXT_FORMATS);
PRINT_CONSTANT((gint) GST_GL_CONFIG_CAVEAT_NONE); PRINT_CONSTANT((gint) GST_GL_CONFIG_CAVEAT_NONE);
PRINT_CONSTANT((gint) GST_GL_CONFIG_CAVEAT_NON_CONFORMANT); PRINT_CONSTANT((gint) GST_GL_CONFIG_CAVEAT_NON_CONFORMANT);
PRINT_CONSTANT((gint) GST_GL_CONFIG_CAVEAT_SLOW); PRINT_CONSTANT((gint) GST_GL_CONFIG_CAVEAT_SLOW);
@ -125,7 +124,6 @@ int main() {
PRINT_CONSTANT((gint) GST_GL_LUMINANCE_ALPHA); PRINT_CONSTANT((gint) GST_GL_LUMINANCE_ALPHA);
PRINT_CONSTANT(GST_GL_MEMORY_ALLOCATOR_NAME); PRINT_CONSTANT(GST_GL_MEMORY_ALLOCATOR_NAME);
PRINT_CONSTANT(GST_GL_MEMORY_PBO_ALLOCATOR_NAME); PRINT_CONSTANT(GST_GL_MEMORY_PBO_ALLOCATOR_NAME);
PRINT_CONSTANT(GST_GL_MEMORY_VIDEO_EXT_FORMATS);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_ANY); PRINT_CONSTANT((guint) GST_GL_PLATFORM_ANY);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_CGL); PRINT_CONSTANT((guint) GST_GL_PLATFORM_CGL);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_EAGL); PRINT_CONSTANT((guint) GST_GL_PLATFORM_EAGL);