In January I started changing Cheese to use Camerabin as its pipeline base. I blogged about it twice, but, in case you missed it or forgot everything about it, let me repeat myself: Camerabin is the high level GStreamer element that basically does what a camera does, that is, take pictures, record video and show preview. Since Cheese does all that and more, it makes sense to use this element instead of re-implementing it all. The news part is that this work is now in Cheese’s master branch and also in release 2.91.91.
There are some other things I haven’t posted about yet:
Event handling: There was a warning in Cheese after the change to Camerabin which said “Internal GStreamer error: clock problem“. Investigating that I discovered that it was a problem in the input-selector that Camerabin uses internally.
Right now Camerabin has a copy of input-selector, because it uses the “select-all” property that was removed from current input-selector. The problem was that the input-selector didn’t handle upstream events (from the sink to the source direction) when the input-selector had the “select-all” property set. Well, input-selector can have many inputs and choose among them, as you can guess from the name. So, when select-all is set you need to send the event to all of those inputs. Other than the warning, this actually has no effect in Cheese’s case, because the event that is not forwarded (a latency event) wouldn’t actually be handled by the elements that don’t get it. Even so, I submitted a patch which was committed to master branch of gst-plugins-bad.
Taking photo without saving: Cheese Camera has a method that takes a photo and then provides the picture as a GDK pixbuf without saving it. The api may not be the best and there were some nice comments on how to improve it, but at least in Cheese without Camerabin this worked and it was used inside of cheese-avatar-chooser. Well, I didn’t realize that before my last blog post about Camerabin, but this was totally broken in my Camerabin branch, in fact, I hadn’t implement it at all.
Camerabin can send a preview message after taking a photo if you set the preview-caps with the desired format for the preview. I thought using the preview message was the best way to implement cheese_camera_take_photo_pixbuf(). The problem is that Camerabin only took photos to save them too, meaning the file name of the photo to be saved had to be set. Right now Cheese works around that by setting the file name to /dev/null, but I also sent a patch to Camerabin to allow taking a picture without saving if preview-caps is set, meaning it won’t encode the image just to save it to /dev/null. I’m keeping the workaround for now, since the change wasn’t released yet, but we will be able to remove it in the future.
Many thanks to Thiago Santos, who held my hand when I met those and other problems in Camerabin and who always encourages me to fix stuff and send patches.
I’m very excited about this change in Cheese. I’m sure there will be bugs, but I think using Camerabin will make some improvements in Cheese easier and we will grow with Camerabin (and maybe Camerabin2 in the future) and also push it to be better.