Aventuras en Málaga y Ronda

Last week was a blast. Spending a couple of days working on Pitivi fulltime and meeting with the awesome GStreamer folks again was a thrilling experience. Not only that, but it happened in the beautiful city of Málaga.

Coming from Montréal, I’m still a bit shocked at the sight of people wearing coats, scarves and tuques in broad daylight at +15°C.

Hell, the weather in Malaga was so consistently mild that even if we were in the middle of January, in the morning I went outside straight from the shower with wet hair, which dried in minutes!

While we’re talking about showers again… Malagans, unlike Bostonians, got the usability of their shower handles/lever/thingie right. However, they completely fail at road signage and urban planning. I thought I’d never see the day when I’d find something worse than the province of Québec, but it seems we have a new winner here:

  • Street names written in minuscule font sizes on buildings (when they are present at all)? Check.
  • Road signs inside the ramps/exits (when it’s too late)? Check. (Québec has that too)
  • One-ways everywhere? Check.
  • Inability to get back on a highway if you take the wrong exit? Check.
  • Roundabouts where you have to yield to people outside the roundabout? Check.
  • Roundabouts with streetlights every 30 degrees? Check.
  • Tiny road signs inside the roundabout instead of on exits? Check.

I found this all quite amusing. Except when Antigoni and I had to get back to the airport and mistakenly ended up on an exit ramp on avenida de Andalucía.

Okay, back to the hackfest.

Notwithstanding the work we did on planes or busy airports and the many discussions we’ve had around tapas, we spent three days doing solid coding, debugging and ass-kickin’ on Pitivi and GES. I’m very happy that, in the process, Antigoni learned some new tricks and knowledge to make her more comfortable with hacking on the pitivi codebase. We also got our shares of laughs too. Like the fact that I ate three hours of Edward’s time trying to investigate why importing clips crunched my hard drive for many seconds… and then realizing that the culprit was not my code nor the gst discoverer, but GTK+ itself.

More precisely:

  • Thibault spent the whole time hacking on GES and answering our questions.
  • Antigoni went concrete/practical by attempting to fix undo/redo for effects, getting more familiar with GES in the process. I’m happy to have been able to answer some of her questions and being able to point out pitfalls in the code: at times, it even seemed like I knew what I was talking about, which is always a great thing!
  • Edward spent nearly the whole time grunting and swearing in French, except when the sound was muffled by his palms:

As for me, I:

  • Fixed image thumbnailing/permissions on the wiki and deleted 1846 spam image files scattered in 1539 folders.
  • Reimplemented pitivi’s clip import process using the asynchroneous gst discoverer, which means that not only does the import progressbar work again, but it is blazing fast and doesn’t block the UI.
  • Cleaned up code, standardized variables and fixed various bugs (such as seeking to the end of the timeline, or making the viewer check the pipeline position only when actually playing… your CPU will thank me)
  • Implemented the ability to save/export the current frame as an image file. Hey, the code was just sitting there in GES, waiting to be used!
  • Got convinced by Thibault to try implementing transitions and timeline video thumbnails myself. We’ll see how it goes.

We stayed one or two days after the end of the hackfest. Thus, on Saturday, pretty much the only day where weather sucked, the superhacker trio went on a touristic ride to Ronda, in awe at some of the alpine beauties of Andalucía:

More pics here.

This week made me realize/feel something even more strongly than before: since Thibault’s massive cleanup, hacking on Pitivi with GES is easy. No more files/modules confusion. No more “massive core” getting in your way. The code can still benefit from some cleanup/simplifications to make it feel more “pythonic” (patches welcome), but it already feels incredibly more agile and elegant. It now feels enjoyable rather than a maintenance ordeal. More like poetry, less like a thesis.

If you were hesitating to contribute to Pitivi, now is an exciting time to take a fresh look at it. We need help and there’s a lot of low hanging fruit that can be fixed. We’ll be happy to help you get started.

Gstreamer HackFest 2012 in Malaga

Last week, I attended the GStreamer HackFest in Malaga and it turned out to be a very good decision to be there! First of all, I got to meet my two mentors for the OPW (Jeff and Thibault) and Edward, who first started PiTiVi and work closely with them for 3 days. Also, I got to meet a lot of people working on the porting of several applications to GStreamer 0.11. It was a great HackFest and I thank all the people that made it happen.

Working closely with the other PiTiVi team members, offered me the opportunity to work in a more efficient way (by clarifying many things that seemed to confuse me) and get to feel the team spirit (which is a greeeat power of motivation). Meeting all these people made me demystify what exactly is the challenge and the advantages to come while porting PiTiVi to GES. The challenge is that the development of GES is being done almost simultaneously with the porting, so some features/functions could be still not implemented and the advantages are that after the porting advances, the code of PiTiVi will be cleaner and smarter.

As far as the undo/redo functionality is concerned, the MediaLibrary and Timeline parts are working now fine and I am on the Effect part, which must be finally ok very soon (hope today...).

Restoring from backups

I’m currently in Málaga for the GStreamer hackfest. Hopefully, many bugs will perish. In the meantime, here’s a quick status update of stuff I’ve been doing in recent times in Pitivi.

  • Cleanup the code for gtk actions so that the code is more readable and robust, fixing 629208 in the process.
  • Cleanup the menus (again).
  • Avoid having the viewer eating the CPU while idle.
  • Fix various problems such as “Select unused clips” not working in treeview mode or reimplement removing all timeline instances of a clip when removing it from the media library.
  • With the help of Brian Grohe, merge and delete spam user accounts on the wiki. I only have to fix image uploads and the https certificate issue now.
  • Start fixing 629855; see below for details.

It turns out that pitivi was secretly writing autosave/backups of your project files (and deleted them when successfully saving/closing), but it did not actually use them. You’d have to know they exist, when they exist and where to find them, which is hardly intuitive.

So, I set out to fix this. Along the way, I ended up making the “unsaved changes” dialog more helpful. This is the result:

Then I worked on the actual dialog to prompt the user about the existence of an autosaved project file. It uses uses the same mind-blowing human-readable time formatting nekohayan technology, as you can see in the various following scenarios:

If you ignore the backup file, it will obviously be deleted when you cleanly save/close the project.

The big question is however, what we should do if the user selects to restore from backup:

  • Should we simply rename the backup file to overwrite the “old” project file and then load it? This would mean the “old” project would be lost. In theory nothing should go wrong with that…
  • If we want to be paranoid perhaps we could load the backup file as a temporary file and force the user to use “Save as” instead of a regular Save, but I’m not sure if that’s what users need. Thoughts welcome on this one, but I’d really like to have a simple solution.

Quick Description of Modules (PiTiVi) - and do I see them used-

Core

GLib
low-level - Provides us with the implementation of fundamental types and algorithms. It is a base upon which, everything is constructed.
-In PiTiVi, I see the GLib basic types (gboolean, gchar, gint, gfloat, gdouble etc)-

GObject
With the GObject, GLib provides us with the implementation of an object-oriented framework for C.
-In PiTiVi, I see the gobject functions (http://www.pygtk.org/pygtk2reference/gobject-functions.html)-

GStreamer
A multimedia framework that allows us to do anything multimedia-related. It is very flexible and uses elements
that are packaged in the form of plugins.
These elements can be codecs/demuxers/lmuxer/effects etc.
One set of these plugins are the GNonLin plugins, which are the ones who implement anything related to the logic
of video editing in GStreamer. Mainly, handle the timing of reading different multimedia files.

GES (GStreamer Editing Services)
A library created on top of GNonLin plugins, making the use of GNonLin plugins easier to use. It wraps the
GNonLin elements by offering an API of higher level.

In Pitivi, the GNonLin plugins were used directly, up to now and this is why the porting to GES will facilitate
a lot the design of the project.
So, we are using GStreamer via GES and the most objects used are GES ones (even if they come from GStreamer classes).

UI

GTK+
Toolkit for creating graphical user interfaces. Providing standard widgets and event handling. Based also in GLib.

GooCanvas
One of GTK+ widgets, used for drawing.

All of these components are based in GLib and communicate through it and its signals.


So, if I just want to add quickly GES in the PiTiVi' s wiki diagram (https://wiki.pitivi.org/wiki/Architecture), I would add it here:





Pitivi: Undo / Redo Functionality (GES Porting)


So, after spending some days "beating around the bush", trying to integrate myself to the project by following the team' s work, getting to understand the backbone of the project' s code, I get deep into my task, the undo/ redo functionality.

Firstly, I thought of checking about the undo/redo philosophy in applications in general, which helped me get what was implemented in Pitivi_0.15, undo/redo with a stack approach: (en gros) Having an undo stack where every action taken by the user is logged and saved, so every time he wants to return to the previous state, the undo stack is popped. For redo also, the current state is being saved into the redo stack, before an undo is being performed. So, if we regretted having "undone", the redo stack is popped and the new current state is pushed to the undo stack.

What helps me a lot in understanding the logic of the undo implementation in pitivi_0.15 is to check the code at this version while the undo is still working. Now, with the new restructurate version of the project though, the undo classes and code are grouped together under a specific /undo folder.

While Thiblahute was helping me to get started with my task, he already gave a patch which enables the undo/redo functionality in the MediaLibrary:

http://git.pitivi.org/?p=pitivi.git;a=commit;h=418f71b3f7805270df760ec10cb5ed0a7027786e

(which had to do with the use of GstDiscovererInfo in the place of PitiviFactory, information that I have but I don't actually understand what it implies, so I should get more informed about it.....Hmm, if there will be things related to that that don' t allow undo to work now).

And now I am looking for the next step which will be the undo in the Timeline.

In order to work better, I am getting used to the debug system, setting breakpoints and even just printing.




Spring clean-up in January

Now that we’ve gotten rid of a ton of code in Pitivi (thanks to the port to GES), Thibault has been doing an incredible job at cleaning and reorganizing the remaining source files in a way that finally makes sense. I’m very happy about this: it means that it will not only make it easier for new contributors to get started, but also for regular contributors to not get lost in the various modules.

Behold, before (left) and after (right):

The old file tree was so big that it did not fit on a rotated 1920×1200 monitor, even with Nautilus fully zoomed out. Note that the tests/ directory is not shown here, it went from 33 test cases to 18 and now runs in one second (since the core tests are now in GES).

If you fail to be utterly amazed and emotional about what I’ve just shown here, I’ll make sure to explain properly the jawdropping significance of this cleanup (and the whole GES port in general), whenever I get a chance to make a talk at some hip conference.

Stuff I’ve been doing in general in the last three weeks:

  • Fixed a couple of GES integration bugs in Pitivi. There’s still lots of work to do, but we’re getting closer to being able to make a first alpha release for your enjoyment.
  • Redesigned the clip previewing feature. Instead of showing in the tiny timeline previewer, it now shows in a separate window that tries to show the clip at 1:1 size whenever possible. This window can be dismissed by clicking the close button or clicking anywhere outside the window, so there is no reduction of efficiency compared to the old approach.
  • Merged, at long last, the power management branch. Pitivi will now inhibit the screensaver when playing and inhibit suspend when rendering.
  • Make pitivi use Nautilus/Totem’s thumbnails. The result is prettier and we don’t have to do processing in most cases, which means even faster import/loading times.
  • Pushed all that goodness to Pitivi’s origin (main repository) in a “ges” branch.
  • Closed over a hundred old PackageKit bug reports on Freedesktop bugzilla. Hughsie should breathe a little bit more easily now.
  • Finally killed all the spam pages (1000+) and images (500+) on the pitivi wiki, using the DeletePagePermanently Mediawiki extension (had to patch it for 1.17, see the talk page) and a horrible, horrible homemade python script to delete the pages automatically by opening hundreds of tabs in Firefox, accessing the “&action=delete_permanently” URL directly.
    • The remaining problem is that I haven’t found a way to efficiently purge the remaining 800+ fake user accounts yet. Ideas welcome, the UserAdmin extension does not work with anything but Mediawiki 1.16 (and it seems unmaintained).

Me, fixing bugs. Or spending way too much time playing Vindictus.

In related news:

  • At the end of January, I will be attending the GStreamer hackfest in Malaga, Spain. I predict that intense bug squashing will ensue. Come say hi if you’re around.
  • Can someone please tell me if bug 666916 is a pygtk bug, a gtk bug or something I’ve done wrong? The same code was working a year ago. Current code here, offending line is #911.

First days...

During these first two weeks of my internship, it has been studying time...
Studying a lot of things useful, about: git (mostly progit.org), python (mostly docs.python.org), gstreamer, ges, video formats generally.

It has been a greeat time learning in detail, how powerful git and python are! I think that sacrificing some time in the beginning to get more general knowledge and confidence is something worth doing, than attacking specific tiny parts of the project. And I am sure that this time "lost", will be compensating us afterwards.

Now, I am focusing in understanding the pitivi project better... I am following the commits and the irc discussions from the pitivi team, which helps a lot and I will be trying to re-enable the undo/redo functionality in the ges-ported version for the beginning.

The beginning is never so elegant, but it is so refreshing and challenging, feeling as a newbie again and again...




Alive and kicking

I would first like to welcome Antigoni, who has been accepted as part of GWOP 2011 to work on PiTiVi. In the coming months, she will be helping Thibault fix bugs in our port to GES and, when we have a reasonably stable base to work with, implement the much awaited titling feature! She wrote an introductory post, but since it was published before she was added to Planet GNOME, it has completely flown under the radar.

I haven’t blogged much since the 0.15 release, partly because I was, you know, busy finishing* a graduate degree with 5 courses including 3 teamwork term projects and writing 13 case studies/papers. Nothing special.

Up until recently, I was thus unavailable for development work and Thibault could only work part time on the port to GES. Nonetheless, he has been steadily improving it. We now both have at least three weeks “full-time” ahead of us and a great intern to help us! As you can see, rumors of our death have been greatly exagerated. Our countless fans can rest assured.

Here’s one of the side-effects of development with Git: you don’t have to commit directly on master all the time, and so the lack of visible activity on “master” does not mean there is no development activity going on. Indeed, a lot of activity happens on github, and if you take Thibault’s “ges-port” branch into account you would see something like this:

Even when rotated 90°, my 1920x1200 screen does not have a high-enough resolution to fit the list of all the commits since 0.15! I’m not going to tell you yet how mindbogglingly huge and significant those changes are, because we’re not done yet and I want to keep some element of surprise (you may remember it is one of my chief weapons in my presentations). Let’s just say that this vastly simplifies development on pitivi. If we succeed, we will achieve world domination by the end of the world.

Now, you may ask, why hasn’t this been merged to master already? Because it’s quite unpolished and, in Thibault’s words, does not “deserve” to be there yet. I personally maintain a document listing all the bugs this branch has, and there are currently 15 of them. We may push to a branch in the official repository or merge directly to master as soon as we get the most severe bugs ironed out (hopefully very soon).

Your help is, as always, very appreciated. Feel free to chat with us on IRC about the state of the GES port and the way you can help us achieve our goal.

*: by the way, if you’re hiring and looking for a passionate open source contributor with a graduate degree in management (and a bachelor’s in psychology), feel free to poke nekohayo on IRC (or by mail, at gmail.com)!

Say hi to the other kids, tsinaski!

-Hi other kids, this will be my blog!

The quest for knowledge, wisdom and originality never stops. Sometimes you think it advances, but then you see that you are only on the wrong way. 

When one is about to finish his studies, the professional originality and integrity is really taking a lot of place in his mind (or should... or it just does, in my case) ... I have been studying for a Computer Science bachelor 4 years and for a Computer Science master 2 more years. What I like mostly about it, is the freedom in this field. But freedom is not so ea-eas-sy to find! ("Freedom is impossible, this I know" Madrugada) But I know it is there! I know I can use these things I have been studying for purposes that my heart and mind approve and NOT just design the next processor who will sell as the Devil and make Me Rich!


Ah, ha, ha, ha (Professor Chaos - evil laughing) I know I can do that... (in the future?!)

A very wise Greek (and surely, not only Greek) proverb says: "Never postpone something for tomorrow, if you can do it today". So, let's look towards the open source - free software.

I have been accepted for the Gnome' s OPW internship and I feel so happy to consume my energy, mind-work, back-ache for something that seems such a good idea (between so many baaad ideas I can see in the world around me).

I will be working on Pitivi - video editing software during my internship, which is very appealing, as I will have the chance to work on video formats, python and GUI environment, which is something I have missed (snif) while dealing with hardware in my Master :) This blog will be hosting updates from my work on it.

Bon appetit!



P.S.: YES, I am naive, I live in an utopia and I know. Nice to meet me!







Homework :)

I had plenty of other things to do today, so I iterated from that code :
http://encrypt3d.wordpress.com/2007/06/19/level-order-traversal/ , which I found pretty elegant.

Function of the code:

Breadth first tree traversal, display the level and show if the node is the first one of its level (starting from the left).

Missing:

As it was homework, I had to give the is_first property. What would be better would be to display the order of the node in the level.
Also, wondering about the best way to display a tree.
May'be starting by the bottom ?


Code:


typedef struct s_infos
{
  int is_first;
  int level;
  t_btree *node;
} t_infos;

t_infos    *create_new(t_infos *par, t_btree *n, int first)
{
  t_infos    *q;

  q = malloc(sizeof(t_infos));
  q->node = n;
  q->is_first = first ? 0 : 1;
  if (par)
    q->level = par->level + 1;
  else
    q->level = 0;
  return(q);
}

void    levelorder(t_btree *p,
        void (*applyf)(void *item,
                   int current_level,
                   int is_first_elem),
        int *size,
        int *qptr)
{
  t_infos    **queue;
  int    *tab;
  t_infos    *q;

  q = create_new(0, p, 0);
  tab = malloc(sizeof(int) * 100);
  queue = malloc(sizeof(t_infos *) * 100);
  while(q)
    {
      applyf(q->node->item, q->level, q->is_first);
      if(q->node->left)
    {
      queue[*size] = create_new(q, q->node->left, tab[q->level + 1]);
      *size += 1;
      tab[q->level + 1] = 1;
    }
      if(q->node->right)
    {
      queue[*size] = create_new(q, q->node->right, tab[q->level + 1]);
      *size += 1;
      tab[q->level + 1] = 1;
    }
      q = queue[*qptr];
      *qptr += 1;
    }
}

void    *btree_apply_by_level(t_btree *root,
                              void (*applyf)(void *item,
                                             int current_level,
                                             int is_first_elem))
{
  int    size;
  int    qptr;

  size = 0;
  qptr = 0;
  levelorder(root, applyf, &size, &qptr);
}

Usage:

Let root be the root of the tree, and applyf the adress of a function returning void and using as arguments the data of each processed node, its level and its is_first property (Crap how useless is that ..) Also, t_btree is a classical node structure containing the left child, the right child and the data.

Also, today I coded a function that allows you to insert a data in a red black tree.
I'll try to post that  when I have time, it's a little longer but I think it's worth it.