Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use inner c:type for arrays with fixed size in sys mode #653

Merged
merged 1 commit into from Nov 4, 2018

Conversation

Projects
None yet
3 participants
@EPashkin
Copy link
Member

EPashkin commented Nov 4, 2018

Part of #648, #652

Only change sys generation

@alatiera please check this version on gstreamer-sys

cc @GuillaumeGomez, @sdroege

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 4, 2018

Code looks good to me. Do you have an example of the change in a sys library? Just one function is enough. :)

@EPashkin

This comment has been minimized.

Copy link
Member Author

EPashkin commented Nov 4, 2018

In your sys for #652

--- a/gtk-sys/src/lib.rs
+++ b/gtk-sys/src/lib.rs
@@ -1207,7 +1207,7 @@ impl ::std::fmt::Debug for GtkBindingArg_d {
 #[repr(C)]
 #[derive(Copy, Clone)]
 pub union GtkTextAppearance_u1 {
-    pub rgba: [gdk::GdkRGBA; 2],
+    pub rgba: [*mut gdk::GdkRGBA; 2],
     pub padding: [c_uint; 4],
 }
 
@@ -11819,7 +11819,7 @@ impl ::std::fmt::Debug for GtkRangeAccessible {
 pub struct GtkRcStyle {
     pub parent_instance: gobject::GObject,
     pub name: *mut c_char,
-    pub bg_pixmap_name: [c_char; 5],
+    pub bg_pixmap_name: [*mut c_char; 5],
     pub font_desc: *mut pango::PangoFontDescription,
     pub color_flags: [GtkRcFlags; 5],
     pub fg: [gdk::GdkColor; 5],

in gstreamer i checked only 2 parts:

--- a/gstreamer-mpegts-sys/src/lib.rs
+++ b/gstreamer-mpegts-sys/src/lib.rs
@@ -1238,7 +1238,7 @@ impl ::std::fmt::Debug for GstMpegtsExtendedEventItem {
 #[derive(Copy, Clone)]
 pub struct GstMpegtsISO639LanguageDescriptor {
     pub nb_language: c_uint,
-    pub language: [c_char; 64],
+    pub language: [*mut c_char; 64],
     pub audio_type: [GstMpegtsIso639AudioType; 64],
 }
--- a/gstreamer-sdp-sys/src/lib.rs
+++ b/gstreamer-sdp-sys/src/lib.rs
@@ -230,7 +230,7 @@ pub struct GstMIKEYPayloadKeyData {
     pub salt_data: *mut u8,
     pub kv_type: GstMIKEYKVType,
     pub kv_len: [u8; 2],
-    pub kv_data: [u8; 2],
+    pub kv_data: [*mut u8; 2],
 }
 
 impl ::std::fmt::Debug for GstMIKEYPayloadKeyData {
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 4, 2018

This fixes two things and breaks another.

Fixes:

@@ -1238,7 +1238,7 @@ impl ::std::fmt::Debug for GstMpegtsExtendedEventItem {
 #[derive(Copy, Clone)]
 pub struct GstMpegtsISO639LanguageDescriptor {
     pub nb_language: c_uint,
-    pub language: [c_char; 64],
+    pub language: [*mut c_char; 64],
     pub audio_type: [GstMpegtsIso639AudioType; 64],
 }
 
@@ -230,7 +230,7 @@ pub struct GstMIKEYPayloadKeyData {
     pub salt_data: *mut u8,
     pub kv_type: GstMIKEYKVType,
     pub kv_len: [u8; 2],
-    pub kv_data: [u8; 2],
+    pub kv_data: [*mut u8; 2],
 }
 
 impl ::std::fmt::Debug for GstMIKEYPayloadKeyData {

Breaks:

@@ -249,8 +249,8 @@ pub const GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE: GstAudioResamplerFlags = 4;
 // Callbacks
 pub type GstAudioBaseSinkCustomSlavingCallback = Option<unsafe extern "C" fn(*mut GstAudioBaseSink, gst::GstClockTime, gst::GstClock
Time, *mut gst::GstClockTimeDiff, GstAudioBaseSinkDiscontReason, gpointer)>;
 pub type GstAudioClockGetTimeFunc = Option<unsafe extern "C" fn(*mut gst::GstClock, gpointer) -> gst::GstClockTime>;
-pub type GstAudioFormatPack = Option<unsafe extern "C" fn(*const GstAudioFormatInfo, GstAudioPackFlags, gpointer, gpointer, c_int)>;
-pub type GstAudioFormatUnpack = Option<unsafe extern "C" fn(*const GstAudioFormatInfo, GstAudioPackFlags, gpointer, gpointer, c_int)
>;
+pub type GstAudioFormatPack = Option<unsafe extern "C" fn(*const GstAudioFormatInfo, GstAudioPackFlags, u8, gpointer, c_int)>;
+pub type GstAudioFormatUnpack = Option<unsafe extern "C" fn(*const GstAudioFormatInfo, GstAudioPackFlags, gpointer, u8, c_int)>;
 pub type GstAudioRingBufferCallback = Option<unsafe extern "C" fn(*mut GstAudioRingBuffer, *mut u8, c_uint, gpointer)>;
 
 // Records
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 4, 2018

CC @russel this is fixing one of the MPEG-TS problems you were running into

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 4, 2018

Oh the GstAudioFormatPack/Unpack comes from an earlier commit already. This PR is fine! Will create a new issue for that one

@EPashkin

This comment has been minimized.

Copy link
Member Author

EPashkin commented Nov 4, 2018

@sdroege You was do full regen on gstreamer-sys? My script process only part of it.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 4, 2018

I regenerated everything. Trying to find the commit now that broke it :)

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 4, 2018

I regenerated everything. Trying to find the commit now that broke it :)

In any case, merge this one.

I think it's a broken .gir file that breaks the other array...

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 4, 2018

It is: #654

@EPashkin

This comment has been minimized.

Copy link
Member Author

EPashkin commented Nov 4, 2018

I waiting for @GuillaumeGomez approval just in case.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 4, 2018

All good for me!

@EPashkin

This comment has been minimized.

Copy link
Member Author

EPashkin commented Nov 4, 2018

Then I merge
@sdroege, @GuillaumeGomez Thanks for review

@EPashkin EPashkin merged commit b5ea065 into gtk-rs:master Nov 4, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@EPashkin EPashkin deleted the EPashkin:fix_array_of_pointers branch Nov 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.