So, yesterday morning, I was looking for something silly to do. So I decided to work on DVD subtitle support. Jan already did quite some work on it, but nothing working yet for me.
Image blending
The thing is, DVD subtitles are not text; they are run-time length encoded (RLE) images. So in order to support DVD subtitles, you need image mixing support. GStreamer already ships with a videomixer element, which does pretty much this. There’s also an alternative imagemixer implementation in bugzilla. Both of those don’t handle a non-continuous stream correctly, though. However, our current text-subtitle renderer, pango-textoverlay, does. So step 1 was to make an image blender, taking the various pieces of each of those elements. That was finished yesterday. With that, I can do general image blending (e.g. image-over-video, video-over-video, text-over-video, etc.).
Getting pieces in place
From here on, it’s pretty much getting pieces in their place, since we already had a DVD subtitle rendering element in bugzilla for a while. So now, it was just a matter of doing it right, which I got working this morning.
It’s not perfect yet, it has many (fixeable) loose ends right now:
- the subtitle pads are only created when we see DVD subtitles in the MPEG stream. We should create pads in advance by going over the stream or reading the DVD .ifo headers. As a workaround, I use a silly timeout value right now.
- Rendering is kinda slow.
- Alpha values are wrong (the subtitle in the screenshot is semi-transparent…?).
- This works on command-line, but obviously needs to be made workign in playbin so that it works in Totem, too.
- Once all that is done, the pango-textoverlay element needs to be changed in a pure subtitle renderer (without image blending), so that we can use that element in combination with this new imagemixer, too.
Yet another TODO item mostly solved. La grande question: when will DVD menues work? :).