Archive

Archive for the ‘GNOME’ Category

The GStreamer conference from a Clutter point of view

November 16th, 2010 No comments

Two weeks ago I attended the first GStreamer conference, and it was great. I won’t talk about the 1.0 plan that seems to take shape and looks really good but just what stroke me the most: Happy Clutter Stories and an Tale To Be Told to your manager.

Let’s move on the Clutter stories. You had a surprising number of people mixing GStreamer and Clutter, two talks especially:

  • Florent Thiery founder of Ubicast talked about one of their products: a portable recording system with quite a bit of bling (records the slides, movement detection with OpenCV, RoI, …). The system was used to record the talks on the main track. Now, what was of particular interest for me is that the UI to control the system is entirely written with Clutter and python. They have built a whole toolkit on top of Clutter, in python, called candies/touchwizard and written their UI with it, cooool.
  • A very impressive talk from the Tanberg (now Cisco) guys about their Movi software, video conferencing at its finest. It uses GStreamer extensively and Clutter for its UI (on Windows!). They said that about 150,000 copies of Movi are deployed in the wild. Patches from Ole André Vadla Ravnås and Haakon Sporsheim have been flowing to Clutter and Clutter-gst (win32 support).

As a side note, Fluendo talked about their Open Source, Intel founded, GStreamer codecs for Intel CE3100/CE4100. This platform specificities are supported natively by Clutter (./configure –with-flavour=cex100) using the native EGL winsys called “GDL” and evdev events coming from the kernel. More on this later :p

A very interesting point about those success stories is that the companies and engineers working with open source software to build their applications, sometimes with parts heavily covered by patents, while contributing back to the ecosystem that allowed to build those applications in the first place. Contributing is done at many levels: directly patches but also feedback on the libraries/platform (eg. input for GStreamer 1.0). And guess what? It works! To me, that’s exactly how the GNOME platform should be used to build proprietary applications: build on top and contribute back to consolidate the libraries. I’d go as far as saying that contributing upstream is the best way to share code inside the same big corporation. Such companies are always very bad a cooperating between divisions.

Categories: Clutter, GNOME

g_object_notify_by_pspec()

September 28th, 2010 No comments

Now that GLib 2.26.0 is out, it’s time to talk about a little patch to GObject I’ve written (well, the original idea was born while looking at it with Neil): add a new g_object_notify_by_pspec() symbol to GObject. As shown in the bug it can improve the notification of GObject properties by 10-15% (the test case tested was without any handler connected to the notify signal).

If you can depend on GLib 2.26, consider using it!

Categories: GNOME

Using glib.py and gobject.py GDB scripts

March 23rd, 2010 No comments

Some time ago, Alexander Larson blogged about using gdb python macros when debugging Glib and GObject projects. I’ve wanted to try those for ages, so I spent part of the week-end looking at what you could do with the new python enabled GDB, result: quite a lot of neat stuff!

Let’s start by making the script that now comes with glib work on stock gdb 7.0 and 7.1 (ie not the archer branch that contains more of the python work). If those two scripts don’t work for you yet (because your distribution is not packaging them, or is packaging a stock gdb 7.0. 7.1), here are a few hints you can follow:

  • glib’s GDB macros rely on GDB’s auto-load feature, ie, every time GDB load a library your program uses, it’ll look for a corresponding python script to execute:
open("/lib/libglib-2.0.so.0.2200.4-gdb.py", O_RDONLY)
open("/usr/lib/debug/lib/libglib-2.0.so.0.2200.4-gdb.py", O_RDONLY)
open("/usr/share/gdb/auto-load/lib/libglib-2.0.so.0.2200.4-gdb.py", O_RDONLY)

Some distributions have decided not to ship glib’s and gobject’s auto-load helpers, if you are in that case, you’d need to load gobject.py and glib.py by hand. For that purpose I’ve added a small python command in my ~/.gdbinit:

import os.path
import sys
import gdb

# Update module path.
dir = os.path.join(os.path.expanduser("~"), ".gdb")
if not dir in sys.path:
    sys.path.insert(0, dir)

class RegisterCommand (gdb.Command):
"""Register GLib and GObject modules"""

    def __init__ (self):
        super (RegisterCommand, self).__init__ ("gregister",
        gdb.COMMAND_DATA,
        gdb.COMPLETE_NONE)

def invoke (self, arg, from_tty):
    objects = gdb.objfiles ()
    for object in objects:
        if object.filename.find ("libglib-2.0.so.") != -1:
            from glib import register
            register (object)
        elif object.filename.find ("libgobject-2.0.so.") != -1:
            from gobject import register
            register (object)

RegisterCommand ()
end

What I do is put glib.py and gobject.py in a ~/.gdb directory and don’t forget to call gregister inside GDB (once gdb has loaded glib and gobject)

  • The scripts that are inside glib’s repository were written with the archer branch of gdb (which bring all the python stuff). Unfortunately stock GDB (7.0 and 7.1) does not have everything the archer gdb has. I have a couple of patches to fix that in the queue. Meanwhile you can grab them in my survival kit repository. This will disable the back trace filters as they are still not in stock GDB.

You’re all set! it’s time to enjoy pretty printing and gforeach. Hopefully people will join the fun at some point and add more GDB python macro goodness both inside glib and in other projects (for instance a ClutterActor could print its name).

int main (int argc, char **argv)
{
	glist = g_list_append (glist, "first");
	glist = g_list_append (glist, "second");

	return breeeaaak_oooon_meeeee ();
}

gives:

(gdb) b breeeaaak_oooon_meeeee
Breakpoint 1 at 0x80484b7: file glib.c, line 9.
(gdb) r
Starting program: /home/damien/src/test-gdb/glib
Breakpoint 1, breeeaaak_oooon_meeeee () at glib.c:9
9        return 0;
(gdb) gregister
(gdb) gforeach s in glistp: print ((char *)$s)
No symbol "glistp" in current context.
(gdb) gforeach s in glist: print ((char *)$s)
$2 = 0x80485d0 "first"
$3 = 0x80485d6 "second"
Categories: GNOME

Aligning C function parameters with vim

December 7th, 2009 8 comments

updated: now saves/retores the paste register

It has bothered me for a while, some coding styles, most notably in the GNOME world try to enforce good looking alignment of functions parameters such as:

static UniqueResponse
on_unique_message_received (UniqueApp         *unique_app,
                            gint               command,
                            UniqueMessageData *message_data,
                            guint              time_,
                            gpointer           user_data)
{
}

Until now, I aligned the arguments by hand, but that time is over! Please welcome my first substantial vim plugin: it defines a GNOMEAlignArguments command to help you in that task. All you have to do is to add this file in your ~/.vim/plugin directory and define a macro in your ~/.vimrc to invoke it just like this:

" Align arguments
nmap ,a :GNOMEAlignArguments<CR>

HTH.

Categories: GNOME