sailfishos / droidmedia

15 stars 57 forks source link

Camera 2: Tele and wide angle cameras #125

Open simonschmeisser opened 6 months ago

simonschmeisser commented 6 months ago

The Sony Xperia 10 III has three cameras on the back but only one is announced currently. On Android the camera is switched automatically based on zoom level but ACameraMetadata_isLogicalMultiCamera returns false here:

https://github.com/sailfishos/droidmedia/blob/7940c60d42edfd65af6c1f0e1c8dd8aad3c56da7/droidmediacamera2.cpp#L421

Do we need to enable this somehow? Is there another way to switch cameras?

Some links: https://developer.android.com/media/camera/camera2/multi-camera

https://developer.android.com/ndk/reference/group/camera#group___camera_1gga8480a8f9e2ee6f1ad2489ee1649f9ef9ad0531bfb7b50c1e6dd4ff85b630b790e

The docs also talk about fancy multi camera modes with stuff like bokeh effects by combining several cameras etc. Do we expect these to be implemented and unlockable here?

abranson commented 6 months ago

The other physical cameras on the Xperia 10iii are disabled by default because they cause problems on the camera1 API. You can enable multiple cameras by editing a config file like this:

https://docs.sailfishos.org/Support/Help_Articles/Camera/#multiple-cameras-of-xperia-10-iii

There's also an app on Chum to do this with a top menu item:

https://build.sailfishos.org/package/show/sailfishos:chum/x10iii-cam-button

simonschmeisser commented 6 months ago

Thanks!

Now I see 5 circles in the ui of which three select the three back lenses. Unfortunately after tapping on circle nr 4 once I'm stuck there. I can switch to front camera and restart jolla-camera, then the front camera works again. But as soon as I switch to the back camera I'm stuck with a black image.

mlehtima commented 6 months ago

You probably need to remove the current camera index from dconf to get it working again.

abranson commented 6 months ago

You can do that with dconf reset /apps/jolla-camera/deviceId (maybe I had to do that recently myself...)

simonschmeisser commented 6 months ago

Thanks for your very handy tip!

02-13 20:53:25.364 12227   293 E DroidMediaCamera: Camera 0 facing 1 orientation 90
02-13 20:53:25.369 12227   293 E DroidMediaCamera: Camera 1 facing 0 orientation 270
02-13 20:53:25.374 12227   293 E DroidMediaCamera: Camera 2 facing 1 orientation 90
02-13 20:53:25.380 12227   293 E DroidMediaCamera: Camera 3 facing 1 orientation 90
02-13 20:53:25.385 12227   293 E DroidMediaCamera: Camera 4 facing 0 orientation 90
02-13 20:53:25.390 12227   293 E DroidMediaCamera: Camera 5 facing 1 orientation 270
02-13 20:53:25.396 12227   293 E DroidMediaCamera: Multicamera with physical camera count 2
02-13 20:53:25.396 12227   293 E DroidMediaCamera: Camera 6 facing 1 orientation 90

So two selfies and 5 back facing cameras, interesting! Does anybody know how to filter these?

ACAMERA_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE was set for all of them

abranson commented 6 months ago

I think the other three are virtual cameras made from combining other - maybe those bokeh ones or something. I think there's something in there to identify physical and virtual cameras, but either it's not working or someone was hoping to get those working? Not sure sorry.