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

Automatically generate bindings from GObject-Introspection information #2

Open
sdroege opened this Issue Apr 28, 2015 · 33 comments

Comments

Projects
None yet
3 participants
@sdroege

sdroege commented Apr 28, 2015

Hi,

thanks for your effort to create these bindings. For the long run it will be much less maintenance work for you to have them autogenerated from the GObject-Introspection information provided by GStreamer. This approach is successfully done for many other languages already.

For Rust there's this project here to build a generic GObject-Introspection bindings generator: https://github.com/gi-rust

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Apr 28, 2015

Owner

thanks for pointing that out i thought about how this can be made more automatic but could only come up with somehow parsing the headers which seemed a ton of work, didn't knew that other bindings used introspection but of course it seems the way to go. will give it a look when i have a moment

Owner

arturoc commented Apr 28, 2015

thanks for pointing that out i thought about how this can be made more automatic but could only come up with somehow parsing the headers which seemed a ton of work, didn't knew that other bindings used introspection but of course it seems the way to go. will give it a look when i have a moment

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Apr 28, 2015

Let me know if you need some help or have questions around anything there, also generic GStreamer things :)

sdroege commented Apr 28, 2015

Let me know if you need some help or have questions around anything there, also generic GStreamer things :)

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Apr 28, 2015

Owner

thanks so much!

Owner

arturoc commented Apr 28, 2015

thanks so much!

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege commented Apr 5, 2017

I started with the FFI part here: https://github.com/sdroege/gstreamer-sys

@sdroege

This comment has been minimized.

Show comment
Hide comment

sdroege commented Apr 7, 2017

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Apr 7, 2017

Owner

that's great, i never got around to look into this, by now i'll port this crate to use your ffi instead of the bindgen bindings when i have a moment

Owner

arturoc commented Apr 7, 2017

that's great, i never got around to look into this, by now i'll port this crate to use your ffi instead of the bindgen bindings when i have a moment

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Apr 7, 2017

Owner

btw, i've been following a bit all the progress in the latest gnome hackfest and the new crates for plugins are really nice, do you think it would be useful to have rsplugin as a dependency for this and make use of classes there like GstRc?

Owner

arturoc commented Apr 7, 2017

btw, i've been following a bit all the progress in the latest gnome hackfest and the new crates for plugins are really nice, do you think it would be useful to have rsplugin as a dependency for this and make use of classes there like GstRc?

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Apr 7, 2017

I think as a first step it would make sense to move the existing bindings over to gstreamer-sys and also the existing glib/gobject infrastructure (see also #25).

And for example use gtk-rs' "gir" tool to automatically generate nice bindings for types where that works (see e.g. https://github.com/gtk-rs/gtk/blob/master/src/auto/button.rs for such a case), and generally make use of the macros from gtk-rs (glib_wrapper!() specifically) and generally follow their style (with naming, usage of traits, ...). Best to keep all this consistent :)

For GstRc, for the time being it probably makes most sense to copy that over here as "rsplugin" is not stable in any way yet, and it's also small enough.

sdroege commented Apr 7, 2017

I think as a first step it would make sense to move the existing bindings over to gstreamer-sys and also the existing glib/gobject infrastructure (see also #25).

And for example use gtk-rs' "gir" tool to automatically generate nice bindings for types where that works (see e.g. https://github.com/gtk-rs/gtk/blob/master/src/auto/button.rs for such a case), and generally make use of the macros from gtk-rs (glib_wrapper!() specifically) and generally follow their style (with naming, usage of traits, ...). Best to keep all this consistent :)

For GstRc, for the time being it probably makes most sense to copy that over here as "rsplugin" is not stable in any way yet, and it's also small enough.

@luisbg

This comment has been minimized.

Show comment
Hide comment
@luisbg

luisbg Apr 11, 2017

Hi @arturoc :)

Let me know if I can help you with porting this to use @sdroege -sys.

Happy to help

luisbg commented Apr 11, 2017

Hi @arturoc :)

Let me know if I can help you with porting this to use @sdroege -sys.

Happy to help

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Apr 11, 2017

Owner

i don't have time right now to do it so if you want to look into it you are completely welcome to send a PR. i guess it's probably just a matter of removing my ffi file and adding the corresponding dependency in the cargo file since the naming should be the same

Owner

arturoc commented Apr 11, 2017

i don't have time right now to do it so if you want to look into it you are completely welcome to send a PR. i guess it's probably just a matter of removing my ffi file and adding the corresponding dependency in the cargo file since the naming should be the same

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Apr 11, 2017

Yes that part is mostly search&replace. Once that is done we can think about the next steps one-by-one for how to bring everything closer to how the other GObject bindings are done.

sdroege commented Apr 11, 2017

Yes that part is mostly search&replace. Once that is done we can think about the next steps one-by-one for how to bring everything closer to how the other GObject bindings are done.

@luisbg

This comment has been minimized.

Show comment
Hide comment
@luisbg

luisbg Apr 11, 2017

Cool!

@arturoc, you will have a PR from me soon

luisbg commented Apr 11, 2017

Cool!

@arturoc, you will have a PR from me soon

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Apr 12, 2017

For GstRc and bindings for all the basic GStreamer types (GstStructure and all the GstMiniObject based ones that can't be properly covered by GIR), it probably makes sense for me to put them into another crate that can be used by gstreamer1.0-rs, my stuff and anything else that needs it.

Going to put that on my list, but I'll have to add some more types before that then (GstMemory, GstMessage/Event/Query, GstStructure at least).

sdroege commented Apr 12, 2017

For GstRc and bindings for all the basic GStreamer types (GstStructure and all the GstMiniObject based ones that can't be properly covered by GIR), it probably makes sense for me to put them into another crate that can be used by gstreamer1.0-rs, my stuff and anything else that needs it.

Going to put that on my list, but I'll have to add some more types before that then (GstMemory, GstMessage/Event/Query, GstStructure at least).

@luisbg

This comment has been minimized.

Show comment
Hide comment
@luisbg

luisbg Apr 13, 2017

Work in progress. Just wanted to check if I'm going in the right direction compared to your ideas.

luisbg@754502b

luisbg commented Apr 13, 2017

Work in progress. Just wanted to check if I'm going in the right direction compared to your ideas.

luisbg@754502b

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Apr 13, 2017

Commented but looks mostly good

sdroege commented Apr 13, 2017

Commented but looks mostly good

@luisbg

This comment has been minimized.

Show comment
Hide comment
@luisbg

luisbg Apr 13, 2017

My WIP patch has been updated with some small fixes. Like using c_char and c_uint, instead of gchar and guint.

All the issues remaining are related to mismatched types. Which I will solve right after the easter weekend, since I am going out on a trip.

Enjoy! 😃

luisbg commented Apr 13, 2017

My WIP patch has been updated with some small fixes. Like using c_char and c_uint, instead of gchar and guint.

All the issues remaining are related to mismatched types. Which I will solve right after the easter weekend, since I am going out on a trip.

Enjoy! 😃

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Apr 13, 2017

Owner

yes apart from @sdroege 's comment looks good to me

Owner

arturoc commented Apr 13, 2017

yes apart from @sdroege 's comment looks good to me

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Jul 3, 2017

I worked on autogenerating bindings from the GObject-Introspection data now (except for GstMiniObject which does not map well automatically). Current status can be found here: https://github.com/sdroege/gstreamer-rs
It's a bit raw still, but works and properly integrates (and is consistent with) all the gtk-rs crates. And almost no hand-written code at this point (which I had to pay for with working quite a bit on the code generator).

This also covers #25 and #24 (once I moved more things over from gst-plugin-rs).

@arturoc are you interested in collaborating on that one and making it the next version of the gstreamer crate?

sdroege commented Jul 3, 2017

I worked on autogenerating bindings from the GObject-Introspection data now (except for GstMiniObject which does not map well automatically). Current status can be found here: https://github.com/sdroege/gstreamer-rs
It's a bit raw still, but works and properly integrates (and is consistent with) all the gtk-rs crates. And almost no hand-written code at this point (which I had to pay for with working quite a bit on the code generator).

This also covers #25 and #24 (once I moved more things over from gst-plugin-rs).

@arturoc are you interested in collaborating on that one and making it the next version of the gstreamer crate?

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Jul 4, 2017

Owner

That sounds great, i'll take a look as soon as i have a moment and will try to port the code that i have using this repo to yours to see how it goes. Will let you know

I'll keep this around for a while until yours stabilizes and then mark it as deprecated

Owner

arturoc commented Jul 4, 2017

That sounds great, i'll take a look as soon as i have a moment and will try to port the code that i have using this repo to yours to see how it goes. Will let you know

I'll keep this around for a while until yours stabilizes and then mark it as deprecated

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Jul 4, 2017

Right now only (big parts) of the core API are available. Please send me a pull request with any of the examples from https://github.com/arturoc/gstreamer1.0-rs/tree/master/examples ported over (or anything else of course!), and also let me know what is missing.
appsrc/appsink/playbin bindings at least, the first two should be easy to add and the last is something we (speaking with my GStreamer hat on here) generally, as a policy, don't like to have in bindings (bindings for elements from plugins).

However I'll have to come up with a solution for being able to use arbitrary signals/properties for playbin to be usable, which is next on my list once the other parts are complete.

When you say deprecated, you'd be fine with replacing the gstreamer crate on crates.io with this one once it's stabilized and ~feature equivalent? That would be great to reduce confusion :)

sdroege commented Jul 4, 2017

Right now only (big parts) of the core API are available. Please send me a pull request with any of the examples from https://github.com/arturoc/gstreamer1.0-rs/tree/master/examples ported over (or anything else of course!), and also let me know what is missing.
appsrc/appsink/playbin bindings at least, the first two should be easy to add and the last is something we (speaking with my GStreamer hat on here) generally, as a policy, don't like to have in bindings (bindings for elements from plugins).

However I'll have to come up with a solution for being able to use arbitrary signals/properties for playbin to be usable, which is next on my list once the other parts are complete.

When you say deprecated, you'd be fine with replacing the gstreamer crate on crates.io with this one once it's stabilized and ~feature equivalent? That would be great to reduce confusion :)

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Jul 4, 2017

Owner

When you say deprecated, you'd be fine with replacing the gstreamer crate on crates.io with this one once it's stabilized and ~feature equivalent? That would be great to reduce confusion :)

sure, if we manage to make the generated bindings at least as feature complete as this one and if something is missing from the generated bindings it would perhaps be better to turn this into a complement/utilities crate for the missing bits on the autogenerated bindings rather than maintain 2 different full ports

Owner

arturoc commented Jul 4, 2017

When you say deprecated, you'd be fine with replacing the gstreamer crate on crates.io with this one once it's stabilized and ~feature equivalent? That would be great to reduce confusion :)

sure, if we manage to make the generated bindings at least as feature complete as this one and if something is missing from the generated bindings it would perhaps be better to turn this into a complement/utilities crate for the missing bits on the autogenerated bindings rather than maintain 2 different full ports

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Jul 4, 2017

Yeah, making some kind of utils (or probably "plugins") crate would make sense. When I wrote the C# bindings, I also made some kind of generator for plugin-element bindings, should be easy to do the same here again once all the foundation is ready.

sdroege commented Jul 4, 2017

Yeah, making some kind of utils (or probably "plugins") crate would make sense. When I wrote the C# bindings, I also made some kind of generator for plugin-element bindings, should be easy to do the same here again once all the foundation is ready.

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Jul 11, 2017

Something like your decodebin and gst-launch examples are available in my repository now btw, the others except for appsink/appsrc should be easily possible too. More things missing of course, but getting there.

sdroege commented Jul 11, 2017

Something like your decodebin and gst-launch examples are available in my repository now btw, the others except for appsink/appsrc should be easily possible too. More things missing of course, but getting there.

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Jul 30, 2017

All of the GStreamer core API is available now, much more than here. I don't think anything is really missing at this point now, except for bindings for the other GStreamer bindings (libgstapp, libgstvideo, etc... which would go into separate threads).

@arturoc Did you have a chance to take a look already?

sdroege commented Jul 30, 2017

All of the GStreamer core API is available now, much more than here. I don't think anything is really missing at this point now, except for bindings for the other GStreamer bindings (libgstapp, libgstvideo, etc... which would go into separate threads).

@arturoc Did you have a chance to take a look already?

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Aug 1, 2017

Owner

Hey sorry no i haven't had time to test it yet. Most of my code though rely on appsink/src and video to work so i'm not sure how useful this new wrapper is to me right away but i'll try to see how i can port the utilities that i have to use your port when i have a moment. I'm going to add a note in my README pointing to your repo though so people just using plain gstreamer know that there's a more complete port of the whole api

Owner

arturoc commented Aug 1, 2017

Hey sorry no i haven't had time to test it yet. Most of my code though rely on appsink/src and video to work so i'm not sure how useful this new wrapper is to me right away but i'll try to see how i can port the utilities that i have to use your port when i have a moment. I'm going to add a note in my README pointing to your repo though so people just using plain gstreamer know that there's a more complete port of the whole api

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Aug 1, 2017

@arturoc appsrc/appsink bindings are there already, worked on that earlier today: https://github.com/sdroege/gstreamer-rs/tree/master/gstreamer-app . Currently I'm writing some examples for that.

Plan is to also add (at least) gstbase, gstvideo, gstaudio, gstpbutils and gstplayer.

What would be missing from your point of view until the new stuff can go on crates.io (with the same name) and replace the existing bindings?

sdroege commented Aug 1, 2017

@arturoc appsrc/appsink bindings are there already, worked on that earlier today: https://github.com/sdroege/gstreamer-rs/tree/master/gstreamer-app . Currently I'm writing some examples for that.

Plan is to also add (at least) gstbase, gstvideo, gstaudio, gstpbutils and gstplayer.

What would be missing from your point of view until the new stuff can go on crates.io (with the same name) and replace the existing bindings?

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Aug 1, 2017

Owner

just had a quick look (haven't had time to test it yet) and it looks really good. i'll try to port my code during this week to use the new bindings and will let you know if there's something that i could do before that i can't do now.

Owner

arturoc commented Aug 1, 2017

just had a quick look (haven't had time to test it yet) and it looks really good. i'll try to port my code during this week to use the new bindings and will let you know if there's something that i could do before that i can't do now.

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Aug 1, 2017

You can find examples for appsrc and appsink here now:
https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/appsrc.rs
https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/appsink.rs (signals can also be used instead of the callbacks, but callbacks are faster)

sdroege commented Aug 1, 2017

You can find examples for appsrc and appsink here now:
https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/appsrc.rs
https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/appsink.rs (signals can also be used instead of the callbacks, but callbacks are faster)

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Aug 11, 2017

@arturoc VideoInfo, AudioInfo, VideoFrame and related things are there too now. I think now it's feature-equivalent.

sdroege commented Aug 11, 2017

@arturoc VideoInfo, AudioInfo, VideoFrame and related things are there too now. I think now it's feature-equivalent.

@luisbg

This comment has been minimized.

Show comment
Hide comment
@luisbg

luisbg Aug 11, 2017

This is amazing work @sdroege. Thank you so much 😃

luisbg commented Aug 11, 2017

This is amazing work @sdroege. Thank you so much 😃

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Aug 21, 2017

@arturoc how should we proceed with this? Do you need help porting your stuff? If so please send me a mail with questions and I'll help :)

Ideally I'd like to make a release next week, and have that become the new version of these bindings as it's more complete and more automated now. For being able to put up a new version on crates.io I would need you to give me permissions though, @arturoc. Also if you're interested in continuing to help maintaining the new bindings, any help is welcome :)

sdroege commented Aug 21, 2017

@arturoc how should we proceed with this? Do you need help porting your stuff? If so please send me a mail with questions and I'll help :)

Ideally I'd like to make a release next week, and have that become the new version of these bindings as it's more complete and more automated now. For being able to put up a new version on crates.io I would need you to give me permissions though, @arturoc. Also if you're interested in continuing to help maintaining the new bindings, any help is welcome :)

@arturoc

This comment has been minimized.

Show comment
Hide comment
@arturoc

arturoc Aug 22, 2017

Owner

hey sorry, i haven't had time to look into this yet and won't have in a while so let's just do it. can you send me an email at arturo at openframeworks cc to see how we can move forward

Owner

arturoc commented Aug 22, 2017

hey sorry, i haven't had time to look into this yet and won't have in a while so let's just do it. can you send me an email at arturo at openframeworks cc to see how we can move forward

@sdroege

This comment has been minimized.

Show comment
Hide comment
@sdroege

sdroege Aug 22, 2017

Thanks, let's get this going then :)

sdroege commented Aug 22, 2017

Thanks, let's get this going then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment