August 31, 2017 at 6:19 pm #3557
I’ve recently been having a go at getting the spout library to work with python 3.5. So far I’ve tried using the boost::python library to add some module declarations in the spout library. I’ve managed to get a basic example of a sender working – so sending a texture from python to spout, but I’m encountering all sorts of segmentation faults and such when I try to implement the receiving class.
I was wondering if you’ve had a go at this already and if so, if you have any helpful pointers?
I intend to put the code I have up on github in the next few days, but would love to make some more progress before then.
So a couple of little things: python treats its basic types, such as ints as immutable. The spout receive texture function asks for width and height unsigned ints as references. From looking at the code, this is so you can update those variables if the receiving texture information changes. However, it seems like your spout for processing library uses quite a difference declaration for the receive texture function, which makes me think that in order for you to get JNI compatible interface, you had to make changes to the dll? I don’t see the dll source in the repository, otherwise I would check it.
Thanks for taking the time to read this 🙂August 31, 2017 at 11:49 pm #3559
Somebody mentioned Python a while back but I have not investigated it. There is great potential here I am sure.
For receiveTexture, the JNI dll takes a dimarray and GetIntArrayElements/ReleaseIntArrayElements is used to retrieve and return them, but that is not the problem if you are not using Java. If you would like a copy of the JNI dll source, please use the email on the home page and I will reply.
I understand from what you say that you are using the SpoutLibrary project rather than compiling the Spout SDK as a dll. The difference as you probably know is the use of a single exported function that returns a pointer that is then used to access the Spout functions. There should be no problem sticking to this method, but it is something to check.
If you have a basic sender working then I am thinking that the problems you mention might be resolved by making a version of the library with function over-rides that use pointer arguments instead of passing by reference.September 1, 2017 at 5:27 am #3560
Thank you! I’ll be sure to email you soon.
I spoke incorrectly before. I’ve been compiling the Spout SDK as a dll with the Boost::Python module extension, but I’ve been looking at the SpoutLibrary source to see if that would be easier to make compatible with python, using another method like SWIG.
I’ll try your suggestion and make some overloaded methods where I use pointers instead of references and see how that goes.
Thanks a bunch for your help so far!September 4, 2017 at 8:01 pm #3563
Thanks so much for the help Leadedge. I’ve successfully got a basic amount of functionality working in the modified SpoutSDK library for a sender and receiver to work. Currently the receiver will not automatically get new width/height information, so you must correctly supply that for things to work as expected.
Anyway, I’ve put this up on github at https://github.com/spiraltechnica/Spout-for-Python for those interested.
RyanJanuary 18, 2018 at 9:31 am #3778January 19, 2018 at 12:20 am #3783
That’s a good resource.
You must be logged in to reply to this topic.