Integrating Cheese with Empathy is the main goal this summer of hot coding
The proposal that started this summer tournament can be found here:
Information about the project can be found on this ultra popular blog :
[Stories from the Thousand and One Nights ] Night one ~ The Cheese-avatar-chooser ~
It all started with a comment on my proposal...
I've already created code to do avatar selection in cheese, see the CheeseAvatarChooser widget, as it's used in the user-accounts panel in the control-center.
So.. I started coding an avatar chooser from Cheese for Empathy
In a few words if you didn’t see it already on Planet GNOME:
Open Empathy and try to change your avatar. In the dialog that typically had the option of browsing for an image I added another "wonder button" called "Take a photo..." If you have the courage to push the button( ...MUA-HA-HA!! ... you wouldn't dare pushing that button!!! :p ) another dialog opens, the camera dialog from Cheese. Finally you can take photos till you look handsome enough and have the coolest avatar ever
The history of the battle:
In the end, the patch was merged. Thanks go out to Guillaume Desmottes for reviewing.
Here you can see some screenshots:
Although the patch works perfectly with a recorded video there are cases when it crashes using a real camera. I tried to determine why does it hang, why does it behave like that but till now I just have a wild guess that it may be a race condition, somebody taking a lock and never making unlock. I made a test case for this in which I showed when and how it happens. I posted the demo on the list but still I have no relevant solution.
You can download and try it for yourself following the link: test-choose-hang.c
Also the the project repository can be found here:
I also started looking at the code of Empathy. I didn’t get very deep into it but I made an idea about the way the video stream is handled . Also after having a discussion with my mentor Luciana Fuji I retched the conclusion that a month and a half for the integration may be a little optimistic. Because of the big differences between the way the video stream is handled in Cheese and Empathy I approximate that this process will last two weeks more then according to the initial plan but let’s not be pessimistic about that :p you never know.
- I’ll continue reading Empathy’s and Cheese’ sources.
- I’ll get a little familiar with Gstreamer and Clutter.
Hope that things will be clearer and maybe propose a doable approach of this matter. I am still thinking and waiting for a solution for the hang I wrote above.
[Stories from the Thousand and One Nights ] Night two ~ The Cheese state of mind ~
Next to adding the miraculous button for "take a photo" I had to redesign a little the take a photo dialog so that would look better. For this I had to learn some things about GObject and GTK. We ended up from this version:
to this one :
Another improvement was done regarding the minimum and maximum size of the avatar. The task sounded like this:
Some IM protocols have requierement on the minimal and maximum dimension of the avatar. It would be good to be able to pass those to the avatar chooser so user wouldn't be able to choose an avatar not fitting these dimensions.
The history for this adjustment can be found here:
Next I worked at the effects preview window. Before the patch written for it, when you scaled Cheese's main window, in the the effects preview mode, the window would scale but the 9 videos inside the window would remain at the same size.
Now you can have something like this with all the effects properly scaled:
[Stories from the Thousand and One Nights ] Night three ~ A camerabin2 story ~
One important part of this project involved working with GStreamer.
GStreamer is a library for constructing graphs of media-handling components. The applications supports range from simple Ogg/Vorbis playback, audio/video streaming to complex audio (mixing) and video (non-linear editing) processing. Applications can take advantage of advances in codec and filter technology transparently. Developers can add new codecs and filters by writing a simple plugin with a clean, generic interface.
Camerabin is a single element and has some complex code with input/output-selectors for controlling the flow of buffers.
Camerabin2 is a brand new camerabin better than the old one and much more flexible. Looking at its internals I also had the chance to learn how to use the dot files. Bellow the page you can see images generated in dot files of the complete pipeline including camerabin2 before and after changing some caps. The change happens when Cheese switches from one mode(picture) to the other(video). Before the caps change the pipeline looks like this:
After switching it looks like this:
Cheese needed to switch from camerabin to camerabin2 which is more flexible than the previous camerabin version. For the switch there were some adjustments to be made.
Support for viewfinder and effects preview
There were minimal changes to be done to integrate camerabin2. These included providing support for both viewfinder (Cheese's main window) and effects preview. Camerabin2 requires something special from its "camera-source". For that "wrappercamerabinsrc" module was used so that "camera-source" could be created. In particular for camera-source the video filter applies to all modes (If the effect is applied on camera_source, the effect will be available in viewfinder and image/video capture modes)
As in every porting some renaming had to be done :
- "filename"(cheese-camera) to "location"
- the signals were renamed from capture-start/stop to start/stop-capture
In "cheese-thumb-view.c" we had to handle the case of photo/video moved to monitored directories. The use case is the following : Camerabin2 creates a temporary file, writes data into it and finally it moves it to the destination path. Without G_FILE_MONITOR_SEND_MOVED to g_file_monitor_directory, moves would be sent as DELETE + CREATE. Unfortunately, we would also get CREATE events when the temporary file would be created. We cannot listen to CREATE events as temporary files would be CREATED and then CHANGED and the thumb-view creation code would work with bad data . By using G_FILE_MONITOR_SEND_MOVED we get a single event when the file is moved. As the file monitor ignores files with unknown extensions (as is the case for the temporary files created by camerabin2) we could only just append the new file. Because the user might also move a picture/video manually from the Pictures/Webcam or Videos/Webcam directories, removing the old file from the thumb-view keeps it up-to-date with the state of the file system. If Camerabin2 switches away from the create-temp+move approach, to the camerabin one (create the destination file directly), we're prepared to handle that code with G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT.
Switching from signal to bus message
For performance reasons the signal "image-done" from camerabin changed in camerabin2 to a bus message.
Fixes in camerabin2
Last but not least I managed to fix pixbuff-only capture (capturing and storing an image only in memory used for an avatar), but Thiago Santos provided a better solution. This week I also developed other patches for camerabin2, most of them clean-up patches.
Some of the patches made at this time can be found here:
[Stories from the Thousand and One Nights ] Night four ~ Cheesy effects attack Empathy ~
Clutter is an open source software library for creating fast, compelling, portable, and dynamic graphical user interfaces. It is a core part of MeeGo, and is supported by the open source community.
At this point I got some Clutter experience because as Cheese uses Clutter also Empathy wanted to switch from GTK drawing to Clutter,important changes were starting to appear in the UI of Empathy and mostly I was interested in the modifications on the video-call window. Some of the discussions can be found here:
I first ported Cheese's Video source to decouple it from depending on ClutterTexture, but after some talk with my mentor I decided to discard those changes and make Empathy use ClutterTexture in the first place.
I finished the implementation of Empathy's video widget with a simpler GTK-Clutter based implementation and did some cleanups made possible by the simpler implementation:
I changed empathy-video-widget to use ClutterTexture. Emilio Pozuelo Monfort was working on something similar, but from another angle. His patch has got in as it works towards a better UI (the video preview from the user's camera is now displayed on top of the video from the other participant in the video chat). At list I helped a bit by find out how to make the ClutterTexture scale the video stream while maintaining aspect ratio
The discussion of the work done for integrating the effects from Cheese to Empathy can be found here:
Till now in a short story:
Next to the camera button in the Empathy video-call window I added a new shiny button for video effects.
Hmmmmm...Let's add some color to this face...maybe this will do :
Cooooooolish !!!! >:P
If you click on it (MUA-HA-HA! you wouldn't dare to push teh button! ) the effects window will show up, just like in the image bellow.
You can choose from a variance of six effects per page one that you like the most just like in this case :
Voila! You can have a video conversation with the coolest effects !!
I still have to implement the sliding from one page of effects to another and I think that it will be ready by tomorrow. Also, if you would like another button instead of teh button please let me know.
So much to do... so little of this summer left :P... Coming soon! Be prepared for a massive attack of cheesy effects !
Gnome reports made during the project: