[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

GStreamer, appsink and CRC32

Filed under: GStreamer,Hacking,Python — Thomas @ 10:50

2009-01-07
10:50

Slowly flexing my GStreamer muscles again in preparation for a real application.

Yesterday I wanted something that allowed me to calculate CRC's of decoded audio files, to be able to calculate the CRC of a ripped file.

There's a few ways to do this using GStreamer, none of them code-free.

I assume the 'correct' way would be to write a filter element that calculates the CRC as buffers come in. In the olden days this would involve a lot of boiler plate code in C, and a small processing function.

Today, in C, this would be easier, since you could probably simply subclass basetransform.

You could write either in Python as well these days.

Then there's the 'get data out of GStreamer' approach. This used to be done using identity and the handoff signal.

The new, approved, API-stable way is to do this using appsink, one of two elements (with a helper library, of which I don't yet see the point) recently moved to gst-plugins-base.

Using appsink is probably the approach that involves the least code to write. You can set up a pipeline, set it to PLAYING, and just pull buffers in a blocking fashion (which is easier code to write, but harder to slap a GUI on later)

Here's the example code. You might note that there is an ugly try/except which I suspect is some bad handling inside gst-python or pygtk for errors during signal handling/emission.

It is a deceptively simple way to get data out of a pipeline and processed, and I'm glad we have a guaranteed way of doing this sort of operation now for the many people who want to dip their toes into GStreamer instead of diving in. I do hope they will at least consider the full dive still though.

Side note 1: GStreamer heads are free to share their opinion on what *should* be the correct way for data analysis operations like this. Years of brainwashing still lead me to believe that the answer would be 'write a filter element'.

Side note 2: I've been toying with the idea of making a python class for 'asynchronous operations' that would wrap a GObject main loop doing the processing, and implementations can then subclass and implement some simple methods. This would make it easy to attach that operation to a GUI element (for example, a progress bar) automatically, or adapt it into a linear, blocking operation for command line applications. I can't imagine this would be a novel idea, I'm sure someone else has done this already, anyone know what I'm talking about or have any suggestions ?

Xorg contributions

Filed under: Hacking — Thomas @ 11:57

2008-12-28
11:57

More than half a year ago I got a new computer for the living room, as quiet as possible, with an ATI 2400 based card. It took some tweaking to get X working, including using the "new" radeonhd driver, and learning enough about how XRandr works to cook up a simple one-line patch to get my card detected correctly and allow me to use multiple screens (I wanted to write Xinerama but apparently that's not the cool word to use anymore).

An X driver patch is only one step removed on the geek ladder from kernel patching, right ?

Anyway, as a good open source citizen I submitted this patch in the correct location, got some followup questions to try my card with HDMI attached, lugged my computer across the room to the TV, did the testing, sent the info, and assumed my patch would make it in, and forgot all about it.

Yesterday I did an upgrade, got a new X, and restarted, and I only had one screen working after booting. After scratching my had a little and relearning xrandr, I vaguely recalled me doing this patch half a year before, and checked if it was still valid. Seems it didn't land yet, sigh.

I know we're all busy in open source, but a one line patch verified by hand by someone owning the card to work, should be a no-brainer, right ? I'll repoke the relevant people and get it in this time.

I do have to say though it's definitely an improvement to have the whole X tree be split up, and to be able to take just one module, find a problem, create a one-line patch, and rebuild just the rpm package for that driver, instead of having to rebuild all of X for a simple change.

For those of you who happen to have Fedora 9 and the exact same card (GeCube ATI Radeon HD 2400Pro, with one VGA, one DVI, and one HDMI output), you can get the package from my Fedora 9 repository.

Lustrum

Filed under: Fluendo,GStreamer,Hacking,Life,Music,Python,Spain — Thomas @ 19:10

2008-11-28
19:10

Hard to believe that next week it will be Five Full Years I live and work in Barcelona.

It seems like only yesterday that I closed the door on the empty house I then shared with three good friends, and drove our truck through the icy mist on to a new life. That night where we had no place to live I passed by my grandmother's house for dinner, a few hours late. My grandmother's not here anymore. Neither is her house. At least part of her floor is now the floor of my apartment.

Originally we planned to give it a try and see after a year. And then one turned into two, then two-and-a-half, and now five.

When I left there wasn't even a company yet to give me a contract. Now we're three companies, and our fifth move has taken us to an office of around 50 people now, and already people are complaining again about space. Par for the course.

I also guess I never actually publically informed about my move from Fluendo to Flumotion - it was just a logistical confirmation of a practical situation. Today Julien is managing Fluendo (the GStreamer/codecs/DVD company), and Elisa was always managed by Lionel anyway. And Flumotion is a full-blown commercial company.

Meanwhile, after a bit of a hiatus on my GStreamer involvement, I am slowly coming back to my plans of using GStreamer - the plans I had originally when I discovered GStreamer more than 7 years ago. I just reread my first post the mailing list, from April 10th 2001 - at least it wasn't a completely stupid question.

My original plan was to write some code that would play your music just like a radio would. Nicely mixed, correctly levelled, a good flow between songs, and playing what you like to hear. An extension of the thesis project I did a long time ago which I used in our student radio at the time.

But GStreamer being what it was at the time, I got sucked into the vortex and didn't really work on these ideas for a long time. I took a quick stab at it during 0.8 in the form of gst-python's gst.extend.jukebox which worked quite well already on the mixing front, but when it got ported to 0.10 using gnonlin it just never worked for me and was left abandoned.

So third time's a charm. After close to 10 years of random hacking, it's about time to decide on one good personal project to invest my time in before life takes over. And this time I think I want to write something that not only Linux people can use. I want to write something that my friends can use too, and that means it has to work on Windows.

My motivation comes from being annoyed at not being able to listen to my music the way I should want to. I've been lax at ripping my new CD's over the last 5 years, and a 300 CD backlog to show for it. My automatic playlists reflect my tastes of five years ago, and only once in a while do I bother to get some new tracks on one of my three computers or my Nokia, to which I then listen only in certain conditions. And every player I deal with annoys me to some extent. And none of them do any kind of decent crossfading, if at all.

I'm not promising anything yet, and I'm only at the beginning, but my experience makes me a happier hacker, advancing quicker from the idea to the code stage than way back when. That's a nice feeling. Over a few two hour nightly sessions, I've put together some code that analyzes tracks, calculates RMS and attack/decay envelopes, and puts together a half decent mix. I've written a simple example using gnonlin which allows me to pre-listen these mixes, playing 5 seconds of the first track alone, then the mix, then 5 seconds of the second track alone.

This makes it a lot easier to evaluate different mixing strategies, making them easier to tune later on. I'll have a fun plane trip with my laptop, earphones, and three batteries.

If you happen to be adventurous and interested, you can always check out the repository and play around a bit and see if it can mix your tracks at all.

So, I'm celebrating my Lustrum of Fluendo and Barcelona with a bit of code for a new project!

Sadly, the names I was considering a few years ago were already taken - pyjama is now a jamendo python application (mine would have been Just Another Music Application - in Python), and Orpheus, which also exists. So for now I recycled a name of a previous project that handled another aspect of the problem.

8 hours of plane hacking baby! Here I go.

question for the wordpress wizards

Filed under: Hacking — Thomas @ 19:18

2008-11-11
19:18

After wasting again a big chunk of my weekend over fighting with mod_rewrite and wordpress to do some (to me at least) simple feed syndication, I finally figured out that I was in fact simply wrestling a wordpress quirk.

A URL like this: http://thomas.apestaart.org/log/index.php?cat=19,22

*only* works as expected when the Permalink structure in wordpress is set to default.

That is, the resulting page will show posts that are in category 19, or 22, or both at the same time.

As soon as you 'enable' permalinks, however, this breaks - the URL gets redirected to a URL of the form 'log/category/(name of first category)/, and only posts from the first category get shown.

I have no idea why this has to be the way or if there is a workaround, but feel free to let me know.

Now it seems I'm forced to choose between permalinks and feed syndication...

accepting public GPG keys

Filed under: Hacking,sysadmin — Thomas @ 15:54

2008-11-09
15:54

Today I'm doing some cleanup and maintenance work, and going through some pending GStreamer account requests.

I'm not a GPG expert, and I'm sure all of you are, so help me figure this out.

If someone creates a bug report and attaches their public GPG key, why should I trust that it is correct ? What should I do to verify it ?

AFAICT, anyone can file a bugzilla ticket, claim to be some other person B, and ask to change GPG and SSH keys for that person B.

What am I missing ?

« Previous PageNext Page »
picture