GSoC Weekly Code Report 1

I'm reporting a bit late this week, but that's because of rather huge amount of work I had been had. This week was the first official when the code writing takes a start. Anyway, I've started a bit earlier, so I already have some fresh results :) Also I will have exams in university in June, and it's a time to get prepared now, but I'm trying to dedicate to GSoC as much time as I can. Well, what was happened this week:

  • finally, I made a new amaizing (at least I think so :)) hackergotchi and it was accepted. Thanks to Lucas Rocha for denying my first bad attempts - the last one really rocks :)

  • added ability to add/rename/remove chapters in my plugin. We discussed with Bastien some concepts related to it, so how does it work now: while watching the video you can press "Add chapter" button, video playback becomes paused, you are entering the name of a new chapter, and then playback resumes. Of course, new chapter appears in the list, with pixbuf related to it's time stamp. Here is how you can add a chapter:



    And here is a screenshot with some chapters added to the list during movie watching (yeah, that's a House M.D.:)):



    You can also remove or rename any of the chapters by clicking appropriate button. All chapters are displayed in the list by time growth. We still thinking about editing chapter's start time, maybe it would be better only to seek to chapter's time;

  • now you can also save all changes made with chapters - just click "Save" button. All chapters are stored in separated cmml file (like subtitles in srt file). But there is still a problem with saving chapters' thumbnails. There are a few ways to fix it: to cache them somewhere (but if you will transfer file with chapters onto another computer, plugin will need to regenerate all thumbnails from video file by going through it, which is not cool, however folks at GStreamer channel with Bastien suggested some ways) or to store them directly into the cmml file. For now I'm trying to utilise second approach, but there is a problem with serializing pixbuf data and storing it in cmml file. So, I'll mail to people who wrote cmml draft, maybe they can make things a bit more clear;

  • removed end time and duration attributes from the chapter - we do not need them, because chapter acts like a marker or a live bookmark;

  • started to read git manual, as well as the GTK+ / GNOME Application Developer book;

  • refactored and cleaned up code a bit.


I think it's not a time to test a plugin yet, but you can already touch it and feel how it works. Any feedback and suggestions are welcomed :) Next week I want to try to solve problem with saving thumbnails, to write some words on my wiki page and... to do some more progress on my plugin :)

GSoC Weekly Report Pre 2

This week I have been working on the clip list implementation in the Totem sidebar. Last week I had been working on parsing cmml file and listing all the found chapters to stdout. So, this week it's a time to make some GUI :)

The basic idea was to make something like this:



At the right side you can see chapters sidebar. There is a list of available clips for playing video. For the every clip there should be a title, start time and a pixbuf with the start frame. Also tooltip for the clip should display all available info (except the pixbuf, I think). Here is a screenshot of how the chapters plugin looks like:



So, what I've done:

  • made a new one hakergotchi - hope it would be accepted :)

  • added to the Totem sidebar list with all available chapters for the current video file;

  • added tooltips for clips in the list, like this one:


    Firstly I implemented tooltips using "has-tooltip" property and "query-tooltip" signal, but I don't like that tooltip doesn't change it's position during the cursor movement over the GtkTreeView rows, so I made it using tooltip column;

  • added navigation between clips by double clicking on them or pressing the Enter key ("row-activated" signal);

  • there was a small problem with navigation: Totem uses GST_SEEK_FLAG_KEY_UNIT while seeking through the video files via GStreamer, and such seek isn't accurate enough - on 2 hours video the difference between the time you want to seek and the time you will actually seek at may be about 10 - 15 seconds, which is too much. I talked with Bastien and made a small patch for the Totem which adds ability to seek accuarately using GST_SEEK_FLAG_ACCURATE. Now navigation works fine :) This was my first experience with making git patches, using git-bz extension - I'm going to read git manual more carefully

  • added clips' pixbufs into the list, they are just black for now;

  • cleaned up code and fixed some bugs.


The coding part of GSoC starts next week , so it will be a time for getting more fun :) First of all, I need to find a way to get frames for clips' pixbufs. Also I'll start to implement writing support for chapters (edit, add, remove), even if video file doesn't have a cmml file. Stay tuned :)

GSoC Weekly Report 1

As part of the comminity bonding period (and not only) I'll be posting weekly status reports in my GSoC project. This way interested people will be in touch with project. So, let's try to start :)

This week I was doing:

  • created repository with my chapters plugin: git://gitorious.org/totem-chapters/master.git. libcmml is required in order to use chapters plugin, you can retrieve it here: http://svn.annodex.net/libcmml. Please, use 0.9.4 version from trunk. You can find a test cmml file (test.cmml) in chapters plugin directory;

  • created my first empty Totem plugin based on sidebar-test plugin. I'm not great at GObject, so it was a good practice for me, and now I'm understanding it better. I think practice is a main way to understand complicated things;

  • learned Totem build system a bit :)

  • discussed with Bastien the way I'll be working on project in near time. So, my first target is to make chapters plugin capable to read cmml file when video file is opened, and printf() chapters' titles and descriptions;

  • first lines of experimental code: to feel Totem plugin capabilities, to feel libcmml, to feel GLib better. Thanks Bastien for pointing me on my dirty code lines. Here is a first small result:



    To make it possible just rename the test cmml file like your video file named (e.g. test-case.cmml for test-case.ogv) and open video in Totem;

  • writing this blog post :)


I have to say, that it's a great to participate in GNOME community. However I'm not familiar with GStreamer folks yet, but I'll try to do it soon, as I already have some questions :)

As for future plans, I'll try to write some GTK code (I was not using GTK much before, so it will be a good practice for me again) to make list of chapters visible at least. This week was rather exciting and I'm looking for the next one ;)

About my GSoC project (Totem chapters/markers support)

So, I've been accepted for GSoC 2010 and I'm glad to do some nice stuff for GNOME, as it's my favourite DE :) I'll be working on implementing chapter/markers support for Totem player. I'm translating Totem into Russian, and this summer I wanna to write some code for it. At first, let's talk about it more definitly.

Maybe you've heard about CMML[0][1]. It's a XML-based Continuous Media Markup Language. It's used by Annodex[2] as authoring language for annotations, indexing and hyperlinking. In other words, CMML file is essentially a textual representation of an Annodex file, as written in CMML draft. Basically it consists of XML preamble, "head" tag with some params like "title", "author" and others, "stream" tags for handling bitstreams of different types (audio, video, text, etc) in Annodex tracks, and "clip" tags for handling chapters in these streams. Annodex tracks are created on top of these all tags in CMML file. Annodex mapped into Ogg Skeleton container along with CMML bitstream. Let me show these relations on the figure below:

________ _________ _________ __________
\
| CMML | | Video | | Audio | | ... | |
________ _________ _________ __________ |
|
| skeleton | > Annodex
_____________________________________________ |
|
| Ogg | |
_____________________________________________ /

| HTTP | RTSP |
| _______________________|
|
| | RTP |
_____________________________________________

| TCP | UDP |
_____________________________________________

| IP |
_____________________________________________

As you see, the Annodex is a bit more complex thing than we need. We do not need to operate with media bitstreams - we just need some sort of annotations. And CMML is what we need. Also, Annodex was developed for Ogg Skeleton container (maybe it can be used with another container format, but I didn't find such implementations), and we can't use it for other video formats. So, I've talked with my mentor - Bastien Nocera (I'm really proud to work this summer with him :)) - and decided to use CMML for chapters. CMML was developed to use with Ogg, too (I can't find other implementations). We decided to use external .cmml file along with video file to read/write video chapters (as subtitles in separate file) - in such way we can use chapters with any video format Totem supports. Later maybe I'll implement embedded CMML support for Ogg container (as additional feature, I've already played around with Ogg container, just for future :)). It should looks like this:

----------
|stream | CMML
---------- instance
| head | document
----------
| clip_1 | ---------------------------------------------------
---------- | data bitstream in packets |
| ... | ---------------------------------------------------
---------- |
| clip_n | |
---------- |
| |
------->-<-------
| Multiplexing
|
v
---------------------------------------------------------------------
|stream|head|clip_1| data packets |clip_2| data packets ...
---------------------------------------------------------------------

But it's not the main target for now. By the way, I couldn't get libannodex working for writing, I'll see it more closely a bit later. My first step will be to parse CMML files in Totem plugin using libcmml and extract chapters information from them. I'm not greatly familiar with GLib and GTK+ (tried to write simple examples and did some university stuff with pthreads), so it will be a good expirience to learning these tools for me. I've read GLib docs, GObject docs and they are looking great ;) I like to learn new things and have a pleasure to do it.

And let's see at the CMML example document from the draft[1]:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE cmml SYSTEM "cmml.dtd">

<cmml lang="en">

<stream basetime="0">
<import contenttype="video/x-theora" src="fish.ogg" start="0"/>
</stream>

<head>
<title>Types of fish</title>
<meta name="Producer" content="Joe Ordinary"/>
<meta name="DC.Author" content="Joe's friend"/>
</head>

<clip id="intro" start="0" title="Introduction">
<a href="http://example.com/fish.html">Read more about fish</a>
<desc>This is the introduction to the film Joe made about fish.
</desc>
</clip>

<clip id="dolphin" start="npt:3.5" end="npt:0:05:05.9"
title="Dolphins">
<img src="dolphin.png"/>
<desc>Here, Joe caught sight of a dolphin in the ocean.</desc>
<meta name="Subject" content="dolphin"/>
</clip>

<clip id="goldfish" start="npt:0:05:05.9" title="Goldfish">
<a href="http://example.com/morefish.anx?id=goldfish">
More video clips on goldfish.
</a>
<img src="http://example.com/goldfish.png"/>
<desc>Joe has a fishtank at home with many colourful fish.
The common goldfish is one of them and Joe's favourite.
Here are some fabulous pictures he has taken of them.
</desc>
<meta name="Location" content="Joe's fishtank"/>
<meta name="Subject" content="goldfish"/>
</clip>

</cmml>


As you can see, there are a lot of tags that we don't need, like "stream", "a", "img" and so on. Chapter file will be very simple and clear to read. At least I hope :)

These were my first words via blog. I plan to post here my achievements and thoughts during GSoC (and maybe later, too). Also I will send weekly status reports on GNOME soc mailing list (and post them here, too) to be in touch with community :) Next time (I hope on weekends) I'll write about my plans, what I've already done and more info about my doings.

---------------------------------
[0]Wikipedia page
[1]CMML draft preiffer
[2]Annodex draft preiffer