This Time Self-Hosted
dark mode light mode Search

Porting to Glib

In the past few days I’ve been working to port part of lscube to Glib. The idea is that instead of inventing lists, ways to iterate over them, to find data and so on so forth, using Glib versions should be much easier and also faster as they tend to be optimised.

Interestingly enough, glib does seem to provide almost every feature out there, although I still think the logging facilities lack something.

It is very interesting to finally being able to ditch custom-made data structures for things that were tested already before. Unfortunately, rewriting big parts of the code is, as usual, vulnerable to human mistakes. But it’s fun.

I start to wonder how much duplication of efforts we have in a system, I’m pretty sure there is some at least. xine-lib for instance does not use Glib, and it then re-implements some structures and abstractions that could very well be used from Glib. I’m tempted, once I feel better and I can pay more attention to xine-lib again, to start a new branch and see how it would work to move xine-lib to Glib. Considering that even Qt4 now brings that in, I guess most of the frontends would be already using Glib, so it makes sense.

Actually some of the plugins of xine itself make use of Glib, so it would probably be a good idea to at least try to reduce the duplication by using Glib there too. Things like Glib’s GString would make reply generation for HTTP, RTP/RTSP and MMS quite easier than the current methods, and probably much safer. I would even expect it to be faster but I won’t swear on that just yet.

So this is one more TODO for xine-lib, at this point I guess 1.3 series; it would also be nice to start using Ragel for demuxers and protocol parsers.

I guess I should be playing by now rather than writing blogs about technical stuff or rewriting code to use Glib or ragel, sigh.

Comments 3
  1. Nice to see you getting your health back!I like the idea behind Glib, but sometimes it doesn’t work out. Using glib in qt-4.4+ renders most qt apps unusable due to ~100% CPU usage. But if the blame is with qt devs or Glib I don’t know…

  2. FYI porting xine to Glib was one of Guenter’s plans. But nobody was motivated at that time.I agree with the code duplication, you could remove a lot of complicated code from xine-lib by using Glib instead.

  3. Porting zine to glib doesn’t sound good for embedded systems that use zine-lib. libxine is nice and small compared to huge glib.If all you want is a linked list check out libubiqx.for http stuff check out libneon

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.