GNOME Bugzilla – Bug 722696
gupnp_device_info_get_icon_url() returns low quality icon
Last modified: 2014-07-18 19:21:52 UTC
Created attachment 266872 [details] device.xml gupnp-0.20.9-1.fc20.x86_64 I run: gupnp_device_info_get_icon_url (GUPNP_DEVICE_INFO (device), NULL, -1, -1, -1, TRUE, NULL, NULL, NULL, NULL); And I get: http://192.168.0.11:50001/tmp_icon/dmsicon48.png The last icon in the list. Instead of the bigger 120x120 icon. I've attached the device.xml for my Diskstation.
Looks like "prefer_bigger" is only used when requested_width and/or requested_height is used. That's probably not what was intended.
So the expectation is: "prefer_bigger" should lead to the largest icon to be selected if no width or height is given? That sounds reasonable. I'm pretty sure you can already workaround this by setting large values for width and/or height with prefer_bigger=TRUE.
Created attachment 280244 [details] [review] Respect 'prefer_bigger' even if icon size is not requested If gupnp_device_info_get_icon_url() was called without a specific size request, it returned the last icon in the list. This patch makes the function return in those circumstances either the largest icon or the smallest icon, based on 'prefer_bigger' argument value.
Created attachment 280245 [details] [review] tests: Add test for #722696 (icon size request issue)
Created attachment 280246 [details] [review] Respect 'prefer_bigger' even if icon size is not requested If gupnp_device_info_get_icon_url() was called without a specific size request, it returned the last icon in the list. This patch makes the function return in those circumstances either the largest icon or the smallest icon, based on 'prefer_bigger' argument value.
Comment on attachment 280246 [details] [review] Respect 'prefer_bigger' even if icon size is not requested meh, this still has one problem... just a sec.
Comment on attachment 280246 [details] [review] Respect 'prefer_bigger' even if icon size is not requested Actually, that was just me reading wrong: it is correct. When no size request is included, icon->weight is set at icon pixel count. Then selection is just a case of largest or smallest weight based on 'prefer_bigger' value.
Review of attachment 280245 [details] [review]: +1
Review of attachment 280246 [details] [review]: +1 ::: libgupnp/gupnp-device-info.c @@ +767,3 @@ * incorrect depth. */ + /* Note: Meaning of 'weight' changes when no + * size request is included. */ Why does it change meaning?
(In reply to comment #9) > Review of attachment 280246 [details] [review]: > > +1 > > ::: libgupnp/gupnp-device-info.c > @@ +767,3 @@ > * incorrect depth. */ > + /* Note: Meaning of 'weight' changes when no > + * size request is included. */ > > Why does it change meaning? When a size request is set, 'weight' is a sort of a distance from the optimal values of width, height and density (and smallest weight wins). When size request is not set, that doesn't work as the optimal value would be "infinite" in the case of prefer_bigger. So in that case weight is just number of pixels and largest weight wins (or smallest in case of !prefer_bigger).
well still kind of a weight, but ok.
Attachment 280245 [details] pushed as b6e3169 - tests: Add test for #722696 (icon size request issue) Attachment 280246 [details] pushed as ce83d1c - Respect 'prefer_bigger' even if icon size is not requested