Older blog entries for company (starting at number 35)

So here's a small update to last week's Swfdec Youtube post. I've spent most of the time on the awesome IRC feedback that I got. Thanks everyone. Here's some answers to the most common questions I got:

Swfdec plays Youtube. Now what does that mean?
It means that when you grab the Swfdec library and the swfdec-mozilla package out of git and manage to install it correctly, you will be able to go to any Youtube video site and have it play back the videos in your browser. The buttons don't work yet and it certainly doesn't behave 100% like the Adobe plugin, but it certainly plays the videos.

OMG, swfdec doesn't work on 64bit machines!
OMG, it does! Since I posted the last entry, I've got lots of offers for remote access to 64bit machines and spent the last hours making sure it compiles and passes the testsuite. Of course I have no 64bit machine and until 3 hours ago didn't know most of the things I'd need to look for, so expect some bugs being left. Please test if you're on 64bit and if you find crashers, file bugs.

Where's the release?
I intend to do a release soon, but I'd like to have a working pause button and slider in Youtube. I'm hoping for a release at the end of this week. For now, use git.

How close is Swfdec to being a complete Adobe Flash replacement
That really depends on your definition of close. For the definition "implements all of Flash's features" it'll probably not hit 5%. For the definition of "plays all the Flash files on the Web" I think it's 80/20 right now. Swfdec plays 80% of the ads and 20% of the real content. And no, that wasn't on purpose. I've been following a simple rule for what to implement: I take an interesting flash file and make it work correctly. So if there's any Flash files that I might find interesting and that you want to have working in Swfdec, don't hesitate to contact me with URLs to those files. I'm always looking for cool Flash files.

What can be expected from Swfdec in the future?
I have no idea. I'm looking for a job at the moment and since that job will most likely not be me hacking on Swfdec fulltime, expect the Swfdec development to slow down in the future. However, it only took me half a year to get Youtube working and Youtube is already quite complicated. So in short: I have no idea.

15 Mar 2007 (updated 15 Mar 2007 at 19:06 UTC) »

GO Swfdec!

6 months of work, I'm now gonna go partying.
See you at Cebit.
PS: For the brave people: The code is in git.

Miguel links to a blog post by Anne Zelenka (read the comments!) about how open Flash is and how good an open Flash would be. I think one point they all don't see in their "an open spec would be enough" is the work necessary to produce an open spec.

Now let me get this straight. Adobe has a spec for the SWF format, and they have lots of documentation on Actionscript, so producing some spec would be easy. But the problem is that the existing specs only describe correct behavior, but not the more important part on how to treat errors. Consider an example where the spec might say something like "height: Integer - the height of the current movie". So what happens when your code does height = new Object()? It's written down nowhere. In the current closed world, the solution is easy: the accepted behavior is what the Adobe Flash player does. So if you want to write an open Flash Player like Swfdec, you don't need a spec, you need patience and lots of test cases. Because there'll surely be a Flash somewhere that does height = new Object () or height = height / 0 or height = "Hello World" or...

A good example of how hard it is to handle the unexpected right is Acid2 for CSS. And in the case of Acid2, there even exists a spec about how to handle all the errors. (I was going to link to something I read by I think HÃ¥kon Lie about why having a defined way of handling errors is important as opposed to just aborting, but I can't find it in Google.) And error handling mechanisms are an important part of an implementation. The Mozilla team needed 1.5 years to correct their error handling. So if you figure out something new and exciting about Flash, it can easily mean you have to redesign a large part of your player. So it's important to know beforehand and should be part of the spec.

And while we're talking about necessary rewrites: A part that no spec talks about is implementation complexity. If a function is O(1) in the official player while it is O(N) in yours, you have a problem when someone calls it excessively in a loop. And then there's probably code relying on timeouts, data input or the phase of the moon.

Another thing I've been wondering about lately is the complexity of implementing a standard. I have no clue how Flash relates to SVG in complexity, but SVG has an open spec and that one is 4 years old. Do we have any SVG compliant implementations by now? HTML has a free spec, too. It took the Mozilla team 6 years from open sourcing to a release for their browser. So if a complete Free Flash specification started to exist tomorrow, would it take 5 years to implement?

An open Flash spec would definitely make Flash inch closer to World Domination, but it'd still take a very long time to make it really Free. Open sourcing the player would probably make that happen way faster.

29 Dec 2006 (updated 3 Jan 2007 at 15:04 UTC) »
I did it

So I've just managed to finish my Christmas present only a week late, but anyway, after 3 months of not hacking on anything else, I've finally released Swfdec 0.4 and its companion, Swfdec Mozilla 0.4.

The good news: The mozilla plugin is now almost 100% compatible with South Park Studio. So you can do this. (Yes, that's an SVG taken from the Flash)
Unfortunately there's no UI for it yet. Implementing Flash is kind of a huge task afterall.

And finally, here's the disclaimer: This software is not rock-solid. So if the plugin kills your browser, don't blame me. File a bug or talk to the list instead.

Happy new year!

So, talking about the MS/Novell deal has been declared stupid by dobey even though according to other hackers 80 percent of hackers think that there is nothing wrong with it. jclinton has issued a statement condemning this action. Perhaps he said it best

"Since you guys are all buddy, buddy and everything, I'm sure it wouldn't be too hard for you to take a few minutes of his time to explain the spirit of Free Software to Steve."
Personally I think that if people weren't outraged about it, we'd have already lost to MS.

Update: Iain has said that if more people think like this he will do what he is told and stop blogging completely.


So about a month ago Federico blogged a Youtube link again. That made me wonder about Free Flash decoders and I had a look around. In the end I started hacking on David's Swfdec, since it has all the goodies: Cairo for beautiful Graphics, GStreamer for sound, David's excellent code (the SWF parsing code is awesome) and of course it was written in Gnome C.

Long story short: I haven't had this much fun in hacking for ages. I think I haven't done much else in the past month but hacked on Swfdec and watched lots of stupid Flash movies lots of times.

So what's the current state? It's still very far from finished since Flash is huge. It's a graphics framework (think GDK) with a scripting engine (think Javascript). But if you're adventurous, bored or both, feel free to check out the sources from git://people.freedesktop.org/~company/git/swfdec and play with them. They might even play back some weird flash file. For now I'll continue to make FLash files work one by one. Next stop: South Park.

PS: Before someone asks: Gnash is low quality, written in C++ with Boost, requires Copyright assignment, svn doesn't even compile and it does less than my current Swfdec, so I didn't hack on it.

Selection Fun

Do you know this: You select some text with the mouse and after you did this you wonder why you missed the last or the first letter?
I asked some people around me and they have that problem. Today I got annoyed enough to venture into the deep world of selecting text to figure out what the reason for this could be.

So I started my journey by looking into the GtkEntry source code. And the first thing I found where two things I didn't know. The first is a workaround for this problem: You can shift-click to extend the selection.
The second: If you start selecting with a double-click (triple-click), you'll only select full words (lines).

And I found out what the problem is: When selecting text, you don't select letters, you select gaps. What does that mean? If you click on a letter, Gtk selects the closest gap for you. So if you click on the left half of the letter, the gap in front of the letter is taken, if you click on the right half, the gap on the right is taken. If you want to try: The best letter is an "m", at least with Vera. So, go, enter "mmmmm" in your location bar and try it. :)

This seemed like an obvious usability issue to me, so I thought that other toolkits would get it right. And then I found - for the first time ever - that everyone: Gtk, Qt, XUL, Gecko and Windows, they all behave the same. This got me thinking: Are you actually supposed to select gaps? I mean, it's very likely that I am wrong and the rest of the world is right and not vice versa. But actually, all the people I asked said they knew that problem.

So I'm currently a little lost. Should I really file bugs with literally everyone or did I miss something? I've filed a bug with Gtk, but I'm wondering if I it's really wrong and I should file bugs with Qt, Mozilla, Abiword, ...?!

I need to follow up on David's Post about Foundation membership because it fits so well:

As much as it is a nice feeling to feel welcome when you've got your confirmation email, it's a weird feeling when you get the email that you will be no longer a member now, because you didn't do the work to renew it, even though you're still very involved with GNOME.
This is the only reason why I am no longer a foundation member.

Who let this crap into Gtk? I'm really annoyed that such code ended up there, because that code not only works bad, but also is conceptual crap. I'm talking about the dnd code. So what's wrong with it? I'll start with the worst things:

  1. You have to provide a function that creates a new window if the tab is dragged off the notebook. So what's wrong with gtk_notebook_set_window_creation_hook? It's global. Every self-respecting programmer should know by now that globals are bad, mkay? Especially so in libraries. Anyone remember XSetErrorHandler? So just assume for a moment, that you were using a docking library (like the Gimp or Gdl) that wants to support floating docks and you want to make some of your own notebooks detachable. Who sets the hook?
  2. To figure out if dragging from one notebook to another is allowed, one has to set a group id. And this is a (positive) integer. Hi namespace collision. By now I'd thought that it was common knowledge to use strings or pointers for such a thing. But apparently it's not. So what ID is the docking library using now? Just pick one and hope?
  3. Detaching tabs only works if you drag them to the desktop. Don't ever try this with a fullscreen app.
  4. Reordering is implemented without drag'n'drop to give nice visual feedback. Unfortunately detaching is implemented with drag'n'drop. So once you've gone over the threshold to start a drag, the UI looks completely different. Even if you later on move the mouse over the notebook again, it doesn't change back.
  5. There is absolutely no visual feedback (aka highlighting) when doing a drag.
  6. The code for reordering (or dragging) tabs in a small notebook (where the arrows are visible and preferrably only one notebook is visual at any time) does not work in any reliable way.
  7. There are lots of different annoying drawing glitches from flickering to drawing tabs in weird places during reordering and dragging.
These are lots of reasons that would have gotten me patches rejected almost everywhere in the gnome stack. So why did the normally excellent Gtk quality control fail to work in the notebook case?

So there's lots of discussion about screencasting going on. And since I'm the Byzanz guy, I'll add my stuff to this discussion.

While thinking about how to extend Byzanz and what features to add to it, I came up with four requirements for a good screencasting application on Linux, which are, in descending importance:

  1. Can be played back inside a browser with a default installation of current versions of Windows, RHEL and Ubuntu.

    This is important because most screencasts are made for the web and for a wide audience. And these audiences probably use an average distribution and are not into installing weird software. They probably just use the default. This is why I picked Windows (the biggest audience) and Linux (a big audience for recordings of Linux desktops).

  2. Can be recorded on a recent Fedora or Ubuntu with a default install and an install of the recorder.

    It should not be hard to get going. If there's a custm compile needed or packages are required that for some reason cannot be included in the package tree (think multimedia and patents here), then it's not an easy tool.

  3. Has a decent quality and file size.

    This is fairly obvious. You don't want to wait an aeon until the download is finished and you want to be able to see what the screencast is about. And this point requires special care because a lot of video formats are bad for screencasts since they fail to produce good enough recordings of text.

  4. records audio

    While this sounds fairly easy ("just add the feature!"), it becomes a problem when choosing the right format. It's also currently a problem in the "just works" department because there's quite some setup required in all the apps I've used that support audio input. Even Ekiga, which is a simple to use multimedia application, still has a druid.

So with these 4 points I set out to find a format suitable for recording screencasts. And I haven't found one. There's a lot of formats that sort-of work, but none of them does all 4.
  • GIF does (1) and (2) and is ok for (3). That is, until you start recording images or videos, because the format only supports 256 different colors and videos or images tend to use all the 16 million different ones. And the file size starts to suck, too. GIF totally fails at (4), because it has no sound.
  • Flash is the probably the best choice for (3) and (4), might work for (1) - I have no clue about Flash playback in current Linux distros, but totally fails at (2). Flash audio is MP3 and currently no distro ships an MP3 encoder in their main repository. Add to that the missing availability of flash encoding libraries in Linux and especially Linux distros.
  • All video formats (think MPEG, AVI formats or OGG THEORA here) do (4) and are ok at (3). But none of them does (1). Either they work in Windows or they work in Linux. Probably they work nowhere because browser plugins for video playback aren't installed by default. And the we haven't touched (2) which is hard becase multimedia production enters the patent minefield again which makes distros not ship encoding libraries.
  • JAVA is an option. A custom Java applet for playing back screencasts could easily handle (3) and (4). And it would do (1) and (2) for every distro that has a JRE and Java browser plugin installed. Unfortunately this is the first problem. Most current Linux distributions don't have that installed. And the second problem is that a good Java applet is missing and noone has stepped up yet to code a screencast applet.
So currently, even though I have written an application that in my opinion almost perfectly manages the first 4 points of Quim's requiremens, I can't do anyting right now to solve the last ones because I'm lacking a format that would manage them. I'd love to, but I have no clue how. Suggestions welcome.

26 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!