GNOME Bugzilla – Bug 745740
camerabin: update zoom param spec if video source changes its max-zoom
Last modified: 2015-03-08 19:26:41 UTC
I have a video source that allows zooming beyond the maximum hardcoded in camerabin (10f). The source updates its max-zoom properly but camerabin cannot proxy the zoom property changes due to the hard coded limit. This patch allows using the full range of zoom values.
Created attachment 298704 [details] [review] proposed fix I am attaching a proposed fix that works for my case.
Thanks for the fix. Do you think it would also make sense to read this value in initialization when the camera source is set and proxy it?
I don't think it's needed but it really depends on how we expect the pipeline to behave/API to be used. If someone does something like: g_object_set (camerabin, "camera-source", src, NULL); g_object_set (camerabin, "zoom", 11, NULL); then it will fail because the pspec has 10 as its max. However if the user waits until the pipeline is PLAYING then it should work fine. in my case for example, there is no way to tell the max zoom until we reach PAUSED state (we open the device and probe its caps). I am not also sure that probing in ready state (which is when the source is taken into use) will help but I cannot tell here.
(In reply to Mohammed Sameer from comment #3) > I don't think it's needed but it really depends on how we expect the > pipeline to behave/API to be used. > > If someone does something like: > g_object_set (camerabin, "camera-source", src, NULL); > g_object_set (camerabin, "zoom", 11, NULL); > then it will fail because the pspec has 10 as its max. > > However if the user waits until the pipeline is PLAYING then it should work > fine. > > in my case for example, there is no way to tell the max zoom until we reach > PAUSED state (we open the device and probe its caps). I am not also sure > that probing in ready state (which is when the source is taken into use) > will help but I cannot tell here. Does your source always do a max-zoom notify when it reaches playing to notify about its zoom maximum? I'm considering the case where a source would have a different max-zoom but doesn't notify because it is always the same since the beginning. So the camerabin API and the source API wouldn't be agreeing to each other. Do you see this as possible?
(In reply to Thiago Sousa Santos from comment #4) > Does your source always do a max-zoom notify when it reaches playing to > notify about its zoom maximum? Yes it does. > I'm considering the case where a source would have a different max-zoom but > doesn't notify because it is always the same since the beginning. So the > camerabin API and the source API wouldn't be agreeing to each other. It still depends on how you expect the API to be used :-) a GObject property needs to have a default min, current and max values anyway so it depends on what the developer of the custom source chooses for those values. > Do you see this as possible? It seems possible but not like we get a new camera source every day ;-) I'd personally not be concerned about it but if you still believe it's a possibility then I can try to find time to create another patch. There is also something I noticed, why does camerabin proxy the zoom and max-zoom only? Either we proxy all the photography properties or we proxy none. I was tempted to suggest removing those properties completely.
I see your point that sources should be emitting a notify to update the property as default should always be present while the element is in NULL. Thanks for the patch, pushed. commit d49dbefd6c49193073c6334fd493f6899bf237d2 Author: Mohammed Hassan <mohammed.hassan@jolla.com> Date: Fri Mar 6 14:49:20 2015 +0200 camerabin: update zoom param spec if video source changes its max-zoom If the video source happens to allow max-zoom to be greater than our maximum hard coded value of 10 then the user cannot set anything greater than our maximum specified in the param spec. We have to update our param spec to prevent glib from capping the value https://bugzilla.gnome.org/show_bug.cgi?id=745740