Tag search
Python-gstreamer, threading and the main loop
by Sander MarechalThis is just a quick heads-up for people who try to use python-gstreamer in a thread. Threading in Python has a few unexpected problems if you're new to it and it took me quite a few hours on Google searching for some scraps of documentation (and even diving into the source) before I got it right.
As it turns out, Python doesn't use Operating System threads but implements it's own threading because of portability, but that threading only works within python. When a thread calls a function that's written in C—such as gobject.run()—then Python freezes all threads until that function returns (unless that C function is wrapped in Py_BEGIN_ALLOW_THREADS/Py_BEGIN_ALLOW_THREADS statements). This is called Global Interpreter Lock or GIL and is very annoying when using gstreamer because gstreamer relies on some sort of external mainloop to function.
Streaming audio over TCP with python-gstreamer
by Sander MarechalI've fallen in love with Python. I'm always on the lookout for a good excuse to learn a new programming language. So, when I wanted something that lets me play my music collection from my server to my stereo I took python for a good test drive. Anoher thing I wanted an excuse for was learning gstreamer, so naturally I picked python-gstreamer.
Sadly there's a huge lack of documentation for it.There are only a few good tutorials around, first and foremost Jona Bacon's excellent tutorials [1][2][3]. I wanted my hack to work over TCP as well, because I have multiple music libraries. One on my home server, one on my desktop, a bit more on my laptop, etcetera. I want to be able to stream from other machines to my server which I'll hook up to my stereo. I could not find any tutorials on using tcpserversource and tcpclientsink elements, so honoring Jona's request that everyone “should write an article about something that you have discovered that isn’t particularly well documented”, here's mine about tcpserversource and tcpclientsink.