These past two weeks I went just like Alice... in camerabin2 Wonderland :p
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. I tried to come up with a decent solution :D
Some work done is listed bellow :
1. 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)
2. Renaming needed
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
3. Thumb-view handling
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.
4. Switching from signal to bus message
For performance reasons the signal "image-done" from camerabin changed in camerabin2 to a bus message.
5. 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.
MUA-HA-HA!!! :p
No comments:
Post a Comment