GNOME Bugzilla – Bug 547140
resolution preference and gconf key can be ambiguos
Last modified: 2008-09-08 22:20:08 UTC
Here is what cheese -v says with Logitech cam: Detected webcam: Logitech QuickCam EC device: /dev/video0 video/x-raw-yuv 160 x 120 num_framerates 1 25/1 video/x-raw-yuv 320 x 240 num_framerates 1 25/1 video/x-raw-yuv 352 x 288 num_framerates 1 25/1 video/x-raw-yuv 176 x 144 num_framerates 1 25/1 video/x-raw-rgb 160 x 120 num_framerates 1 25/1 video/x-raw-rgb 320 x 240 num_framerates 1 25/1 video/x-raw-rgb 352 x 288 num_framerates 1 25/1 video/x-raw-rgb 176 x 144 num_framerates 1 25/1 video/x-raw-rgb 160 x 120 num_framerates 1 25/1 video/x-raw-rgb 320 x 240 num_framerates 1 25/1 video/x-raw-rgb 352 x 288 num_framerates 1 25/1 video/x-raw-rgb 176 x 144 num_framerates 1 25/1 video/x-raw-rgb 160 x 120 num_framerates 1 25/1 video/x-raw-rgb 320 x 240 num_framerates 1 25/1 video/x-raw-rgb 352 x 288 num_framerates 1 25/1 video/x-raw-rgb 176 x 144 num_framerates 1 25/1 v4lsrc name=video_source device=/dev/video0 ! capsfilter name=capsfilter caps=video/x-raw-rgb,width=352,height=288,framerate=25/1 ! identity As you can see there are 16 supported formats. Each resolution appears 4 times (don't care about repeated rgb formats, it's a related issue but I'm going to open a detailed bug about that). What we do in cheese_webcam_get_webcam_device_data is insert a resolution entry in the resolution hashtable with a key like widthxheight. This key is not unique. Several videoformats can have the same "widthxheight". So if the key already exists in the hashtable it gets replaced (with a leak since we're not setting a DestroyFunc for the values). This conflicts with the behavior of resolution combobox in preferences dialog which lists all 16 resolutions (with ambiguous repetitions). So if I select the first occurrence of 352x288 the following format is set: video/x-raw-yuv 352 x 288 but if I close cheese and reopen it the format is the latter occurrence of gconf resolution in formats array: video/x-raw-rgb 352 x 288
cc-ing James since he wrote that part and might be interested.
maybe bug #547144 should be solved first.
Filippo: Having just taken a look at that bug I concur. I don't see any reason whatsoever for this repetition. I sort of put together the hash table scheme on the assumption that this *wouldn't* happen. Solving that bug should fix this one if I understand correctly.
>Solving that bug should fix this one if I understand correctly. Not completely. That bug is about different formats within the same mimetype. Solving that is needed but wouldn't automatically solve this because x-raw-yuv and x-raw-rgb mimetype can still provide the same resolutions and we'll still have duplicates. The only way to solve this, imho, is to save both format and resolution in the hashtable (and in gconf). The hashtable key could have a format like: "x-raw-yuv@640x480". I'm not sure whether gconf is the right place to save that though. The user shouldn't be able to set a format/resolution out of the preferences dialog since these are not arbitrary and can have only a few possible values that can vary for each camera. Furthermore, this setting should be camera specific so having a single gconf key is not the best way to handle it. Anyway that's another issue.. Avoid duplicates should be enough for now.
Closing, fixed with the patches from bug #547144 and bug #546868.